What problem does it solve?
This Skill eliminates common frontend-backend communication errors by generating consistent API contracts, ensuring synchronized types, standardized validation, and uniform error handling across Next.js and NestJS applications.
Core Features & Use Cases
- Backend DTOs (NestJS): Defines Request and Response DTOs using
class-validator and @nestjs/swagger for robust validation and automatic API documentation.
- Frontend Types (Next.js): Guides on generating or manually synchronizing TypeScript types for frontend consumption, ensuring type safety.
- Standardized Error Handling: Implements a consistent error response format across the API, making it easier for the frontend to parse and display errors.
- Use Case: When creating a new API endpoint for club creation, define a
CreateClubDto in NestJS with validation rules. Then, create a corresponding TypeScript type on the frontend to ensure the data sent by the UI matches the backend's expectations, preventing runtime errors.
Quick Start
To define a new API contract, create a CreateXDto in your backend's presentation/dtos/ folder using class-validator and @ApiProperty decorators. Ensure the frontend uses a corresponding TypeScript type for the request body.