A minimal Express server demonstrating PersonaKit without Next.js.
cd examples/basic-node
pnpm installCreate a .env file:
OPENAI_API_KEY=sk-your-api-key-here
pnpm startOpen http://localhost:3000.
index.ts- Express server with chat endpointagent.ts- Agent configurationknowledge/- Sample documents for RAG (optional)
- The Express server exposes a
/api/chatendpoint - Requests are converted to Web Request format
- PersonaKit's agent handles the request
- Responses are streamed back to the client
- Add markdown files to
knowledge/ - Uncomment
knowledgeBaseinagent.ts - Restart the server
- This example uses
tsxfor TypeScript execution - Production deployments should use proper build tooling
- Consider using frameworks like Fastify for better performance