CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

Upgrade to Prisma v7 with PrismaPg adapter and Next.js 15 compatibility #3909

Merged⚡ AI-generatedXSccantynz wants to mergeclaude/setup-build-environment-WyVzdmainopened Apr 12, 2026
ccantynzcommented Apr 12, 2026

Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/MarcoReid.com/pull/34


Summary

This PR upgrades the project to Prisma v7 with the new PrismaPg adapter for better PostgreSQL support, implements lazy-loading patterns for database and Stripe clients, and updates route handlers to be compatible with Next.js 15's async params.

Key Changes

  • Prisma v7 Migration: Updated @prisma/client from v5.22.0 to v7.7.0 and added @prisma/adapter-pg dependency for native PostgreSQL support
  • Lazy-loaded Clients: Implemented Proxy-based lazy initialization for both Prisma and Stripe clients to defer instantiation until first use
  • Next.js 15 Compatibility: Updated all dynamic route handlers to accept params as Promise<{ id: string }> and await the params before use across:
    • app/api/clients/[id]/route.ts
    • app/api/matters/[id]/route.ts
    • app/api/documents/[id]/route.ts
    • app/api/trust-accounts/[id]/transactions/route.ts
    • app/api/marketplace/payments/[id]/{capture,refund}/route.ts
  • Stripe API Update: Updated Stripe API version from 2024-11-20.acacia to 2025-02-24.acacia
  • Prisma Configuration: Added prisma.config.ts for Prisma v7 configuration with database URL setup
  • Headers API Update: Updated headers() call in Stripe webhook handler to use async/await pattern for Next.js 15
  • Dashboard Refactor: Converted hardcoded card array to use external cards variable (partial refactor)
  • TypeScript Config: Excluded prisma.config.ts from TypeScript compilation

Implementation Details

  • Prisma and Stripe clients now use Proxy objects with lazy initialization to improve startup performance and handle environment variable loading at runtime
  • The PrismaPg adapter is explicitly instantiated with the DATABASE_URL environment variable
  • All route parameter destructuring now properly awaits the Promise before accessing the id property
  • Stripe client uses non-null assertion (!) for the secret key, assuming it's always provided in production

https://claude.ai/code/session_013PkMDsnQTZs98rFcV3hYUg

ccantynzcommented Apr 12, 2026

Originally written by @vercel[bot] on GitHub.


The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marco-reid-com Ready Ready Preview, Comment Apr 12, 2026 6:45pm

Request Review

Cross-repo impact

See what breaks downstream if this PR merges.

Analyze →
⮌ Merged

This pull request was merged into main.

c comment · e edit title · m merge · a approve · r request changes · ? shortcuts