Motivations for using React/Vue SSR

From what I’ve come across your typical React or Vue SPA will be bundled with webpack which will tend to generate its own index.html. While that can simply be served as an asset by Phoenix there hardly seems to be a good reason to do so given that Phoenix’s asset handling primarily exists to be used to support pages generated with EEx. Now if you aren’t using EEx then there is a strong argument to keep Phoenix “unentangled” from the frontend.

Also to me SSR in connection with React or Vue implies that the server side rendering will be handled by Node.js - so serving your React/Vue SPA from Phoenix would prevent you from using their typical SSR technologies.

Now it is entirely possible to generate pages with EEx that reference/include React or Vue components which are served by Phoenix - but I wouldn’t call that an SPA. And while the EEx rendering happens on the server side, the components themselves are still rendered on the client side.

3 Likes