Phoenix / React / Redux app - how to configure ports for deployment?

Hi guys,
I’m developing a web app with Phoenix / React / Redux. My structure is Phoenix as socket server, React as frontend framework. I’ll start Phoenix visible on some port (4000 or other). React will be on port 80 and read/write on 4000. Is this scenario suitable? And if there is better approach please add some.

1 Like

This is possible, but what you can do (and it is advised to do so when you will run the application in production) is to have Phoenix serve the React application to you, meaning that both can use port 80 together.

But during development, because of the way React’s auto-reloading works, it makes a lot of sense to use it on a separate port.

2 Likes

I would say its more advised to serve the static react app build from nginx itself as compared to tightly tying together your front and back end.

2 Likes