Introduction
The @frame/auth package is the heart of identity control within the FRAME monorepo. Its primary purpose is to centralize and standardize how users sign in, maintain sessions, and authenticate securely across multiple interfaces.
Design Philosophy
Section titled “Design Philosophy”Unlike authentication models coupled to a single application, @frame/auth is designed as an independent layer.
- Single Source of Truth: Session rules, token strategies, and schemas are defined here and imported by both the client (Next.js) and the backend (NestJS).
- Cross-Platform Focus: It exports both server-side configurations and standard auth clients.
Base Infrastructure
Section titled “Base Infrastructure”The package builds its capabilities on the Better Auth engine, enriched with tools from the FRAME ecosystem.
- Better Auth: Primary authentication framework, chosen for its portability, native performance, and TypeScript extensibility.
Relationship with the Ecosystem
Section titled “Relationship with the Ecosystem”| Dependency | Role |
|---|---|
@frame/models | Defines and injects the underlying database that stores profiles, sessions, and account tokens. |
apps/next | Consumes the authentication client (authClient) to hydrate components and protect routes reactively. |
apps/nest | Wraps the Better Auth server instance to inject authorization flows through custom decorators. |
Continue to Logical Architecture to understand dynamic plugin wiring.