11 thoughts on “Is it better to use react inside rails 6 or two stand alone apps (rails api + separate react app)?”

  1. My thoughts on this :

    Edit: two standalone apps (api + react app)

    I personally prefer building two standalone apps because of the flexibility it provides. I find it personally much more cleaner.

    What I don’t like in react inside rails :
    I tried building a sample app with react inside rails 6 but I had to generate empty html.erb files no matter what. And I am not fan of all those empty files inside views.

    I would be great if others could shed some light in to this

    Reply
  2. Generally if it’s a new project I would separate them… Webpacker is kind of a mess.

    If you are in an existing monolith, depends on your teams preferences and plans for integrating react

    Reply
  3. Starting a fresh project and building it with a front end like react, I would separate them. The big reason being that you could host your entire front end in a cdn, and just have to deal with the backend. That’s my 2c at least.

    You get a nice separation of concerns that way as well, and avoid the whole webpacker thing.

    I built a small app with a vue front end a couple years ago, all in the same codebase, and just set up a separate route for api calls.

    Reply
  4. Haven’t really worked on both being used in one project. But I’m sure it will be a complete ripoff of the real purpose and capability of react. Will almost always prefer them separate as they were originally intended to be.

    Reply
  5. I suggeset separating them. This way neither is dependent on the other in the ccase of updating to new anything

    Reply
  6. It depends exclusively on how you want to organize your development teams. If you have front end developers and back end developers talking though “tickets”, have two different apps in two different repositories.

    If you have a small team of full stack developers, go for a Rails app with sprinkles of React.

    Reply
  7. Depends on the project. If React is just for some small pieces that can’t be done in Rails, then keep them together. If you are doing 100% of rendering in react, then definitely separate them. If you can get away with it, I do recommend using a single repo for both projects to help keep the API changes in lockstep, especially as a single developer developing an unstable API.

    Reply

Leave a Comment