NestJS + Prisma + PostgreSQL for scaling ecommerce backends

Prisma is a TypeScript data layer with generated types and migrations; NestJS adds DI modules and HTTP controllers on top.
Migrations and environments
Every schema change is reviewed and tested against anonymised prod clones.
No manual ALTERs in prod without a migration file.
Query performance
Deep `include` trees can N+1 bomb, we profile and narrow selects or drop to SQL.
Indexes on tenant_id, order status and created_at are table stakes for admin lists.
Distributed transactions
Event sagas instead of XA when external integrations are slow or flaky.
Outbox pattern for DB-queue consistency.
Frequently asked questions
- Why not TypeORM?
- TypeORM still appears in legacy, new builds often pick Prisma for DX and typing safety.
- Does Prisma replace a DBA?
- No. indexes, partitioning and vacuum still need engineering oversight at scale.
- What about NoSQL?
- We use it for document or event-log models, not as a default for everything.
Content updated: February 27, 2026