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
@stratal/framework/rbacRbacModule, CasbinService
@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.
  • RBAC integrates with the DI container and request scope for per-request authorization.
  • Guards use the core guard system (CanActivate) with auth and RBAC 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.
  • RBAC for role-based access control.
  • Auth Guard for protecting routes with auth and permission checks.