Ember-Data Basics

As the official persistence library of the ember.js framework, ember-data has become more performant, more customizable, and an even more valuable library over time.

Ember-Data Basics

JSON-API

JSON-API is a spec for JSON contracts between APIs and their clients. Because ember-data uses JSON-API by default, and as a guide for its internal data structures, it's useful to be familiar with it when working with ember-data.

If you’ve ever argued with your team about the way your JSON responses should be formatted, JSON API can be your anti-bikeshedding tool.

By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus on what matters: your application.

Clients built around JSON API are able to take advantage of its features around efficiently caching responses, sometimes eliminating network requests entirely.

  • JSON-APIBasic Objects, Errors and Metadata

    We'll work through some examples of how basic objects are defined, according to the JSON-API standard.

  • JSON-APIRelationships & Compound Documents

    In JSON-API, we can define relationships in multiple ways:

    • Including related records directly in the JSON
    • Providing explicit references for each related record (i.e., a type and id)
    • Providing a URL for retrieving related records at a later time

    We'll look at examples for each, and discuss use of the include queryParam for requesting inclusion of related records.


Clever Caching

Ember-data's caching features are often under-utilized, resulting in extra time to fetch data with each page load. We'll explore some simple caching strategies that will translate to major performance gains!

Featuring: Fastboot

We'll look at how ember-data's store can work hand-in-hand with Ember's server-side rendering technology, by way of a fastboot feature called shoebox storage, to land pages on the screen with lightning speed!

Helpful Hooks

Ember-data is easier to customize than ever, but it takes experience to find the right balance between an tangled application adapter monolith, and dozens of single-purpose modules that repeat common logic.