Development Guide
Learn how to develop features and extend your Next.js Prisma kit application with server actions, forms, and database operations.
Build production-ready features in your Next.js Prisma kit by following consistent patterns for server actions, forms, and database operations - from schema definition through to the user interface.
The Next.js Prisma kit provides a layered architecture where each piece builds on the previous: Zod schemas define validation, Prisma handles database operations, server actions wrap business logic with authentication, and forms connect everything to the UI. Following these patterns ensures type safety flows through your entire stack and makes your codebase navigable as it grows.
The development guide covers the conventions and patterns used throughout the Next.js Prisma kit for building features. It establishes a predictable workflow: schema → database → server action → form → page.
For a more complete guide, please refer to the Course.
Documentation Structure
| Page | Purpose |
|---|---|
| Development Workflow | Daily development process and file organization |
| Adding Features | Complete step-by-step feature tutorial |
| Server Actions | Type-safe mutations with authentication |
| Action Middleware | Authentication and authorization configuration |
| Working with Forms | Client-side forms with validation |
| Database Operations | Query and mutation patterns with Prisma |
The Development Stack
Each layer in the stack has a specific responsibility:
┌─────────────────────────────────────┐│ Page (Server Component) │ Fetches data, renders UI├─────────────────────────────────────┤│ Form (Client Component) │ User input, validation├─────────────────────────────────────┤│ Server Action + Middleware │ Business logic, auth├─────────────────────────────────────┤│ Prisma ORM │ Database operations├─────────────────────────────────────┤│ Zod Schema │ Validation (shared)└─────────────────────────────────────┘Common Pitfalls
- Skipping validation: Always define Zod schemas first - they're used on both client and server.
- Forgetting organization scope: Every database query must filter by
organizationIdto maintain multi-tenancy. - Manual auth checks: Use
authenticatedActionClientinstead of rolling your own authentication. - Missing
'use server': Server action files must start with this directive or they won't work. - Catching redirect errors: Next.js redirects throw special errors that must propagate - don't swallow them.
- N+1 queries: Use Prisma's
includeto fetch related data in one query instead of looping.
Frequently Asked Questions
Where should I put my feature code?
Should I use API routes or server actions?
How do I handle errors in server actions?
Can I share code between features?
Next: Development Workflow →