Best Ember Back End?

So I currently have a Spring back end and I am basically giving up on trying to make it work with Ember Data. The problem is the JSON formatting of course. What is THE backend that everyone is using with Ember Data? I just want something that will work so I can get started with my development, and not spending a lot of time researching how to fix something. It appears to me that people are using Ruby. Does Ruby support the JSONApi format? If not, what IS everyone using?

Thanks in advance!

  • Peter
2 Likes

I have tried Ember with Ruby on Rails (using active model serializers) and Python/Django (using django rest framework) and both played well with Ember Data.

However, if you already have a backend ready, why not try an alternative data store for your Ember app? One that looks very nice is SoftLayer Ember Store. The SoftLayer guys developed it for their legacy API, and it’s pretty flexible; however, it lacks relationship management.

If you go the Ruby on Rails route, I’d advise using the 0.8.x branch of Active Model Serializers in your Rails project and the ActiveModelSerializer adapter in your Ember project. Also avoid nested routes even though they can make sense and are easy in Rails, they won’t play well with Ember Data (for now).

1 Like

I have been using Ruby on Rails for my project backends for a while now. There are tons of good resources to get you up and started.

I have a few examples on github that might help you out as well: Ember-Rails-Project-Base

1 Like

Wow this looks exciting! I didn’t realize that there were alternatives to Ember Data!

My backend is Rails. I began with ActiveModelSerializers but found that modifying it was difficult. I settled on GitHub - ismasan/oat: Adapters-based API serializers with Hypermedia support for Ruby apps. which supports JSON-API pretty well. I’ve had to make customizations for polymorphism, inheritance, and to prevent circular references on my fork.

1 Like

I’ve integrated a Spring backend with Ember Data recently for a client’s project and I can attest that it’s quite a chore to get running. You cannot just take an object graph and serialize it the way you do with a regular Spring MVC controller.

The major pain point using Ember Data with a Java/Spring backend is that every object must have an identity, even nested submodels. This is quite an unusual requirement if you’re working with, for example, JPA. To get around this you have to make customizations in the Jackson JSON mapping using annotations.

If you already have a Spring backend, evaluating simpler alternatives to Ember Data might be worth the effort:

https://github.com/bustlelabs/ember-restless

https://github.com/ebryn/ember-model

1 Like

I’ve had success with Firebase (https://www.firebase.com/docs/web/libraries/ember/quickstart.html). It is incredibly easy to use as long as your requirements fit within their offerings.

I would love to see those customizations! Is that something you are willing to share? :smile:

We are using SailsJs with ember-blueprints - absolutely loving it! Was using a .NET backend but TBH I’ve gone right off .NET these days lol - the dev cycle is just too horrendously slow with very little gains - if any!

SANE (https://github.com/artificialio/sane) is good too, would definitely recommend giving that a go if you’re thinking of going the NodeJs route.

2 Likes

Can’t share client code, but I’ve put together an example.

https://github.com/lfridael/ember-data-spring-example

Java part: https://github.com/lfridael/ember-data-spring-example/commit/8e10c70197f7e0776fd6575f156c1833874768e0

The code shows the Jackson annotations needed to map the output to Ember Data-compliant format.

Use of @JsonIdentifyInfo illustrates the need for embedded objects to have separate identity: https://github.com/lfridael/ember-data-spring-example/blob/8e10c70197f7e0776fd6575f156c1833874768e0/src/main/java/com/github/emberdata/spring/domain/Track.java

Ember part: https://github.com/lfridael/ember-data-spring-example/commit/af3a1d42ae90abd6796d3358b8dabb1231659ae5

The only relevant thing here is the serializer: https://github.com/lfridael/ember-data-spring-example/blob/af3a1d42ae90abd6796d3358b8dabb1231659ae5/ui/app/serializers/album.js

This example has a very simple domain model, but already illustrates the many pain points you’ll encounter. Without framework-level support for Ember Data integration, you’ll be stuck in boilerplate hell before you’re even getting started.

I use Ember Pouch and CouchDB. Example: GitHub - broerse/ember-cli-blog: Tom Dale's blog example updated for the Ember CLI

Thank you :slight_smile:

I am learning Rails, just to make better backends.

Besides that, here at my company we use Python+Flask. Since we started using it (June 2013) the results are being amazing and very scalable.

I just create a sample project like yours, @bahudso: https://github.com/jeanleonino/ember-flask-project-base

I think the lowest overhead way to get it done is to use Express and something like Mongo. Since NoSQL data stores don’t really make any assumptions about your models, you can store what Ember Data sends as-is, and with Express, you can handle server routing right in the app. You can do simple endpoints in 3 or 4 lines of boilerplate. Just override ED’s serializer to use _id as the primary key and you’re set.

1 Like

I think you could try this: https://github.com/jarias/generator-jhipster-ember

It already implements Spring + OAuth2 + EmberJS, so might be useful for you, at least to understand how to integrate Spring and Ember Data.

I second the motion to use sails with ember. Just use ember blueprints and you’ll be up and running in no time.

1 Like

My preference is using the Django REST Framework with a server side compatibility adapter (full disclosure: I’m one of the authors of the adapter) that makes the server use the same format as Ember Data expects. The adapter also handles snake_case to camelCase conversion and pluralization so you can use different variable name styles in each environment.

While it may take a little to learn how Ember Data works once you do it’s very very productive.

3 Likes

How was your review with sails so far is it good to use as a alternative to ruby and python

At Netflix, we pair Ember with Ruby on Rails. To help with serialization, we built (and open-sourced) fast_jsonapi to speed up the serialization process quite a bit.

1 Like