When to add Ember Data

I think there’s a big push of “use Ember Data only if your API uses JSON:API” for small projects I think this is fairly reasonable.

Really I would say use Ember Data for resources/data sources with some sort of standardization or predictability and description. For new APIs I would heavily recommend JSON:API since it works out of the box. But, if you have a legacy API with good standardization and serialization then making an Ember Data adapter makes sense (for instance if you have 100s of models using Active Model Serializer, using a single adapter for all those resources makes a lot more sense than not using Ember Data or rewriting to JSON:API).

On the flip side though. If you don’t need caching or deduping or background loading, you may want to use fetch or a simple AJAX wrapper to avoid the weight and cost of Ember Data models (observers, etc). For instance for reporting we use AJAX or fetch with POJOs and Map/Reduce functions even though our reporting APIs are all JSON:API because we don’t need to have model tracking.

1 Like