@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.
Installation
Section titled “Installation”yarn add @stratal/frameworkSub-path exports
Section titled “Sub-path exports”The package is organized into sub-path exports so you only import what you need:
| Import path | Provides |
|---|---|
@stratal/framework/database | DatabaseModule, @InjectDB, DatabaseSchemaRegistry, plugins |
@stratal/framework/auth | AuthModule, AuthService |
@stratal/framework/context | AuthContext |
@stratal/framework/rbac | RbacModule, CasbinService |
@stratal/framework/guards | AuthGuard factory |
@stratal/framework/factory | Factory base class, Sequence |
Relationship to core
Section titled “Relationship to core”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.
Next steps
Section titled “Next steps”- 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.