drift Docs
Start
What is Drift?
The tour, if you are new here.
Why Drift?
The case for a smaller cloud.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, five unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Accounts, tokens and scopes.
Security
Boundaries, sandboxing and hardening.

Environments: per-environment deploys

Ship the same project to several places (production, a staging copy, a throwaway dev slice) that share one shape but differ in a few config dials. Each environments entry is a partial override that deep-merges onto the base; drift project deploy <env> selects one and deploys it as its own slice.

Driftfile
log_retention: 30d               # top level, in the base…
atomic:
  rate_limit: 5000/min            # the base = production defaults
backbone:
  nosql:
    - name: links
      size: 500MB

environments:
  prod: {}                          # inherits the base unchanged
  staging:
    log_retention: 3d              # …and top level in the override
    atomic: { rate_limit: 200/min }
    backbone:
      nosql:                       # re-declaring REPLACES the base list
        - name: links
          size: 50MB
  dev:
    atomic: { rate_limit: 20/min }   # everything else inherits

An override block accepts the same keys as the base (log_retention, backup_retention, atomic, backbone, canvas, domains) with one forbidden: it may not set name, which is derived.

How the merge works

The overlay is a deep merge of the document, and it has exactly two rules:

  • Maps recurse. Setting atomic.function_memory leaves the rest of atomic alone.
  • Everything else replaces, lists included. A list in an override is the whole list; there is no element-wise merge.

Presence is the signal, not truthiness, and that is what lets an environment express deploy_history: 0 or wildcard: false and have it stick.

A resource list is shared only while an environment stays silent about it.

The example above gives staging exactly one collection at 50MB, not two and not a 500MB one: re-declaring backbone.nosql replaced the base list wholesale. Leave a list out to inherit it; write it out and you own all of it. Run drift file explain --env staging to see the result before you deploy.
  • The slice name is derived: name for prod/production, name-<env> otherwise. Each environment is its own separately-priced slice with its own URL.
  • Config lives here; secrets that differ per environment live in .env.<env>. ${ENV} binds to the selected environment.
  • An environment name takes the same identifier shape as a project name.

This is not a CI pipeline: there is no “deploy staging, test, promote prod” orchestration in the Driftfile. Drift gives the verb; your CI chains it.