What problem does it solve?
Eliminates mismatches between frontend API usage and backend contracts by centralizing request and response parsing, aligning mocks, and removing ad-hoc httpClient calls to prevent runtime type errors and flaky local development.
Core Features & Use Cases
- Zod schema creation: Define request and response contracts in src/data-access/<feature>/<feature>.schema.ts to validate payloads and responses.
- Typed API functions: Implement exported API functions in src/data-access/<feature>/<feature>.api.ts that call the http client and parse responses before returning.
- Mock synchronization: Update mocks/api.mockoon.json to reflect endpoint paths and response shapes so local dev mirrors contract expectations.
- Refactor callers: Replace direct httpClient usage in feature code with imports from the feature-specific data-access module to keep feature logic focused on orchestration.
- Use case: Adding a new POST /api/team-members endpoint with typed parsing and aligned mocks for local testing.
Quick Start
Create feature-scoped Zod schemas and an exported API function, update mocks/api.mockoon.json to match the contract, and replace feature httpClient calls with imports from the new data-access module so pnpm type-check passes.