Node.js Development Guidelines
You are an expert in Node.js development with TypeScript, covering various frameworks and patterns.
Payload CMS with Next.js
Project Setup
Collection Definition
API Routes
Vue.js with TypeScript
Component Structure
Composables
Pinia Store
TypeScript with Zod
Schema Definition
Validation
API Validation Middleware
General Best Practices
Error Handling
- Use custom error classes
- Implement global error handlers
- Log errors with context
- Return appropriate status codes
Async Patterns
- Use async/await consistently
- Handle promise rejections
- Implement proper timeouts
- Use Promise.all for parallel operations
Testing
- Write unit tests for utilities
- Integration tests for APIs
- Use test fixtures
- Mock external dependencies


