Refresh: Building a REST API with NestJS and Prisma (Prisma 7 / NestJS 11)#7977
Refresh: Building a REST API with NestJS and Prisma (Prisma 7 / NestJS 11)#7977vanrensbird wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe tutorial was updated for Prisma 7 and NestJS 11. It replaces older Prisma setup, seeding, service, CRUD, and Swagger instructions with Prisma config, the PostgreSQL driver adapter, generated-client imports, updated NestJS bootstrap, and revised API response typing. ChangesPrisma 7 tutorial refresh
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/blog/content/blog/nestjs-prisma-rest-api-7D056s1BmOL0/index.mdx`:
- Around line 240-256: The `prisma.config.ts` example in the blog post is out of
sync with the current Prisma 7 scaffold. Update the snippet in the section
around the `prisma.config.ts` walkthrough to match the generated shape by using
`env` from `prisma/config` and `url: env("DATABASE_URL")` instead of
`process.env.DATABASE_URL`, and make the same alignment in the later duplicate
example so readers see the exact current output from `prisma init`.
- Around line 325-338: The “Migrate the database” section currently tells
readers to run prisma migrate dev without accounting for Prisma 7’s required
shadow database, so local migrations will fail. Update this workflow by either
instructing readers to export SHADOW_DATABASE_URL from the prisma dev output and
wire it into prisma.config.ts alongside DATABASE_URL, or replace the local
example command with prisma db push and keep migrate dev for the
docker/local-postgres path. Make sure the guidance in the migration section
matches the Prisma 7 setup shown earlier in the article.
- Around line 383-387: The Prisma 7 install snippet in the NestJS Prisma REST
API article only mentions `@prisma/adapter-pg`, which can leave readers missing
the pg driver at runtime. Update the installation guidance in the section
describing Prisma Client and the PostgreSQL adapter to include pg alongside
`@prisma/adapter-pg`, and mention `@types/pg` for TypeScript projects if needed.
Keep the advice aligned with the Prisma Client setup shown in this part of the
article so readers install the adapter and its driver together.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 261014d5-bcda-48b3-9242-2eb4f6df0e83
📒 Files selected for processing (1)
apps/blog/content/blog/nestjs-prisma-rest-api-7D056s1BmOL0/index.mdx
Verified the whole tutorial against Prisma 7.8 / NestJS 11 with a real Prisma Postgres database (npx create-db): scaffolded the app, ran migrate dev + seed, and exercised all CRUD endpoints + Swagger. Changes from that validation and the review: - Add the missing `@prisma/client` install. The generated Client imports `@prisma/client/runtime/client` at runtime; without it the app fails with "Cannot find module '@prisma/client/runtime/client'". (Found by running it; not flagged in review.) - prisma.config.ts: match the actual `prisma init` output (`process.env["DATABASE_URL"]` + generated header comment). The review suggested the `env()` helper, but 7.8 scaffolds `process.env`. - Make `migrate dev` work on the recommended path: lead Option A with `npx create-db` (cloud Prisma Postgres, where migrate dev works), and note that the local `npx prisma dev` server needs `db push` instead (migrate dev fails P1017 there even with a shadow URL). - Note that `@prisma/adapter-pg` pulls in `pg` + `@types/pg`, so no separate `pg` install is needed (review suggested adding it; it ships as a dependency in 7.8). - Add a closing "What's next: Prisma Next" callout (the next major version, Prisma 8) inviting readers to try it. - Remove em/en dashes from prose per the docs writing style. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What this is
A content refresh of the existing post Building a REST API with NestJS and Prisma (
/blog/nestjs-prisma-rest-api-7D056s1BmOL0). Same URL, same author, updated for the current stack.Why
nestjs prisma,prisma nestjs,nestjs prisma postgres) with real search demand. A modern, working version is a strong candidate to move up.What changed (all verified by running it)
prisma-client-jsprisma-client+output+moduleFormat = "cjs"prisma.config.ts(URL +dotenv)new PrismaClient()@prisma/adapter-pg(now required).env@nestjs/configConfigModulepackage.json+ts-nodeprisma.config.tsmigrations.seed+tsx@prisma/client../../generated/prisma/client@nestjs/swagger+swagger-ui-express@nestjs/swaggeronly (bundled in v11)postgres:13.5npx prisma dev; Docker bumped topostgres:17Verification
Built and ran the full tutorial end-to-end on NestJS 11.0, Prisma 7.8, @prisma/adapter-pg 7.8, @nestjs/swagger 11.4, Node 24. All CRUD endpoints (
GET /articles,/articles/drafts,/articles/:id,POST,PATCH,DELETE) and the Swagger UI / OpenAPI JSON were confirmed working.Note
One untested path:
prisma migrate devwas not run end-to-end locally — the localprisma devserver only exposestemplate1, which rejects the migration shadow-DB step (P1017). The schema/client path was verified withprisma db pushinstead.migrate devis the correct command for readers on Docker Postgres or cloud Prisma Postgres and is what the post documents; it just wasn't observed succeeding here. Worth a reviewer confirming against a standard Postgres.Preserved / notes for reviewers
lastUpdated/sitemap date for the freshness signal.imgs/assets; no new images needed.metaTitle/metaDescriptionupdated to mention Prisma 7.🤖 Generated with Claude Code
Summary by CodeRabbit