Snapshot for
@system-core/core0.8.x. Current docs live at /.
NestJS API On System-Core
Recipe
Use this when NestJS owns the HTTP API shell but system-core still owns the package runtime.
Target Outcome
- NestJS provides modules, controllers, guards, and dependency injection.
system-coreowns auth, CMS, delivery, storage, and platform primitives.- The NestJS integration package bridges requests into package-owned runtime behavior.
Build Shape
- Bootstrap
createSystem()once during Nest application startup. - Register the resulting runtime in a Nest provider.
- Use
@system-core/core/integrations/nestjsfor adapter-facing glue. - Build controllers and services on
system.auth,system.cms, andsystem.delivery.
Install
bash
npm install @system-core/core zod @prisma/client
npm install bcryptjs jsonwebtoken nodemailerAdd Nest and host-framework packages in the application itself, then add these only when needed:
- Redis-backed limits or queues:
npm install ioredis - S3 media storage:
npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
Bootstrap Provider
ts
import { createSystem } from '@system-core/core'
export const systemProvider = {
provide: 'SYSTEM_CORE',
useFactory: async () => {
return createSystem({ prisma, media })
}
}Service Usage
ts
import { Inject, Injectable } from '@nestjs/common'
@Injectable()
export class PagesService {
constructor(@Inject('SYSTEM_CORE') private readonly system: Awaited<ReturnType<typeof createSystem>>) {}
listPublished() {
return this.system.cms.listPublishedPages()
}
}Guardrails
- Keep NestJS as the host shell, not the owner of auth or CMS logic.
- Centralize the runtime instance; do not create a new system per request.
- Prefer package-owned permission and session flows over duplicate Nest services.