What problem does it solve?
Backend development in Next.js often involves complex patterns for data fetching, mutations, and validation. This skill streamlines the creation of new backend features, ensuring type safety, performance, and adherence to the project's feature-based architecture and best practices.
Core Features & Use Cases
- Standardized Server Actions: Guides the implementation of mutations (create, update, delete) with Zod validation and path revalidation.
- Cached Query Functions: Ensures efficient data fetching using React's
cache() and optimized Prisma includes to prevent N+1 issues.
- Type-Safe Schemas: Provides patterns for Zod schemas with detailed error messages and type inference for robust data integrity.
- Use Case: A developer needs to add a new "Article" feature. Use this skill to guide them through creating the
articles feature directory, implementing createArticle server action, getArticles query, and articleSchema, ensuring all follow the established patterns.
Quick Start
To implement a new backend feature, specify the entity and operation.
Example:
"Create a new backend feature module for 'Products'."
"Implement a server action to 'createVideo' with Zod validation."
"Write a cached query function to 'getArticles' with pagination and filtering."