Phoenix + Nuxt.js monolith

Hi all,

I was wondering if anyone has managed to build a web app using Phoenix with Nuxt.js as a single app. I think having a single app simplifies CI/CD and deployment. I’ve been struggling with embedded Elixir for a bit, which is why I’m looking for an alternative now.

Can you explain what you mean?

If you need ssr on the nuxt app you’ll need to render it with node, I’ve seen some experimentation with that around here but with react.

I guess if you were building nuxt to a static website it could manage to output the final contents into the phoenix static folder and then have a route that does the logic, or a macro that reads the contents of the output folder and builds accordingly the routes needed? Not sure.

Hey, thanks for looking into this.

Sorry for the poorly worded question, having read a bit about it, I think that I will indeed need to render it with Node, so I’m thinking of splitting up my frontend and backend entirely.

I’ve managed to keep my Node/Vue rendering inside the monolith using: GitHub - revelrylabs/elixir-nodejs: An Elixir API for calling Node.js functions. I also use the elixir-nodejs package with the Node Sharp library to produce images on the fly.

Nice! But you are still having to effectively treat Phoenix as an API for your Vue frontend, right?

Yes exactly. Everything goes through Phoenix which I find much simpler to manage and scale. I had tried separate apps initially but found it too painful. I was basically putting them together in a Kubernetes deployment with 2 separate Docker images.

Ok, thanks for sharing your experience. I’ve attempted to bundle Nuxt with Phoenix but it turned out to be painful. I thought it would be easier to keep them separate and them deploy them together with docker compose.