Skip to main content

Shell API reference

Every endpoint (except /health and /metrics) requires a valid Firebase ID token in Authorization: Bearer <token>. Tokens are verified with the Firebase Admin SDK; a 60-second Redis cache avoids redundant verification on hot paths.

The OpenAPI document is emitted at /api-json and committed as apps/shell-backend/openapi.json; the frontend client is generated from it via @hey-api/openapi-ts.

MethodPathAuthDescription
GET/healthnoneLiveness/readiness ({ status, db, redis })
GET/metricsnonePrometheus metrics
GET/users/meuserCurrent profile + global roles
PUT/users/meuserUpsert profile on first login
GET/rolesadminList all distinct global roles
POST/roles/assignadminAssign a global role to a user
DELETE/roles/{firebaseUid}/{role}adminRevoke a global role
GET/permissions/{productId}userCurrent user's grants for a product
POST/permissions/{productId}adminGrant a product permission
DELETE/permissions/{productId}/{key}adminRevoke a product permission

Role-based access in detailโ€‹

  • Unauthenticated requests receive 401.
  • Authenticated requests missing the required role receive 403.
  • Role assignment/revocation use checkRevoked: true in token verification โ€” the only endpoints where the extra network call is warranted.

Exampleโ€‹

curl -H "Authorization: Bearer $ID_TOKEN" http://localhost:3000/users/me
# { "id": "...", "firebaseUid": "...", "email": "m.vance@chrono.internal",
# "displayName": "Marcus Vance", "photoUrl": null, "globalRoles": ["admin"] }