Deploying a pheonix/react app

Howdy ya’ll,

I recently finished a course on how to create a react graphql app with abstinthe and pheonix, and am trying to figure out the best way to deploy the app I built (the course is https://pragmaticstudio.com/unpacked-full-stack-graphql-with-absinthe-phoenix-react.)

The app in the tutorial isn’t an umbrella app – the front-end and back-end are totally separate. I’m struggling to figure out how something like this should be deployed and I’ve never deployed an elixir app before so I don’t have any prior knowledge to lean on.

Also, should the front-end live in the Phoenix app? :thinking:

Any pointers would be appreciated :pray:

Hi @CodeBumpkin,

If you’re happy to spend a few $s a month, render.com is very easy to deploy to. The guide for deploying Phoenix apps is here: https://render.com/docs/deploy-phoenix - a lot of the steps would be similar if deploying to another provider. There are quite a few threads covering different flavours of deployment, but most of the recent approaches depend on mix releases (https://hexdocs.pm/mix/Mix.Tasks.Release.html) so you should take a look at that - it probably answers most of your questions if you have experience deploying other frameworks.

As far as your react front end goes, you could serve it up as static assets from your Phoenix app - probably the fewest moving parts to worry about overall. There’s any number of ways depending on what your situation is, as per the react docs (https://create-react-app.dev/docs/deployment/). If you do use Phoenix, note that it works fine without Nginx, Apache or similar in front for small, simple applications.

1 Like