@personaai/nestjs
v0.1.1
Published
NestJS adapter for the Persona runtime (persona.hasanraiyan.me) — dynamic module, injectable service, and middleware for streaming AI agents. Server-side only.
Maintainers
Readme
@personaai/nestjs
NestJS adapter for Persona — a dynamic module, injectable service, and middleware for mounting the Persona runtime in a NestJS application.
v0.1.0. Requires NestJS 10 or 11. Server-side only — never bundles the credential.
Install
npm install @personaai/nestjsQuickstart
// app.module.ts
import { Module } from '@nestjs/common';
import { PersonaModule } from '@personaai/nestjs';
@Module({
imports: [
PersonaModule.forRoot({
baseUrl: process.env.PERSONA_BASE_URL!,
credential: process.env.PERSONA_CREDENTIAL!,
resolveUser: (request) => request.headers['x-user-id'] ?? null,
}),
],
})
export class AppModule {}The runtime surface is now mounted at /api/persona/* — streaming chat, threads, files, memory, MCP OAuth, and health.
Key features
PersonaModule.forRoot()/forRootAsync()— register the runtime with sync or DI-based configPersonaService— injectable service withforUser(id)for scoped SDK clientsPersonaMiddleware— handles AG-UI SSE streaming, multipart uploads, and request translation- Clean shutdown — implements
OnModuleDestroy, callsruntime.close()automatically
Full documentation
persona.hasanraiyan.me/guides/nestjs/quickstart — quickstart, auth, routes, uploads, and streaming docs.
Dependencies
@personaai/runtime^0.5.1 (installed automatically)@nestjs/common^10 || ^11 (peer dependency)@nestjs/core^10 || ^11 (peer dependency)
