Cross-stack API contracts
The API (attunelogic-api) is the source of truth for routes and payloads. The service (Vite + RTK Query) and mobile (Expo + RTK Query) should only call documented paths under /api/v1.
Practicesβ
- Prefer RTK Query in clients; avoid ad-hoc
fetchexcept for rare public or third-party endpoints. - When adding an endpoint, update both:
- Route + controller in the API
- Client
injectEndpointsdefinition with the same path and method
- Run the non-DB Jest suite and service
test:ci(scheduler subset) in CI before deploy. - For large changes, add a focused integration test or contract test in the API that matches the clientβs expected shape.
Drift detectionβ
Periodically grep for hardcoded paths in attunelogic-service/src/redux/services and attunelogic-mobile/store/api and compare to attunelogic-api/src/routes/api/v1. Remove or fix any path that no longer exists on the server.