Skip to content

Experience · Backend · Active

cs-chat api

NestJS BFF for CS Chat, owning chat persistence and same-origin product APIs while delegating auth, direct AI generation, agentic MCP replies and manual MCP tool calls to Core services.

  • NestJS 11
  • Prisma 7
  • PostgreSQL
  • class-validator
  • helmet

Spec sheet

Repository path

cs-chat/apps/api

Runtime

NestJS 11 BFF

Default port

3004

Public surface

Same-origin /api on chat host

Database

cs-chat-postgres via Prisma 7

Responsibilities

  • Expose chat, message, fork, auth-session, AI-provider and MCP endpoints.
  • Resolve user membership through platform-auth-service.
  • Call platform-ai-service for provider discovery and assistant responses when MCP is disabled.
  • Create platform-agent-service executions for assistant responses that need real MCP tool use.
  • Call platform-mcp-service for manual tool catalog and tool execution.
  • Keep persistence in repository and Prisma modules, not in controllers.

Interfaces and contract surface

  • GET /api/health
  • GET /api/auth/session
  • POST /api/auth/login/password
  • GET /api/ai/providers
  • GET /api/chats
  • POST /api/chats
  • PATCH /api/chats/:threadId
  • POST /api/chats/:threadId/messages
  • POST /api/chats/:threadId/forks
  • GET /api/mcp/tools
  • POST /api/internal/agent/executions/callback

Consumers

Dependencies and external touchpoints

Notes

  • Controllers stay thin; orchestration lives in services and Core calls live in platform clients.

Source references

  • cs-chat/apps/api/package.json
  • cs-chat/apps/api/prisma/schema.prisma
  • cs-chat/apps/api/src/chats
  • cs-chat/apps/api/src/platform

Workspace reference: /Users/jeanpaul/projects/cs-repository