Full-Stack Next.js 16 & Prisma Auth Engine
A 5-step development playbook taking you from system architecture and Prisma schema to secure JWT handlers, reactive server components, and automated tests.
Execute each prompt in order. Carry forward context as specified in step instructions.
Run this prompt first to get clear interface definitions. Save the generated TypeScript DTOs before running Step 2.
Pass the TypeScript interfaces from Step 1 into this prompt to ensure database fields map 1:1 with API contracts.
Supply the Prisma schema from Step 2. Instruct the model to strictly handle token expiration, edge runtime constraints, and sanitized JSON errors.
Reference the API responses from Step 3 so client payload parsing aligns perfectly with backend exceptions.
Feed the route handler code from Step 3 into this prompt to test edge cases: duplicate emails, malformed JWTs, and session expiration.
Workflow Execution Guide & Instructions
How to run this prompt chain sequentially for optimal consistency and accuracy.
End-to-end multi-turn engineering playbook for implementing production-ready authentication in Next.js 16 with Prisma ORM and TypeScript.
Sequential Chain-of-Thought Handoff: The output of each step serves as architectural constraints for the subsequent step, ensuring zero drift.
Prerequisites & Requirements
- •Node.js 20+ and Next.js 16 project
- •PostgreSQL database connection
- •jose and bcryptjs dependencies installed
Step-by-Step Execution Plan
Generate the API contracts and DTO types.
Create schema.prisma matching the DTO definitions.
Implement JWT signing and cookie session handling.
Connect frontend forms to the authentication API.
Run automated tests against mock database fixtures.
Best Practices & Gotchas
Workflow Variable Synchronizer
Parameters entered here synchronize across all 5 steps simultaneously to maintain consistency across the entire workflow.