Private pre-release
This project is under active development and will be made public soon. Release timing may change, and repository links will not work until then.
caveo
Multi-tenant auth-as-a-service on Cloudflare Workers: PASETO sessions, TOTP, passkeys, password reset, webhooks, and per-tenant Durable Object SQLite.
Show 6 more
Caveo is a multi-tenant authentication-as-a-service API built on Cloudflare Workers. A stateless edge Worker serves the OpenAPI surface and routes every request by Host header to a per-tenant Durable Object that owns the tenant’s embedded SQLite database. Passwords are hashed by a separate Argon2 Worker over a service binding, and the host-to-tenant registry lives in KV.
Status: active development. The
@caveo/apiWorker, its test suite, CI, a one-command local bootstrap, the control-plane tenant API, YAML-deployed permissions, the@caveo/sdkclient, and the@caveo/webbrowser app are in place. Tenants can be created, configured, suspended, and given custom domains entirely over HTTP; a login UI fetches the safe public config and applies per-tenant branding; an application can declare permissions in YAML, deploy them with the CLI, and enforce them in routes; and the SDK verifies tokens and revocation offline with Hono, Express, and Next middleware. The web app covers login, registration, password reset, email verification, TOTP, passkeys, session management, and a protected SDK demo, with Playwright E2E against two tenants. There is no hosted admin UI yet.
Features
- Tenant isolation by hostname — each tenant has its own Durable Object, SQLite database, signing key, and token namespace.
- HTTP tenant control plane — create/update/suspend/resume/delete tenants, manage host aliases, verify custom domains by DNS TXT/CNAME, mint/revoke tenant admin tokens, purge caches, and read stats and audit events.
- Tenant configuration — branding/theme, redirect URLs, allowed origins, password policy, session/MFA policy, and per-tenant user/session/event/WebSocket quotas.
- Permissions — a YAML map in the application repository, validated locally and deployed through the control API, with deterministic stable bit positions, deprecation instead of deletion, immutable map versions, roles and direct grants,
prm/pmv/audtoken claims, and live API enforcement viarequirePermission. Thecaveo permissionsCLI providesvalidate,diff,apply,rollback, andget. - SDK —
@caveo/sdkverifies PASETO tokens offline, checks revocation from a conditional-GET snapshot or a WebSocket subscription, checksprm/pmvagainst the public permission map, and ships Hono, Express, and Next middleware. Seedocs/sdk.md. - Public config — a cache-tagged, secret-free
/api/v1/configprojection that a login UI can fetch using only the request host. - Browser app —
@caveo/webis a Vite + React + Tailwind app with tenant branding, login/register/reset/email-verification pages, TOTP and passkey flows, session management, accessible loading/error/empty states, and English/Spanish i18n. A protected demo verifies the session with@caveo/sdk. Seedocs/web.md. - Sessions — PASETO
v4.publictokens signed with a per-tenant Ed25519 key inside the Durable Object, delivered asHttpOnly,Secure,SameSite=Laxcookies with sliding refresh and explicit logout. - Two-factor authentication — TOTP (RFC 6238) enrollment and verification, plus WebAuthn passkeys via
@simplewebauthn/server. - Password reset — non-enumerating reset requests that emit a signed, single-use, 30-minute token to the tenant webhook.
- Token revocation — day-bucketed revocation bitmasks with a 32-day retention window.
- Webhooks — buffered, ordered per-tenant event delivery with HMAC-SHA256 signatures, exponential-backoff retries, and dead letters.
- Edge caching — cached public-key and revocation snapshots with cache-tag purging and WebSocket push for SDK clients.
- OpenAPI — request validation and interactive API docs at
/via Hono and chanfana. - SQLite + Drizzle — typed schema and migrations applied when a tenant Durable Object activates.
Client ──Host──▶ Worker (Hono + chanfana)
│ tenant resolution (Host → tenant)
├──▶ KV TENANT_REGISTRY host:<host> → TenantRecord
├──▶ Service ARGON2 POST /hash, POST /verify
├──▶ Cache API tenant-keyed key/revocation entries
└──▶ TenantStore DO one per tenant, embedded SQLite
├─ Drizzle SQLite users, sessions, MFA, webhooks, …
├─ PASETO signing per-tenant Ed25519 key
├─ revocation jti allocation + bitmask buckets
└─ alarms webhook flush + retries
The Worker is the stateless HTTP layer: it resolves the tenant, validates input, manages cookies, serves docs, and emits events. The TenantStore Durable Object is the stateful core: it owns the tenant database, signs tokens (the secret key never leaves the DO), allocates revocation bits, buffers webhook events, and hosts SDK WebSocket subscriptions.
See docs/architecture.md for the full diagram and request flows, and HANDOFF.md for implementation notes and open work.
.
├── apps/cli/
│ ├── src/ # `caveo permissions` commands
│ └── scripts/ # esbuild bundle for the published bin
├── apps/web/
│ ├── src/ # React pages, contexts, API client, redirect rules
│ ├── demo/ # same-origin proxy and SDK demo middleware
│ ├── e2e/ # Playwright journeys, branding, axe checks
│ └── scripts/ # two-tenant seed, stack, demo capture
├── apps/sdk/
│ ├── src/core/ # offline PASETO verification, revocation, permissions
│ ├── src/serverless/ # conditional-GET snapshot cache
│ ├── src/server/ # WebSocket subscription and resync
│ ├── src/middleware/ # Hono, Express, and Next adapters
│ └── examples/ # copy-pasteable adapters
├── apps/api/
│ ├── src/
│ │ ├── index.ts # Hono app, routes, Durable Object export
│ │ ├── auth/ # tokens, sessions, TOTP, passkeys, passwords
│ │ ├── cdn/ # public-key and revocation caching
│ │ ├── db/ # Drizzle schema
│ │ ├── durable/ # TenantStore Durable Object
│ │ ├── endpoints/ # OpenAPI route handlers
│ │ ├── events/ # webhook delivery and signing
│ │ ├── middleware/ # Host → tenant resolution
│ │ └── tenant/ # registry, provisioning, host normalization
│ ├── test/ # Vitest specs running inside workerd
│ ├── scripts/ # local tenant seed and end-to-end walkthrough
│ ├── drizzle/ # generated SQL migrations
│ └── wrangler.jsonc # bindings, Durable Object exports, cache
├── .github/ # CI workflow and Dependabot configuration
├── packages/permissions/ # YAML schema, validator, allocator, bitmask helpers
├── docs/ # architecture notes, permission guide, Excalidraw diagram
│ └── adr/ # architecture decision records
├── HANDOFF.md # working context and open items
├── ROADMAP.md # goals, tasks, and linked GitHub issues
└── pnpm-workspace.yaml
Getting started
Prerequisites
- Node.js 24 or newer
- pnpm 12.6 (
corepack enable) - A Cloudflare account with Wrangler logged in for deployment
- The
argon2-cloudflareWorker available for password hashing
pnpm install
Quick start
For local development, one command starts a dev-only Argon2 stand-in on 8788, seeds the acme tenant, and runs the API on 8787:
pnpm bootstrap
It prints the docs URL and a tenant-scoped curl command. The bundled Argon2 Worker implements the same POST /hash and POST /verify contract as the real one but does not hash with Argon2; use the manual steps below when you need real password hashing.
Override the defaults with environment variables:
TENANT=acme TENANT_HOST=acme.test API_PORT=8787 ARGON2_PORT=8788 pnpm bootstrap
Set CAVEO_ENV=dev (or staging/prod) to start the named Wrangler environment instead of the top-level local Worker. The mock Argon2 Worker and the tenant seed follow the same environment.
Configure bindings
Cloudflare bindings live in apps/api/wrangler.jsonc:
TENANT_REGISTRY— KV namespace holding the host-to-tenant registry.TENANT_STORE— Durable Object namespace for the per-tenant store.ARGON2— service binding to a Worker exposingPOST /hashandPOST /verify.
The top-level bindings are local-development placeholders: wrangler dev uses local KV storage and ignores the id. wrangler.jsonc also defines dev, staging, and prod environments. Each environment deploys a separately named Worker (and therefore a separate TenantStore Durable Object namespace), has its own REPLACE_WITH_*_KV_ID placeholder, and expects a matching Argon2 service. The placeholders are deliberately invalid, so a raw wrangler deploy fails before touching the wrong namespace. Once real KV ids are configured, direct wrangler deploy is not a supported path: it bypasses the repository’s ref, CI-provenance, preflight, and backup gates. Create the real KV namespace and replace the placeholder id before deploying:
pnpm --filter @caveo/api exec wrangler kv namespace create TENANT_REGISTRY --env dev
pnpm --filter @caveo/api cf-typegen
Deploy that environment with pnpm deploy:dev. The deploy script refuses to run, including for a dry run, unless the target environment has a real KV id and the expected Worker name, TENANT_STORE binding, and environment-specific Argon2 service.
Run locally manually
pnpm bootstrap covers the common case. To run the pieces separately:
- Start the Argon2 Worker locally on port
8788.
# From your checkout of glotlabs/argon2-cloudflare
rustup target add wasm32-unknown-unknown
wrangler dev --port 8788
- Seed a tenant into the local KV registry. Tenants can also be created with
POST /api/v1/control/tenantsusing the control bearer token; the dev seed script is a shortcut that writes thehost:<host>andtenant:<id>records directly.
pnpm --filter @caveo/api seed:dev acme acme.test
- Start the API dev server.
pnpm dev
The OpenAPI docs are served at http://localhost:8787/. Tenant-scoped requests need a matching Host header:
curl -i -H 'Host: acme.test' http://localhost:8787/api/v1/cdn/public-key
To exercise the whole flow (register, login, TOTP enrollment, MFA, refresh, password reset, logout, revocation snapshot), run the end-to-end script. It starts the Argon2 mock and a dev server if they are not already listening.
pnpm --filter @caveo/api e2e
Browser app and two-tenant demo
The web app and its Playwright suite start the whole stack themselves: Argon2 mock, API, two seeded tenants, and Vite. Open either branded tenant after pnpm --filter @caveo/web dev:
http://acme.localhost:5173/login light / teal / Acme Auth
http://globex.localhost:5173/login dark / violet / Globex Identity
pnpm e2e:web runs the browser journeys with a real Chromium and a virtual authenticator. pnpm demo serves the production bundle on :4173, and pnpm demo:capture regenerates the screenshots and recording in apps/web/demo-artifacts/. The stack, redirect-safety rules, SDK demo, and E2E design are documented in docs/web.md.
Commands
| Command | Purpose |
|---|---|
pnpm bootstrap | Start the Argon2 mock, seed the tenant, and run the API |
pnpm dev | Start the API dev server |
pnpm dev:web | Start the branded web app on :5173 |
pnpm seed:demo | Seed the acme and globex demo tenants |
pnpm demo | Build and serve the production-bundle demo on :4173 |
pnpm demo:capture | Regenerate demo screenshots and the recording |
pnpm e2e:web | Run the Playwright two-tenant browser suite |
pnpm deploy | Deploy to CAVEO_ENV (required) |
pnpm deploy:dev | Deploy the dev environment |
pnpm deploy:staging | Deploy the staging environment |
pnpm deploy:prod | Deploy the prod environment |
pnpm deploy:dry-run | Build the target environment without deploying |
pnpm check:env | Validate the target environment’s bindings |
pnpm lint | Run Biome checks |
pnpm lint:fix | Apply Biome formatting and safe fixes |
pnpm lint:workflows | Lint GitHub workflows; requires actionlint and shellcheck installed |
pnpm audit | Audit dependencies at high severity and above |
pnpm typecheck | Typecheck all workspace packages |
pnpm test | Run the test suite |
pnpm test:coverage | Run tests with coverage |
pnpm check | Typecheck plus coverage |
pnpm --filter @caveo/api db:generate | Generate a Drizzle migration |
pnpm --filter @caveo/api cf-typegen | Regenerate Worker binding types |
pnpm --filter @caveo/api e2e | Run the local end-to-end walkthrough |
pnpm --filter @caveo/web test | Run the web unit tests |
pnpm --filter @caveo/web test:e2e | Run the two-tenant Playwright suite |
Testing
Tests run inside workerd through @cloudflare/vitest-plugin, with the Argon2 binding mocked. Coverage gates are enforced per package: @caveo/api at 100% for statements, branches, functions, and lines; @caveo/sdk, @caveo/cli, and @caveo/permissions at their configured gates.
pnpm check
CI runs actionlint, shellcheck, a tracked-tree and full-history secret scan (including 32-hex KV ids), lint, typecheck, generated-type and migration drift checks, the test suite, coverage, the dependency audit, placeholder-rejecting checks for every environment, a rejected dev dry run, and e2e/bootstrap smoke tests with asserted statuses on every push to main and every pull request.
wrangler login
pnpm deploy:dev
Deploy the Argon2 Worker first and make sure the ARGON2 service binding name matches it. The first deploy provisions the TenantStore Durable Object namespace. Drizzle migrations run inside the Durable Object on activation.
Choose the target explicitly with pnpm deploy:dev, pnpm deploy:staging, or pnpm deploy:prod (or CAVEO_ENV=dev pnpm deploy). Run pnpm check:env to validate the target’s bindings, and pnpm deploy:dry-run to build without deploying. Each environment uses a distinct Worker name, so its Durable Object namespace and KV registry are separate.
The deploy workflow is the supported path: it only runs from main or a semver-shaped release tag (refs/tags/v*), requires a green push-to-main CI run for the exact SHA, runs the full preflight (including the secret scan and e2e/bootstrap smoke tests), takes a mandatory pre-deploy backup, and records the previous deployment. The workflow asserts the tag’s semver syntax; the deploy wrapper verifies the ref against origin, requires the release tag to be annotated, and checks that the peeled tag points at HEAD. A local pnpm deploy:* requires a clean worktree, main equal to origin/main (or an annotated semver release tag present on the remote at HEAD), a green push CI run for the exact SHA, and then runs the core preflight plus an encrypted backup. The backup refuses an empty or partial tenant inventory, and the wrapper refuses to continue unless the backup directory contains at least one .enc artifact. It therefore needs an authenticated gh plus CAVEO_BASE_URL, CAVEO_ADMIN_TOKEN, and CAVEO_BACKUP_KEY; it does not replace the workflow’s extra smoke steps. pnpm deploy:dry-run only validates the target and skips the deployment gates. Keep the Cloudflare API token in the protected GitHub environment rather than a local shell, because direct wrangler deploy cannot be intercepted by this repository. Rollback reverts Worker code only; Durable Object SQLite migrations are forward-only.
API surface
All tenant-scoped routes live under /api/v1 and resolve the tenant from the request Host.
| Method | Path | Auth | Purpose |
|---|---|---|---|
GET | /health | none | Cheap liveness check |
GET | /health/ready | none | KV + control DO + Argon2 readiness (200/503) |
POST | /api/v1/auth/register | none | Register a user for the tenant |
POST | /api/v1/auth/login | none | Authenticate and set the session cookie |
POST | /api/v1/auth/refresh | session cookie | Slide the session window, re-signing when needed |
POST | /api/v1/auth/logout | session cookie | Revoke the session and clear the cookie |
GET | /api/v1/auth/user | session cookie | Return the signed-in user |
GET | /api/v1/auth/sessions | session cookie | List devices with metadata |
DELETE | /api/v1/auth/sessions/:id | session cookie | Revoke one session |
POST | /api/v1/auth/sessions/revoke-others | session cookie | Revoke every other session |
POST | /api/v1/auth/logout-all | session cookie | Revoke every session |
POST | /api/v1/auth/password/change | session cookie | Change the password and revoke other sessions |
POST | /api/v1/auth/reauth | session cookie | Mint a five-minute re-auth token |
POST | /api/v1/auth/password/request | none | Request a password reset (no enumeration) |
POST | /api/v1/auth/password/reset | reset token in body or x-reset-token | Set a new password and revoke all sessions |
POST | /api/v1/auth/email/verify/request | none | Request an email verification token |
POST | /api/v1/auth/email/verify | verification token | Verify an email address |
POST | /api/v1/auth/identifier/change | session + re-auth | Request a verified identifier change |
POST | /api/v1/auth/identifier/verify | session + re-auth + verification token | Complete an identifier change |
DELETE | /api/v1/auth/account | session + re-auth | Delete the account and all credentials |
GET | /api/v1/auth/permissions | session cookie | Self-service effective permissions |
GET | /api/v1/auth/permissions/protected | session + permissions.read | Reference guarded permission route |
GET | /api/v1/auth/mfa/factors | session cookie | List enrolled factors |
GET | /api/v1/auth/mfa/passkeys | session cookie | List passkey credential ids |
DELETE | /api/v1/auth/mfa/totp | session + re-auth | Disable TOTP |
DELETE | /api/v1/auth/mfa/passkeys/:id | session + re-auth | Delete a passkey |
POST | /api/v1/auth/mfa/recovery-codes | session + re-auth | Replace recovery codes |
GET | /api/v1/auth/mfa/recovery-codes | session cookie | Count remaining recovery codes |
POST | /api/v1/auth/mfa/verify | MFA cookie | Verify TOTP, passkey, or a recovery code |
POST | /api/v1/auth/mfa/totp/enroll | session + re-auth | Begin TOTP enrollment |
POST | /api/v1/auth/mfa/totp/enroll/verify | session + re-auth | Confirm TOTP enrollment |
POST | /api/v1/auth/mfa/passkey/register/options | session + re-auth | Begin passkey registration |
POST | /api/v1/auth/mfa/passkey/register/verify | session + re-auth | Finish passkey registration |
POST | /api/v1/auth/mfa/passkey/options | MFA cookie | Begin passkey authentication |
POST | /api/v1/auth/mfa/passkey/verify | MFA cookie | Finish passkey authentication |
GET | /api/v1/config | none | Safe tenant branding, redirects, origins, and auth policy (60s cache tag) |
GET | /api/v1/cdn/permissions | none | Public permission map with version, bits, and ETag |
GET | /api/v1/cdn/public-key | none | Active key plus the retained key set and kid |
GET | /api/v1/cdn/public-keys | none | Active and retired public keys |
GET | /api/v1/cdn/revocations | none | Revocation bucket snapshot |
GET | /api/v1/cdn/revocations/ws | revocation token | WebSocket upgrade for revocation pushes (?token=…) |
POST | /api/v1/admin/rotate-signing-key | tenant admin bearer | Rotate the tenant signing key |
POST | /api/v1/admin/revoke-all | tenant admin bearer | Emergency revoke-all + key rotation |
POST | /api/v1/admin/revocation-token | tenant admin bearer | Mint a one-hour WebSocket token |
GET | /api/v1/admin/audit | tenant admin bearer | Recent admin audit rows |
GET | /api/v1/admin/permissions | tenant admin bearer | Active permission map |
GET/PUT | /api/v1/admin/permissions/users/:userId | tenant admin bearer | Read or replace roles/grants |
POST/DELETE | /api/v1/admin/permissions/users/:userId/roles[/:role] | tenant admin bearer | Grant or revoke a role |
POST/DELETE | /api/v1/admin/permissions/users/:userId/permissions[/:permission] | tenant admin bearer | Grant or revoke a direct permission |
GET/PUT | /api/v1/admin/webhook | tenant admin bearer | Read/set webhook config |
POST | /api/v1/admin/webhook/test | tenant admin bearer | Send a test event |
GET | /api/v1/admin/webhook/dead-letters | tenant admin bearer | List failed deliveries, oldest first |
GET | /api/v1/admin/webhook/dead-letters/:id | tenant admin bearer | Inspect one failed delivery |
POST | /api/v1/admin/webhook/dead-letters/:id/redeliver | tenant admin bearer | Redeliver one event |
POST | /api/v1/admin/webhook/dead-letters/redeliver | tenant admin bearer | Redeliver every failed event |
Webhook payloads, signature verification, retry timing, and idempotency are documented in docs/webhooks.md.
| POST | /api/v1/control/tenants | control bearer | Create a tenant with config and quotas |
| PATCH | /api/v1/control/tenants/:id | control bearer | Update identifier, config, or quotas |
| GET/PUT | /api/v1/control/tenants/:id/permissions | control bearer | Read or apply a YAML permission map |
| POST | /api/v1/control/tenants/:id/permissions/diff | control bearer | Preview map changes |
| GET | /api/v1/control/tenants/:id/permissions/versions | control bearer | Immutable map history |
| POST | /api/v1/control/tenants/:id/permissions/rollback | control bearer | Restore an older map as a new version |
| POST | /api/v1/control/tenants/:id/admin-token | control bearer | Mint/rotate a tenant admin token |
| DELETE | /api/v1/control/tenants/:id/admin-token | control bearer | Revoke a tenant admin token |
| POST | /api/v1/control/tenants/:id/suspend | control bearer | Suspend a tenant |
| POST | /api/v1/control/tenants/:id/resume | control bearer | Resume a tenant |
| DELETE | /api/v1/control/tenants/:id/users/:userId/mfa | control bearer (owner) | Reset a user’s factors and sessions |
| DELETE | /api/v1/control/tenants/:id | control bearer | Delete and tombstone a tenant |
| GET | /api/v1/control/tenants | control bearer | Tenant metadata for backups |
| GET | /api/v1/control/audit | control bearer | Global control-plane audit |
| POST | /api/v1/control/keys | control bearer (owner) | Create a named control key |
| GET | /api/v1/control/keys | control bearer | List control key metadata |
| DELETE | /api/v1/control/keys/:id | control bearer (owner) | Revoke a control key |
| GET | /api/v1/control/audit/log | control bearer | Structured audit events with role and details |
| GET | /api/v1/control/tenants/:id/stats | control bearer | Users, sessions, events, sockets, and quotas |
| POST | /api/v1/control/tenants/:id/cache/purge | control bearer | Purge every cached tenant artifact |
| GET | /api/v1/control/tenants/:id/export | control bearer | Secret-free tenant export |
| GET | /api/v1/control/tenants/:id/backup | control bearer | Full restorable backup (secrets) |
| POST | /api/v1/control/tenants/:id/restore | control bearer | Restore a full backup |
| POST | /api/v1/control/tenants/:id/hosts | control bearer | Add a host and issue a DNS challenge |
| DELETE | /api/v1/control/tenants/:id/hosts/:host | control bearer | Remove a host alias |
| POST | /api/v1/control/tenants/:id/hosts/:host/verify | control bearer | Prove ownership by DNS TXT/CNAME |
| POST | /api/v1/control/tenants/:id/hosts/remove | control bearer | Remove a host alias (legacy path) |
| POST | /api/v1/control/tenants/:id/hosts/move | control bearer | Move a host alias |
Narrowing mfa.methods is rejected if it would leave an enrolled user with no allowed factor. If a legacy tenant is already in that state, login issues the enrollment-limited session so the user can add an allowed factor after re-auth; an owner can also reset a user’s factors with DELETE /api/v1/control/tenants/:id/users/:userId/mfa.
When a tenant policy sets mfa.required and the user has no factor, login issues a short mfa_enroll session. It can call re-auth, logout, /auth/user, list factors, and enroll a factor, but no other session route until enrollment completes and the user logs in again.
DELETE /api/v1/control/tenants/:id requires an Idempotency-Key (or x-idempotency-key). Restore records the 20 most recent delete keys (the same cap as the live record), so replaying one of those keys after one or more restore cycles is rejected instead of erasing the restored tenant. Keys older than that cap become replayable after enough delete/restore cycles; this is a documented residual, not a reason to keep an unbounded history.
Session notes
Tokens are PASETO v4.public with iss = caveo:<tenantId>, a jti shaped like <epoch-day>-<sequence>, a kid naming the signing key, and a scope of session (full login), mfa (half-auth login), or password_reset. Full sessions last 7 days and refresh explicitly; half-auth sessions last 15 minutes and are consumed atomically against the user’s credential epoch, so a password reset cannot be bypassed by an in-flight MFA completion. Signed but revoked tokens are rejected by checking the stored session row and the tenant’s revocation bitmask, and reset tokens issued before the last password change are rejected. Verification uses the token’s kid; retired public keys stay published for the 31-day token horizon; normal rotation is limited to once per hour, so that set is bounded at about 745 keys, while break-glass revoke-all prunes beyond a 64-key emergency cap because it already revoked every session, and the public-key response is cached for 30 seconds so a rotation cannot leave a long stale key. Rotation retires every active key, is rate limited inside the store transaction, and each attempt is logged. Set the global ADMIN_TOKEN for the control plane, mint an expiring tenant admin token, and use that for tenant administration. Call the admin rotation endpoint to rotate. TOTP codes are single-use per 30-second step, five consecutive failures lock the factor for 15 minutes, and recovery codes are single-use and stored as salted PBKDF2 hashes. Sensitive changes require a short-lived re-auth token, and re-auth attempts are rate limited per user and IP. Errors use { success: false, errors: [{ code, message }], result: null }, bodies are capped at 64 KiB (restore at 25 MiB), and every response advertises x-api-version: 1 plus an x-request-id. Tenant/payload codes use the 8000 range; auth/not-found/conflict/rate-limit/internal reuse chanfana’s 7003/7002/7006/7008/7009 codes. Per-tenant DO fixed-window limits cover login, registration, reset/verification, and MFA; the per-key buckets and shared tenant budget commit atomically, a global-budget denial attempts a best-effort refund of that reservation keyed by a reservation id (duplicate refunds are ignored, failures are logged, and the caller still gets 429), and a cross-tenant global per-IP budget in the control DO caps distributed abuse. IPv6 is aggregated to /56 and IPv4-mapped addresses share their IPv4 bucket. /health/ready is rate limited per IP. Argon2 has a 5s timeout, a 30s circuit breaker, and a single half-open probe.
Caching and webhooks
Workers Cache is disabled, and public-key/revocation responses are cached for 30 seconds with explicit tenant-keyed Cache API entries; public tenant config is cached for 60 seconds under a tenant-config:<id> tag. Revocation snapshots carry a revision/ETag, are purged on every revoke, and a multi-tag ControlPlane DO outbox retries failed public-key, revocation, and config purges from a five-minute cron. The drain clears explicit entries and outbox rows even when Workers Cache is disabled; cross-PoP staleness is bounded by the 30-second TTL. Webhook delivery signs t=<unix>,v1=<hmac-sha256> only when a secret is configured, adds X-API-Key only when configured, uses a 5-second timeout, refuses redirects, and SSRF-validates the destination and its DNS answers. Failed deliveries retry with backoff before dead-lettering; dead letters are retained for 30 days.
Architecture decisions
ADRs 0001–0017 cover revocation bitmasks, PASETO, DO SQLite, webhook-delivered verification, signing-key lifecycle, SSRF validation, admin scoping, sessions/re-auth/recovery, migration repair, tenant lifecycle/control plane, revocation propagation, expand/contract migrations, free-tier abuse controls, free-tier operations, the control-plane key/role model, YAML permission maps, and the split SDK. See docs/adr/.
Documentation
docs/architecture.md— system diagram, layers, and key flowsdocs/web.md— browser app, tenant branding, MFA/passkeys, demo, and E2Edocs/adr/— architecture decision records and their trade-offsROADMAP.md— goals, tasks, and linked GitHub issuesHANDOFF.md— implementation details, gotchas, and open items/on a running API — generated OpenAPI reference
Licensing
Caveo is licensed per component:
apps/apiis licensed under AGPL-3.0-only.apps/sdkis licensed under Apache-2.0.apps/cliis licensed under MIT.packages/permissionsis licensed under MIT.
Organizations that cannot meet AGPL-3.0 obligations can obtain a commercial API license; see COMMERCIAL.md. The SDK’s Apache-2.0 license does not require a commercial license.
See LICENSING.md for the full policy.