Skip to main content

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​

  1. Prefer RTK Query in clients; avoid ad-hoc fetch except for rare public or third-party endpoints.
  2. When adding an endpoint, update both:
    • Route + controller in the API
    • Client injectEndpoints definition with the same path and method
  3. Run the non-DB Jest suite and service test:ci (scheduler subset) in CI before deploy.
  4. 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.