Environments
Development, staging and production in AppCore: separate data, separate provider connections, sandbox vs production store evidence, promotion and lifecycle states.
On this page
Each app has up to three environments: development, staging and production. An environment is not a flag inside one database. It is a separate resource set with its own runtime Worker, its own D1 database, its own provider connections and its own users.
flowchart LR
subgraph dev["development"]
dW["runtime"] --- dD[("D1")]
dC["sandbox connections<br/>+ test-only trust material"]
end
subgraph stg["staging"]
sW["runtime"] --- sD[("D1")]
sC["sandbox connections"]
end
subgraph prd["production"]
pW["runtime"] --- pD[("D1")]
pC["production connections<br/>(production evidence + gates)"]
end
dev -- "promote: same pinned artifact<br/>(code only, no data, no secrets)" --> stg
stg -- "promote" --> prdWhat differs between environments
| Concern | development | staging | production |
|---|---|---|---|
| Users, sessions, purchases, entitlements, analytics | Own database | Own database | Own database |
| Apple purchases accepted | Sandbox only | Sandbox only | Production only |
| Google Play purchases accepted | Test purchases only | Test purchases only | Real purchases only |
| Test-only verification material (a test JWKS for ID tokens, a test Apple root certificate) | Honored | Ignored | Ignored |
| Connection activation | Needs real read-only and sandbox evidence | Same | Needs production evidence and every blocking manual gate |
| Stable identity data key | Falls back to the auth secret, with a readiness warning | Same | Required. Without it identity is disabled. |
| Publishing remote config, catalog, migrations, DLQ replay | Non-production permission | Non-production permission | Separate production permission |
| Campaign scheduling | Uses default policy | Uses default policy | Requires a pushed policy profile (409 POLICY_REQUIRED otherwise) |
A purchase whose store environment does not match the runtime is rejected with PROVIDER_ENVIRONMENT_MISMATCH and grants nothing. Store webhooks for the wrong app or store environment are rejected with 422 and not ingested.
Creating environments
- When a tenant is created, you choose which environments its first app gets.
- When you add another app, it gets the same set of environments as the tenant's first app. If the first app has none, the new app gets
developmentonly. - Each environment is provisioned as one resumable job: create D1, apply migrations, write and verify the
app_scoperow, deploy the runtime, wire the route, check health. A retry resumes the same job and the same resource set. It never creates a duplicate. - An environment reports
readyonly when every dependency is live. Missing providers show aspartialordegraded, never green.GET /health/readyon the runtime lists each module's evidence, for exampleemail_otp: disabled (no email sender).
Promotion
promote deploys the exact runtime artifact (pinned by SHA-256) of one environment to the next one: development → staging → production. It moves code only. Users, purchases, connections and secrets are never copied. Provider connections are configured per environment. See the provider guides.
Warning
Not yet enabled: copying redacted configuration (catalog drafts, templates, non-secret connection settings) from one environment to another. Configure each environment directly until this ships.
Lifecycle states
Operators can change an environment's operating mode. The runtime reads it as its app status, and every module checks that status before doing scheduled or optional work.
| Mode | Optional work (campaigns, analytics intake, engagement messages) | Essential work (sign-in, verified purchase callbacks, transactional and security messages, retention and erasure) |
|---|---|---|
normal / active | Runs | Runs |
dormant | Stopped. Client analytics intake answers 503 APP_INACTIVE with Retry-After: 3600. | Runs |
suspended | Stopped | Store callbacks are still verified and recorded. Engagement stops. Resuming is audited. |
archived | Stopped. Only export and restore actions are accepted. | Nothing is sent. OTP answers 503. |
Restore never overwrites a live database. It must target a separate, non-production environment of the same app. It requires a recovery plan, a backup or bookmark reference, evidence that writes have stopped, and an approval. Afterwards it revokes all sessions and requires reconciliation.
Warning
Not yet enabled: environment deletion with retention checks (there is no destroy action), and the automated export pipeline (D1 export to object storage). Today an export request becomes a manual operator step.
What this means for your app
- Ship separate build flavors (for example
stagingandproduction), each with its own API host and its own store/Firebase configuration. - Test purchases with sandbox accounts and Play license testers against development or staging. A production runtime refuses them on purpose.
- Users created in staging do not exist in production. Do not migrate test accounts.
- Check
GET /v1/config/public(the SDK does this) to see which sign-in methods, purchase providers and channels are actually live in the environment you are calling. Do not hard-code that list. - Before launch, make sure production has production-ready connections, the stable identity data key and a pushed engagement policy. Otherwise those features stay disabled.