React phoenix integration - add it to my phoenix project or keep react in a separate server?

I have been doing both, with pros and cons.

All in one

pros:

  • all in one, easier deployment
  • no need for cors

cons:

  • bind to backend, what if You want to reuse?

Separate

pros:

  • easier to switch and reuse
  • –no-html --no-webpack

cons:

  • not really a cons, but maybe You need to configure cors.
  • need to add phoenix.js as dependency
  • need two servers, more complex to deploy

I prefer to separate, but use only one server… and build into priv/static of the Phoenix server.

BTW You can do server side react rendering.

No, You can also use websocket.

1 Like