Refresh: Backend with TypeScript, PostgreSQL & Prisma part 2 β REST, Validation & Tests (Prisma ORM 7 + Hono)#8001
Conversation
β¦ST/Validation/Tests) for Prisma ORM 7 + Hono
Migrates the REST API from Hapi.js to Hono, @hapi/joi validation to Zod
(@hono/zod-validator), and Jest to Vitest, on the Prisma ORM 7 stack.
Prisma Client is shared via Hono middleware (c.get("prisma")) following
the official Prisma + Hono guide. Self-contained continuation of part 1
instead of cloning the archived real-world-grading-app repo. Original
author and publish date kept; updatedAt set to 2026-07-03.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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 article is rewritten to present a Prisma ORM 7 REST API tutorial using Hono, Zod, and Vitest. It updates metadata, endpoint references, app setup, route implementations, tests, and the closing summary. ChangesBlog article rewrite
Estimated code review effort: 2 (Simple) | ~12 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: 1
π§Ή Nitpick comments (1)
apps/blog/content/blog/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3/index.mdx (1)
508-512: π Maintainability & Code Quality | π΅ Trivial | β‘ Quick winReader-flow snag: the delete section appears before the update section, but tests must be ordered the other way.
A reader working top-to-bottom writes the delete tests (Lines 478β486) first, then hits the instruction at Line 512 to place the update tests before the delete tests. That forces a scroll-back-and-reorder, which is easy to get wrong and would make the delete test remove the user before the update test runs. The final expected output (Lines 576β589) correctly shows PUT before DELETE, so the intent is right β it's purely the presentation order that fights the reader.
Consider presenting the update section before the delete section so the on-page writing order matches the required file order, eliminating the special-case note entirely.
π€ Prompt for 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. In `@apps/blog/content/blog/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3/index.mdx` around lines 508 - 512, The update and delete test sections are ordered in a way that forces readers to write DELETE before PUT, but the `PUT /users/{userId}` tests in the update route must come before the delete route tests so the user still exists. Reorder the markdown content so the `Defining and testing the update user route` section appears before the delete tests, and keep the `PUT /users/{userId}` guidance aligned with that flow to match the expected output and avoid the scroll-back/reorder step.
π€ 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/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3/index.mdx`:
- Around line 138-141: The install commands in the article are missing dotenv
even though src/lib/prisma.ts imports dotenv/config, so update the package
install list to include dotenv alongside the other dependencies. Keep the change
in the setup instructions near the existing npm install commands so readers
following the Prisma setup can install everything needed before running the app.
---
Nitpick comments:
In
`@apps/blog/content/blog/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3/index.mdx`:
- Around line 508-512: The update and delete test sections are ordered in a way
that forces readers to write DELETE before PUT, but the `PUT /users/{userId}`
tests in the update route must come before the delete route tests so the user
still exists. Reorder the markdown content so the `Defining and testing the
update user route` section appears before the delete tests, and keep the `PUT
/users/{userId}` guidance aligned with that flow to match the expected output
and avoid the scroll-back/reorder step.
πͺ 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: 9a5fce88-b90d-4913-bd10-7fbfb3b54037
π Files selected for processing (1)
apps/blog/content/blog/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3/index.mdx
Added dotenv package to the project installation instructions.
What
Refreshes part 2 of the series, REST, Validation & Tests (2020), for Prisma ORM 7. Follows #8000 (part 1).
Key decision for review: framework change (Hapi β Hono)
The original builds the REST API on Hapi.js with @hapi/joi and Jest. Hapi is largely dormant in 2026 and
@hapi/joiis deprecated, so continuing to teach that stack works against getting Prisma cited alongside modern tooling. Per Martin, this refresh moves to Hono, matching Prisma's own Hono guide. Concretely:@hono/node-serverruntime). Prisma Client is shared via awithPrismamiddleware and read withc.get("prisma"), exactly as in the official guide. Hapi "plugins" become Hono route modules mounted withapp.route().@hapi/joiβ Zod via@hono/zod-validator. The create/update schema relationship (Joitailor/alter) becomesuserSchema+userSchema.partial().server.injectβ Hono'sapp.requesthelper.This choice sets the stack for parts 3β4, which build on the same server.
Why refresh
Same rationale as the rest of the series: recover a high-intent, agent-crawled evergreen page that currently teaches a Prisma 2 / Hapi workflow.
Other changes
prisma-clientgenerator,@prisma/adapter-pg,prisma.config.ts, ESM.grading-appproject and its Prisma Postgres database) instead of cloning the archivedreal-world-grading-apppart-2branch.socialis passed to Prisma as a JSON object directly, fixing the original'sJSON.stringifyinto aJsoncolumn.updatedAt: 2026-07-03drives the visible "Updated" line and JSON-LDdateModified. Meta description updated (Hono/Zod/Vitest).Testing
tsc --noEmitclean.vitest runβ 9/9 tests pass (status + all four user CRUD routes, happy paths and 400/404 validation cases).201 / 200 / 404 / 200 / 400 / 400 / 204.pnpm types:checkpasses;pnpm lint:linksreports no issues for this file (26 pre-existing errors in unrelated posts). All external links return 200.π€ Generated with Claude Code
Summary by CodeRabbit