Development Workflow
Establish an efficient development workflow for building features in your Next.js Prisma kit application.
Reduce friction and ship faster by following consistent file organization, development commands, and quality checks - the workflow used throughout the Next.js Prisma kit.
A predictable development workflow eliminates decision fatigue and helps you focus on building features rather than wondering where to put files or which commands to run. The Next.js Prisma kit follows conventions that scale: feature directories with predictable structures, git branches per feature, and quality checks before every commit.
The development workflow is the set of commands, file conventions, and practices you follow when building features. It establishes consistency across your team and makes the codebase navigable as it grows.
Start Development Server
If you have not yet setup your development environment, please refer to the Installation guide for more information.
To run the development server, run the following command:
# Start all apps and packagespnpm dev# Development server runs at:# - Web app: http://localhost:3000In addition to the Next.js development server, make sure to also start the Database service. We've discussed this in the Installation - so please refer to that section for more information.
File Organization
Consistent file organization makes your codebase navigable. Each feature lives in its own directory with a predictable structure:
apps/web/app/[locale]/(internal)/dashboard/├── feature/│ ├── page.tsx # Route page│ ├── _lib/│ │ ├── actions/│ │ │ └── feature-server-actions.ts # Server actions│ │ ├── schemas/│ │ │ └── feature.schema.ts # Validation schemas│ │ └── loaders/│ │ └── feature-page.loader.ts # RSC Data loading│ └── _components/│ ├── feature-form.tsx│ └── feature-list.tsxNaming Conventions:
- Pages:
page.tsx(Next.js convention) - Loaders:
{feature}-page.loader.tsfor server-side data fetching - Actions:
{feature}-server-actions.tsfor server actions (or{feature}.action.tsif you prefer) - Schemas:
{feature}.schema.tsfor Zod validation schemas - Components:
kebab-case.tsxfor all component files
While you can use any other convention that you prefer, we recommend following the ones mentioned above.
Using Packages for Features
When building features, you can use packages to share code between features. For example, if you are building a feature that is related to projects, you can create a package called projects and put the code for the projects feature in it.
packages/features/projects/├── index.ts├── schema.tsYou can use the command pnpm turbo gen package to generate a new package.
Note: this is not a requirement, only create packages if you're comfortable with the concept and want to use it. Placing all your features in the apps/web/app/[locale]/(internal) folder is perfectly fine and will still be organized.
Development Flow
A typical feature follows a predictable path from branch to deployment. This section outlines each step.
1. Create Feature Branch
Creating a git branch before working on a new feature or code change is a good practice. This helps you to isolate your changes from the main branch and allows you to easily revert your changes if needed, all while being able to review your changes before merging them into the main branch.
git checkout -b feature/new-feature2. Plan Your Feature
Before writing code, break the feature into concrete steps. This prevents scope creep and ensures you don't miss critical pieces:
- Define the data model and validation schema
- Create database tables and relationships
- Build server actions for mutations
- Create UI components
- Connect everything in page components
If you're using AI to help you with the feature, consider using the PRD tool in our MCP server to help you plan your feature. You can find the instructions here.
I do recommending going through the following steps to better understand the feature and the codebase, even if you use AI to help you.
3. Implement Feature
Work through the layers in order. Each layer builds on the previous one, so starting with the schema ensures type safety flows through the entire stack:
- Schema - Define types and validation with Zod
- Database - Create tables and push changes
- Server Actions - Implement business logic
- Components - Build the UI
- Page - Wire everything together
4. Verify Quality
Before committing, run these checks to catch issues early. Type errors and lint issues are easier to fix while the code is fresh in your mind:
# Check typespnpm typecheck# Fix linting issuespnpm lint:fix# Format codepnpm format:fix5. Commit Changes
When you have completed working on your new feature, you can commit and push the branch to your Git repository.
git add .git commit -m "feat: add new feature"git push origin feature/new-featureFrom Github (or other Git hosting provider), you can create a pull request to review your changes. Some AI services can help you debug and review your PR before merging it into the main branch. It's a decent additional "pair of eyes" to help you catch issues before they reach production.
Common Pitfalls
- Skipping
pnpm typecheck: Type errors caught early are easier to fix. Run before every commit. - Committing without running
lint:fix: Inconsistent formatting creates noisy diffs and merge conflicts. - Forgetting to start the database: The dev server runs, but database operations fail silently. Start Postgres before
pnpm dev. - Wrong directory structure: Placing components outside
_components/or logic outside_lib/makes code harder to find. - Large commits: Break features into logical commits. Easier to review, easier to revert.
- Mixing concerns: Keep loaders, actions, and schemas in separate files. One responsibility per file.
Frequently Asked Questions
What's the difference between _lib/ and _components/?
Should I create a package for every feature?
Why use feature branches?
How often should I run the quality checks?
Related
- Development Guide Overview - Full development patterns guide
- Adding Features - Step-by-step feature tutorial
- Installation Guide - Environment setup
Next: Adding Features →