How jellydn/next-validations works
Main Components
a) Core Library Components:
• Validation Middleware Layer
• Schema Adapter System
• Multiple Validation Library Support Hub
• Request Mode Handler (query/body)
b) Integration Points:
• NextJS API Routes
• External Validation Libraries
• TypeSchema Universal Adapter
┌─────────────────────────────────────────────┐
• NextJS API Route │
• ┬─────────────────────────┘
• ↓
┌─────────────────────────────────────────────┐
• next-validations Middleware │
• ┤
• ┌─────────────┐ ┌──────────┐ ┌─────────┐ │
• Request │ │ Schema │ │ Error │ │
• Parser │ │ Resolver │ │ Handler │ │
• ┘ └──────────┘ └─────────┘ │
• ┬─────────────────────────┘
• ↓
┌─────────────────────────────────────────────┐
• TypeSchema Adapter │
• ┬─────────────────────────┘
• ↓
┌─────────────────────────────────────────────┐
• Validation Libraries │
• ┬──────┬─────┬──────────┬────────────┤
• Yup │ Joi │ Zod │ Valibot │ Fastest │
• ┴──────┴─────┴──────────┴────────────┘
Important Elements to Highlight
a) Request Flow:
• How requests flow from NextJS API routes through the validation middleware
• Validation modes (query/body) processing
• Error handling paths
b) Integration Points:
• Clear connection points with TypeSchema
• Demonstrate how different validation libraries connect
• Configuration entry points
Specific Implementation Details
• withValidation.ts implementation
• resolver.ts schema handling
• Multiple validation modes support