Skip to content

@stratal/framework

@stratal/framework is an optional package that provides higher-level features on top of the core stratal package. It includes database integration, authentication, role-based access control, factories, and guards.

Terminal window
yarn add @stratal/framework

The package is organized into sub-path exports so you only import what you need:

Import pathProvides
@stratal/framework/databaseDatabaseModule, @InjectDB, DatabaseSchemaRegistry, plugins
@stratal/framework/authAuthModule, AuthService
@stratal/framework/contextAuthContext, AuthUser
@stratal/framework/access-controlcreateAccessControl, AccessService, extendRole
@stratal/framework/guardsAuthGuard factory
@stratal/framework/factoryFactory base class, Sequence

The core stratal package provides the module system, DI container, router, events, queues, and cron jobs. @stratal/framework builds on these primitives to offer application-level features:

  • Database uses the DI container for connection management and the event system for database events.
  • Auth uses middleware and request-scoped providers from the core.
  • Access control integrates with AuthContext so the current user’s roles are available in every request without a database round-trip.
  • Guards use the core guard system (CanActivate) with auth and permission checks.
  • Factories work with the database service for persistence.

You can use the core package without @stratal/framework if you don’t need these features.

  • Database for ORM integration and multi-connection support.
  • Auth for authentication with Better Auth.
  • Access Control for declaring resources, roles, and permissions.
  • Auth Guard for protecting routes with auth and permission checks.