What problem does it solve?
This Skill streamlines the communication between Next.js frontend and NestJS backend by generating Server Actions, eliminating the need for explicit API routes for mutations and ensuring consistent data validation and cache management.
Core Features & Use Cases
- Thin Orchestration Layer: Creates Server Actions (
'use server') that act as a minimal bridge, delegating business logic to the NestJS backend.
- Integrated Cache Management: Utilizes
revalidatePath and revalidateTag to automatically update Next.js's data cache after mutations, ensuring UI consistency.
- Standardized Error Handling: Implements robust error handling for Zod validation, API responses, and network issues, providing user-friendly feedback.
- Use Case: When a user submits a form to create a new club, use a Server Action to validate the input, call the backend API, and automatically revalidate the cache for the clubs list page, updating the UI without a full page refresh.
Quick Start
To create a new Server Action, define a Zod schema for input validation, implement the action function with 'use server', call your backend API, and use revalidatePath() to update the cache.