I’m currently planning out a new project that will likely be using Rails & Ember.
My question is what is the current best practice for using the two together. It seems like I have two options.
Option 1: Two separate repos, like ~/Projects/greenfield-rails-api and ~/Projects/greenfield-ember.
Option 2: Next Ember within the Rails app.
The only discussion I was able to find around this was several years old.
Curious and appreciative of any feedback!
IMO Keep the apps separate. You can keep test / build / deploy cycles focused on the part of the app you are working on instead of conflating the two.
I concur, I’d keep them separate. It can be easier to set up other tools like CI, dependency updaters (dependabot, for example)… and to @stephencattaneo’s point I think it’s definitely better to create a strong mental separation between the two. I used a backend/frontend monorepo at my last company and it didn’t really gain us much of anything (vs an ember monorepo which can be much less annoying to manage).
Yes the two are separate. Keep em separate. IMHO attempting to build ember via a rubygem is a nightmare (I’m sure the folks who built Discuss can attest).
However, that doesn’t mean you need two repos. You could have an umbrella like repo that has two directories in it one for the rails app and one for the ember app.
Also if you want to serve the ember app from the Rails app the code is pretty simple. I have found that this solution is the best and I use it every time: https://github.com/ember-cli-deploy/ember-cli-deploy-lightning-pack
But if that setup is more complicated then you want for a greenfield Rails app you could also just host the ember app on a static web hosting service (like S3 or Dropbox) and then have your Rails app send CORS headers for that domain.
Thanks all for the feedback! That lightning pack looks super helpful.