Building a REST API with NestJS and Prisma
summary
Step‑by‑step workshop shows how to wire Prisma (v2.26) into a NestJS app using an SQLite dev DB, generate Prisma schema and migrations, seed ~15–18 example products, and produce a working REST API with type‑safe Prisma Client CRUD endpoints exposed in Swagger. It adds request validation, response serialization (decimal → number), an application filter that maps Prisma unique‑constraint errors (P2002) to 409, and a cursor‑based pagination implementation that returns Relay‑style edges and pageInfo. It finishes with JWT login that issues access tokens for guarded endpoints.
AI-written summary · about
chapters (18)
- 0:00Intro
- 9:14Setup
- 11:22Integrating Prisma
- 13:27Installing Prisma
- 14:55Migrations
- 17:32Seeding
- 20:25Prisma Studio
- 21:33Prisma Client
- 25:44Testing
- 29:33Creating REST endpoints
- 32:00Get Products endpoint
- 39:59Update Product endpoint
- 42:40Create new Product endpoint
- 45:32Creating a product entity
- 50:28Adding boilerplate
- 51:26Validate incoming requests
- 52:17Validation at the application level
- 56:27Transform rules
related talks
46mAn API from scratch with NestJS
41mRapid and type-safe Node.js development with Prisma
46mBoost your API Development with GraphQL & Prisma
38mBuild modern and scalable Node.js Web Applications with Nest
31mUnderstanding GraphQL, databases and Prisma
31mGraphQL Boilerplates
29mModernize and Robust Applications with Prisma & Azure SQL Server
16mHow Next.js and Prisma make frontend developers full-stack
