Context
API handlers currently use different methods, pagination shapes, success envelopes, validation approaches, and error payloads. Client services manually encode these contracts, making drift difficult to detect.
Scope
- Inventory all routes and define a versioned OpenAPI 3.1 specification.
- Standardize resource naming, methods, status codes, pagination metadata, filters, and error envelopes.
- Use shared Zod schemas as runtime validation and contract sources where practical.
- Generate a typed client consumed by frontend services instead of handwritten response casts.
- Add request/correlation IDs and stable machine-readable error codes.
- Provide a compatibility/deprecation plan for existing consumers.
Acceptance criteria
Relevant areas
src/app/api/**, module schemas/services, src/lib/axios.ts, response entity types.
Context
API handlers currently use different methods, pagination shapes, success envelopes, validation approaches, and error payloads. Client services manually encode these contracts, making drift difficult to detect.
Scope
Acceptance criteria
Relevant areas
src/app/api/**, module schemas/services,src/lib/axios.ts, response entity types.