$ show mainmatter/ember-simple-auth
ember-simple-auth is a lightweight Ember.js addon for implementing authentication and authorization in Ember applications. It provides a session service, pluggable authenticators (OAuth2 password grant, implicit grant, Devise, Torii, and custom), and session stores (localStorage, sessionStorage, cookie, adaptive, ephemeral) that persist the session across page reloads and synchronize across browser tabs. The library supports FastBoot, Engines, and Embroider, and includes built-in test helpers. Architecture follows a service-based pattern where the session service delegates to an internal session module that manages state transitions (unauthenticated, authenticated, loading) and communicates with authenticators and stores via events. The codebase is partially migrated to TypeScript, uses modern tooling (pnpm workspaces, Rollup, eslint flat config), and maintains broad compatibility with Ember versions from 3.28 onward.
The LLM identified 3 files worth highlighting for reuse:
A lightweight, framework-agnostic event target implementation providing addEventListener/removeEventListener/dispatchEvent API. Used internally to decouple from Ember's Evented mixin. Can be extracted and reused in any JavaScript/TypeScript project requiring a simple event system.
A utility function for deep equality comparison of objects, handling nested objects and arrays. Useful for comparing session data or any state changes. Can be extracted as a standalone utility.
A mock authenticator for testing that allows programmatic control of authentication state. Provides authenticate and invalidate methods resolving immediately with configurable data. Essential for writing acceptance tests with ember-simple-auth and demonstrates a clean mock pattern for authenticator interfaces.