Module Map
Domains
Auth
Partner API keyPartners call
POST /auth/token with a phone number. Aarokya creates the user on first call and issues a JWT. No OTP, no passwords.Tables: users (find-or-create)Platform
Admin-onlyCreate and manage tenants (e.g. Namma Yatri). Every user belongs to one platform. Platform ID is required for token issuance.Tables:
platformsUser
JWT + AdminFull user lifecycle — profile, onboarding, soft-delete. Self-access enforced: JWT users can only read/write their own record.Tables:
usersDependant
JWT self + AdminFamily members linked to a user. Immutable append-only rows — every update creates a new version. SELF dependant is system-managed.Tables:
dependantsBenefit Provider
Admin-onlyCompanies that offer benefits. Top-level catalogue grouping. A provider must exist before any benefit can reference it.Tables:
benefit_providersBenefit
Admin write · JWT + Admin readIndividual offerings (consultation, insurance) linked to a provider. Admins manage the catalogue; active JWT users browse benefits.Tables:
benefitsAccount
JWT self + Partner keyStores a user’s external account references (e.g. bank account number).Tables:
accountsMRN
JWT + Partner · Admin deleteLinks a dependant to a benefit provider with an external Medical Record Number. Unique per
(dependant, provider) pair.Tables: mrnsAuthentication Model
| Header | Scheme | Used by |
|---|---|---|
admin-api-key | Static secret | Internal ops — CRUD for platforms, providers, benefits |
api-key | Static secret (per partner) | External partners — token issuance, account/MRN ops |
Authorization: Bearer <jwt> | JWT (HS256) | Logged-in users — profile, dependants, accounts, MRNs |
POST /auth/token again.
User Lifecycle
| Status | Meaning | Allowed operations |
|---|---|---|
onboarding | Created, profile incomplete | PATCH /users/{id}, complete_onboarding |
active | Fully onboarded | All endpoints |
deactivated | Soft-deleted | None |
Shared Infrastructure
server_wrap
Single entry point for auth validation and error handling. Every handler calls
server_wrap(auth_guard, ...) — no handler can skip auth accidentally.Error Envelope
All errors return
{"error": {"code": "...", "message": "..."}}. Switch on code (e.g. MR-903), not message.OpenAPI / Swagger
Swagger UI at
/api_docs/ui. OpenAPI JSON at /api_docs/openapi.json. Generated from code via utoipa.