Ember.js and Ruby on Rails: Strategy

474 Views Asked by At

I need to develop an interactive web app with an admin backend. I have thought about using Ember.js for the frontend and Ruby on Rails (with ActiveAdmin) for the backend.

But i have some questions:

1) Should i put the Ember.js app inside the rails project, or having both separate? Is there any performance difference or something i should know about choosing one of the two strategies? I like to have things as clear as i can.

2) Should i use Ember.js and Rails-API instead? I mean... i think i won't use almost anything about the Ruby on Rails project... But i am confused, as i need the Admin Backend...

I have some experience (a little) on Ruby on Rails, but as i am new to Ember.js, i would really appreciate any help you can give me.

3

There are 3 best solutions below

2
On

I also worked on a similar kind of project, and believe me having two different projects will benefit you a lot.

I used followings:

  • Sinatra for backend
  • Backbone.js for frontend

It makes a lot easier to add the functionality in your code, when you use two separate apps.

0
On

Here's my take:

  1. If you're fluent in Rails, stick with Rails.

Yes, Sinatra or other frameworks may be lighter, but you'd have to handle lots of things by yourself.

As for Rails-API, it's a good project, but it's a bit of hassle at the beginning to figure out what modules were removed, etc. You can make an API with Rails without Rails-API. You can always use Rails-API at a later point if it turns out you need the performance increase.

  1. Use Ember CLI for your client application.

It's the golden path for developing ember applications and using third party libraries. The gem Ember-rails still works and is still maintained, but you should not start a new project with it.

  1. Keep them separate

It simply makes more sense to have them separate. This way, development and deployments of both apps are not tied to each other.

It uses more repositories though, and if you're using github, it may mean you'd have to switch plans. But there are other options such as bitbucket where the pricing is not tied to the number of private repositories

I hope this helps you.

3
On

I recently had a similar project with an Angular app and a Rails backend. I agree with Arslan. Having a Sinatra, Rack or other API is better than Rails.

Using Ember for some parts, and Rails for other parts (like the Admin section) is a bad idea because:

  1. You are doing the same things 2 different ways: getting data, rendering pages, etc.
  2. You would have 2 separate functionalities in within the Rails app: one Rails app and one API.

It is much simpler to run 2 separate apps than to put a Javascript MVC into a Rails app. You end up with complexity in getting the Asset Pipeline to do what you need.