Tier model
Summary
Section titled “Summary”The same set of binaries (api, worker, data-provider,
frontend-app) runs three ways. You decide by setting two
environment variables — there are no per-tier feature flags and no
per-tier code paths.
The full design rationale is in Why the three-tier deployment model.
Choosing your tier
Section titled “Choosing your tier”The two env vars
Section titled “The two env vars”# Tier 1 — defaults from .env.exampleSCANI_CLOUD_URL=http://localhost:8082SCANI_CLOUD_API_KEY=dev_data_provider_key_change_me_not_prod_safeDATA_PROVIDER_API_KEY=dev_data_provider_key_change_me_not_prod_safe
# Tier 2 — point api + worker at a hosted endpointSCANI_CLOUD_URL=https://data-provider.your-host.example.comSCANI_CLOUD_API_KEY=<issued by the operator># DATA_PROVIDER_API_KEY is not used on the user side in Tier 2 — it# lives on the hosted data-provider.The data-provider validates incoming bearers against its own
DATA_PROVIDER_API_KEY. In Tier 1, single-tenant mode, it’s the
same string as SCANI_CLOUD_API_KEY. In Tier 2+, the hosted
data-provider mints per-user / per-deployment keys via its
cloud-management surface (gated behind CLOUD_MANAGEMENT_ENABLED=true).
What does NOT change between tiers
Section titled “What does NOT change between tiers”- User integration credentials (exchange API keys, brokerage
tokens) always live on your
api. Tier-2 operators do not see them. - The schema. Same Postgres tables, same indexes, same
migrations. Applied explicitly by you on every Tier 1 deploy
(Apply migrations);
the same Drizzle
scani/migrateimage works against a managed Postgres too. - The wire contract. tRPC routes, payload shapes, return types are identical across tiers.
- The product behaviour. No feature is gated by tier.
What changes
Section titled “What changes”Where to go next
Section titled “Where to go next”- Tier 1 — Local dev stack — the one-command path.
- Tier 1 — Production with docker-compose — the production-shaped compose file.
- Tier 1 — Required environment variables — the must-set list.
- Tier 2 — Overview — what a hosted data-provider gives you.
- Tier 3 — Fully managed — the pointer page.