drift Docs
Start
What is Drift?
The tour, if you are new here.
Use cases
Whether Drift does your thing.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, four 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.
Troubleshooting
Error codes
What went wrong, and what to do about it.
Legal
Acceptable use
What a slice may not be used for.
Data processing
The DPA, and every sub-processor.

drift file

Everything you do with a Driftfile, under one noun. The file declares what runs on a slice — which source files fill which slots — while the slice's own shape and price are chosen in drift slice create/resize. One noun, so there is nothing to learn about where a verb lives before you can type it.

Four of these never leave your laptop: no account, no slice, no network, so “is line 9 a typo?” costs milliseconds instead of a failed deploy.

Command Description
drift file lint [path]Validate a Driftfile exactly as a deploy would. Exits non-zero on the first invalid file, so it can gate a CI job.
drift file explain [path]Print the shape the file resolves to, inherited defaults included. Pass --env staging to apply that environment's overlay first.
drift file fmt [path]Rewrite in canonical key order and 2-space indentation. --write updates in place; comments and short forms survive.
drift file new [path]Write a starter Driftfile with the knobs a first deploy needs filled in. --name, --canvas <dir>, --force.

A bare path argument defaults to ./Driftfile, and a directory argument means the Driftfile inside it.

The rest apply the file, or run what it declares:

Command Description
drift file apply [env]Apply everything the Driftfile declares to a slice. Unchanged functions are skipped.
drift file apply --planPrint what this file would deploy, then exit. Nothing is applied and no hooks run. It prices nothing — a slice's cost belongs to the shape, which this file does not declare.
drift file simulate [env]The same dry run as its own verb. Never applies; exits non-zero if the manifest would abort.
drift file benchmarkMeasure what each Atomic function actually costs, and print what it should book. --write applies the recommendation to the Driftfile.
drift file run [env]Build and run the whole project locally in Docker, with no account and no cloud.
drift file test [env]Run it locally, wait for health, then run the Driftfile's tests.e2e commands against it.
drift file stop [env]Stop the local run.
drift file logs [env]Tail logs from the local run.

The four local verbs are one loop: run boots the whole project in Docker, test runs the Driftfile's tests.e2e commands against it, logs tails it, and stop tears it down.

Apply flags

Flag What it does
--planDry run: print what would deploy, apply nothing. Exits non-zero if applying would abort.
--forceRedeploy every function, even ones whose source is unchanged.
--yes, -yAuto-confirm prompts (for CI).
--env <name>Same as the positional environment argument; also sets ${ENV}.
--secret KEY=valueOverride one variable for ${VAR} / $ENVREF resolution. Repeatable.
--no-env-fileDon't read the .env / .env.<env> file beside the Driftfile.
--no-slice-reconcileDeprecated: does nothing. Apply never reconciled a shape after drift slice resize took ownership of it.
--billing-period-months NDeprecated: does nothing. A billing period is chosen when the slice is shaped.

drift project still works, and says so.

The old spelling runs the same commands and prints one line naming what to type instead; drift file deploy and drift file diff do the same for the two verbs that were renamed. They will be removed in a future release.

Applying never changes a slice's shape.

It fills the slots you bought, and refuses against a slice that does not exist. To add a resource, raise a limit or drop one, use drift slice resize, which opens the browser form on what the slice currently is. Secrets declared in a Driftfile can pull values from your shell with $ENV references, resolved at apply time.

Testing before you ship

drift file test is run plus your own e2e commands. It starts the project locally, waits for it to report healthy, exports the instance URL as DRIFT_TEST_URL (the port is chosen at runtime, so read it rather than hardcoding one), and runs every command under tests.e2e. The first non-zero exit fails the run, and the instance is torn down either way.

Driftfile
# Driftfile
tests:
  e2e:
    - npx playwright test

# then, with no account and no cloud:
$ drift file test

explain is the one that pays for itself. An environment block that sets three knobs looks like it describes the slice, when it describes three knobs on top of a base you're holding in your head. It prints no price: the server is the single authority on cost, and drift file apply --plan is where that number comes from. It prints names of secrets, never values.

The platform owns the format, so the CLI needs a copy of it.

The Driftfile schema is fetched on first contact and cached at ~/.drift/driftfile.schema.json. On a machine that has never run an online command, lint refuses rather than printing a tick it can't stand behind so run drift account login or drift slice list once and it's cached permanently.

Every key the file accepts is in the Driftfile reference.