Skip to content

ADR-001: NestJS + PostgreSQL + Prisma

Status

Accepted

Date

2026-04-11

Context

MCP DevKit needs a backend framework, database, and ORM. The author has 9 years of TypeScript experience and an existing NestJS project (Meterplex) that serves as the quality benchmark.

Decision

Backend: NestJS 11

  • Modular architecture with dependency injection maps naturally to the domain (registry, runtime, policy, audit, eval = isolated modules)
  • Guards for policy enforcement, Interceptors for audit logging, WebSocket gateway for live traces
  • First-party Swagger/OpenAPI support
  • Same framework as Meterplex - proven patterns carry over

Database: PostgreSQL 17

  • JSONB columns for MCP tool schemas, policy configs, span attributes
  • Row-level security for workspace isolation
  • Production-grade - hiring managers expect real infrastructure for agent platforms
  • UUID primary keys natively supported

ORM: Prisma

  • Type-safe client generated from schema
  • Declarative schema file - single source of truth for database structure
  • Migration system with dev/deploy/reset workflows
  • Same ORM as Meterplex - no learning curve, same patterns

Rejected alternatives:

  • FastAPI (Python) - would split the codebase across two languages
  • SQLite - no JSONB, no row-level security, weak hiring signal for infra projects
  • Drizzle - strong choice but Prisma already proven in Meterplex
  • TypeORM - decorator-heavy, weaker type safety than Prisma

Consequences

  • All team members need TypeScript proficiency
  • Prisma adds a code generation step (prisma generate) to the build
  • PostgreSQL requires Docker for local development (acceptable - already using Docker Compose)