Prisma ORM data layer for chauffeur platform PostgreSQL database

Data access

Prisma

Type-safe ORM migrations keep PostgreSQL schemas aligned with NestJS services.

Prisma ORM data layer for chauffeur platform PostgreSQL database
Overview

Typed data layer

Prisma schema defines bookings, fleet, partners, and finance tables with strict relations.

Generated client types flow into NestJS services — eliminating stringly-typed SQL in business logic.

Migrations version database changes alongside pull requests for reviewable rollouts.

  • Declarative schema
  • Generated TypeScript client
  • Reviewable migrations
  • Relation integrity
How it works

From model change to production

  • Step 1

    Model

    Engineers update schema.prisma with new fields and indexes.

  • Step 2

    Migrate

    prisma migrate produces SQL reviewed in CI before deploy.

  • Step 3

    Deploy

    Containers run migrations then boot NestJS with matching client version.

Prisma ORM data layer for chauffeur platform PostgreSQL database
Benefits

Engineering wins

  • Fewer runtime surprises

    Compile-time types catch missing includes before production.

  • Safer refactors

    Relation graphs reveal cascade impacts when renaming entities.

  • Onboarding speed

    New developers read schema instead of tribal SQL knowledge.

Prisma security
Security

Data access controls

Services never construct raw SQL with user input — Prisma parameterizes queries.

Database roles separate migration users from application read/write users.

  • Parameterized queries
  • Separate DB roles
  • No ad-hoc prod SQL
  • Migration user isolation
Prisma integration
Integration

NestJS integration

PrismaService wraps clients per request with tenant filters injected in repository layers.

Seed scripts bootstrap demo tenants for sandbox partners without touching production.

  • NestJS PrismaService
  • Tenant filter middleware
  • Seed scripts
  • CI migrate diff
Prisma business use cases
Use cases

Schema domains

  • Booking lifecycle

    Statuses, passengers, and pricing lines model complex chauffeur trips.

  • Partner settlements

    Ledger tables link trips to payout batches with foreign keys.

  • Audit history

    Immutable audit rows reference actors without nullable chaos.

Support

Prisma FAQ