Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 39 ยท Build, Addons and Deployment

Ember Addons and Packages

Find, install and evaluate Ember addons, understand v1 and v2 addon formats, learn the must-know addons, and see how a plugin system merges addon features.

Ember's ecosystem is built around addons: npm packages that plug into the build and the app. An addon can add components and helpers (a date picker), services (authentication), blueprints for ember generate, test helpers, build steps (a Sass compiler) or all of these at once. Since they follow the framework's conventions, a good addon usually needs one install command and works.

This lesson shows how to install and evaluate addons, which ones most apps use, the difference between the old (v1) and current (v2) formats, and how to write a small addon. Because the site cannot run an Ember build, code is read-only and runnable stand-ins model the plugin idea.

Real Ember vs stand-in. Command lines and file-named blocks are real and read-only. Runnable blocks are plain-JavaScript models.

Installing an addon

Terminal
ember install ember-power-select

ember install runs npm install and then the addon's default blueprint, which may edit config files or add sample files. You can also use npm install directly and follow the addon's README if it has no blueprint. After installing, restart ember serve so the build picks up the new package.

To remove one, uninstall the package (npm uninstall name) and delete anything its blueprint added (the README lists them).

Choosing a good addon

An addon becomes part of your app, so treat it like a dependency you will maintain:

Check Why
Is it maintained (recent releases, answered issues)? an abandoned addon blocks Ember upgrades
Does it support your Ember version? the ember-source peer dependency range in package.json
Is it a v2 addon? works with Embroider and Vite without compatibility shims
Does it have tests and accessibility support? UI addons without accessibility cost you later
Could 30 lines of your own code do the job? many addons wrap something small
How big is it? check the bundle cost; large addons may not suit your page

Ember Observer (emberobserver.com) scores addons on these criteria and is the usual place to search. Prefer addons that use plain web standards and Ember's public APIs (tracked state, modifiers, services) over those that depend on internals.

Addons almost every app meets

Addon What it gives you
ember-data the data layer (models, store, adapters), covered earlier in this track
ember-page-title {{page-title "Posts"}} sets document.title per route
ember-concurrency cancelable async tasks with state (isRunning), good for debounced search and double-submit prevention
ember-modifier write your own element modifiers with class or function syntax
ember-resources resources for async data and lifecycle-aware state
tracked-built-ins tracked Array, Map, Set, Object (lesson)
ember-simple-auth login, session storage and route protection
ember-intl translations and locale-aware formatting
ember-power-select accessible select and multi-select
ember-cli-mirage an in-browser fake API for development and tests
ember-test-selectors strips data-test-* attributes from production builds
ember-a11y-testing automated accessibility audits in tests
ember-cli-deploy pluggable deployment pipeline (next lesson)

Before installing a utility addon, check whether the platform already has it. Modern Ember plus plain JavaScript (Intl, fetch, URL, structuredClone, <dialog>) replaces many addons that were needed years ago.

The v1 and v2 addon formats

  • v1 addons are the original format. They contain build-time code (index.js with hooks) that runs inside the classic build and merges their addon/ and app/ folders into your app. They are flexible but tied to the old build system, which makes them slower and harder to optimize.
  • v2 addons (the format ember-addon.version = 2) are pre-built packages: standard ES modules with explicit exports, no build-time magic. Embroider and Vite consume them like any other library, so they are fast, tree-shakable and easier to understand.

New addons should be v2. To create one, use the official blueprint:

Terminal
npx @embroider/addon-blueprint my-addon

It gives you a my-addon/ library package plus a test-app/ that uses it, in a monorepo. A component in an addon is just a file you export:

my-addon/src/components/badge.gjs

JavaScript
import Component from '@glimmer/component';

export default class Badge extends Component {
  get label() {
    return this.args.count > 99 ? '99+' : String(this.args.count);
  }

  <template>
    <span class="badge" ...attributes>{{this.label}}</span>
  </template>
}

and the consuming app imports it:

JavaScript
import Badge from 'my-addon/components/badge';
// <Badge @count={{12}} />

Whether the addon is v1 or v2, ember install and the README hide the difference from users.

How an addon system works: a model

Under the hood, an addon is a plugin that contributes pieces to a host application: files into the module list, config values, and build hooks. The stand-in below shows the core idea: a tiny host application merges what each addon provides, with a clear order and a conflict rule (the app's own files win, which is how Ember lets you override an addon's component).

JS Stand-in: a plugin system that merges addons

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The "app wins" rule is how you can replace one addon component with your own without editing node_modules: create a file at the same path in app/.

Writing a useful in-app abstraction before an addon

Often the right first step is not an addon but a local utility: a helper or modifier in app/ that you extract later if other projects need it. A helper that formats relative time, for example:

JS Stand-in: a helper you might later extract into an addon

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice it needs no addon: Intl.RelativeTimeFormat is part of the platform. Many "needs an addon" problems turn out to be like this.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does ember install some-addon do beyond npm install?

    ember install installs the package and then runs the addon's blueprint so the set-up steps happen for you.
  2. 2. What is the main advantage of v2 addons?

    v2 addons ship plain ES modules with explicit exports, which is faster and simpler than build-time merging of v1.
  3. 3. You want to change how one component from an addon looks. What is the usual, supported approach?

    Files in app/ take precedence over addon-provided files, and wrapping is often even cleaner. Never edit node_modules.
  4. 4. Which question is the best first check before adding an addon for a small utility?

    Every addon is a dependency to maintain. If the browser or a small helper does the job, skip the addon.

Summary

  • Install with ember install (npm install plus the blueprint) and restart the dev server.
  • Judge addons on maintenance, version support, v2 format, accessibility, size and whether you need them at all.
  • Common addons: ember-page-title, ember-concurrency, ember-modifier, tracked-built-ins, ember-simple-auth, ember-intl, ember-cli-mirage.
  • v2 addons are standard pre-built packages; create new ones with the Embroider addon blueprint.
  • The app's own files override addon files at the same path.

Next: Deploying Ember Apps