how to deploy an ionic-react app to mobile if I'm using node js server in the backend?



I discovered ionic this week and I’m really considering using it at work.

Basically, my goal is to build an app that will work on android and Ios, where the needed functionality is to connect to the cloud over web socket and pull data from the cloud and show it on my phone. Maybe later I’ll eventually need to consider using login but not for now at least.

Normally, if I’m building a web app. I ll use nodejs to pull the data from the cloud and expose it to the frontend. I ll write all code together and I ll host my app in Heroku or something where the entry point is my nodejs server right? So that my server needs to start and it will take care of the rest.

This is a bit confusing in ionic since I need to start the app with ionic serve, but somehow I also need to start my nodejs server too right? So I assume I can’t write the server-side code inside the ionic app or am I wrong?

There is not much about this on the internet but I did some research and I guess that I should deploy (host) my nodejs server in the cloud (maybe using Heroku) and then connect to the server from my mobile app over the socket. Is this the right/only way to do this? are there any security issues with this method?

I find ionic great but I’m not sure if I should use it at work. Sincerely, this use case of using a backend server with ionic made me confused.

Ionic looks ideal for building cross-platform apps that does not need server-side scripting, but how complex can it be if I want to integrate some server-side code in my app? especially as I said I’m going to use some login forms in the future to extend the functionality of my app.

PS: I’m using ionic 6.10.1 and specifically I’m interested in using ionic with react not with angular.


After some search, I discovered that it isn’t possible to deploy the frontend and backend code together. Therefore the trick is to deploy the nodejs server separate from the frontend.

Precisely, if it is a web app, then you should deploy the nodejs server in a separate host from the frontend. Then by starting the frontend app, you can communicate with the running nodejs server via socket or REST API.

Hope this helps someone in the future 🙂

Answered By – basilisk

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More