atomic
Functions and workers, one at a time. drift apply covers the whole project; these are for working on a single function and for operating what is live.
Develop
| Command | Description |
|---|---|
drift atomic new [name] | Scaffold a function: one flat source file in a backend, not a folder, and the function block that declares it, printed for you to paste into the Driftfile. Interactive, or drive it with -l go, -m post, -q <queue>, -a apikey, -b <backend>. |
drift atomic run <dir> [--function name] [--port N] [--quiet] | Run one declared function locally with hot reload (--port defaults to 3000). --function picks which one when the folder declares several. Workers are not served here: drift file run runs them beside the functions. |
drift atomic fetch [path] | Resolve dependencies for every Atomic backend under a path |
A scaffolded function is not deployed until the Driftfile declares it and drift apply ships it: apply is the only command that does, and it builds and uploads only the functions and workers whose source or declaration changed. drift atomic new sign -l go -m post prints the block to add:
atomic {
backend "default" {
function "POST /sign" {
handler = "PostSign"
memory = "32MiB"
}
}
}Operate
| Command | Description |
|---|---|
drift atomic list | List every function and worker slot on the slice (flat or grouped by backend) |
drift atomic workers | List the slice's workers: state (running, backoff, paused or stopped), how long each has been up, how often it was restarted, and how it last stopped |
drift atomic workers restart <name> | Start a worker again now, including one paused after a crash loop |
drift atomic logs <name> [-n N] [-f] | Fetch function or worker logs (-f streams new lines) |
drift atomic logs purge <name> | Clear a function's in-memory logs |
drift atomic metrics <name> | Request count, error rate, and average duration |
Remove a function or worker
There is no command that deletes one by name. Delete its block from the Driftfile and run drift apply. The plan lists the removal and what goes with it, and apply asks you to agree to it:
- function GET /two deployed code, triggers and history are deleted
Removes function GET /two
Apply with: drift apply (asks for each of the above)
or: drift apply --approve-remove "function GET /two"Renaming a function is the same thing twice: the old name is removed and the new one deployed.
Roll back
| Command | Description |
|---|---|
drift atomic history <name> | Show a function's or field's deployment history |
drift atomic rollback <name> <position> | Roll back to an earlier deployment (positions from history) |
drift atomic redeploy <name> | Re-deploy the last known artifact |
A function is addressed by method and path.
redeploy, rollback and history all take --method/-m. A function is addressed by method and path, so without it get:x and post:x are indistinguishable by name.Authentication
| Command | Description |
|---|---|
drift atomic auth set <function> <key> [-m method] | Set or rotate a function's API key |
drift atomic auth list <function> | List the API keys configured for a function (fingerprints, not raw keys) |
drift atomic auth revoke <function> [-m method] | Revoke a function's API key |
Declare the key in the Driftfile with an auth block in the function. The key is never written there: it is read from an environment variable when drift apply runs, and the plan shows function POST /orders key as set, unchanged or rotated. A key the slice already holds with the same fingerprint (its last four characters) is not rotated.
atomic {
backend "default" {
function "POST /orders" {
handler = "PostOrders"
memory = "32MiB"
auth {
api_key = env("ORDERS_KEY")
}
}
}
}A key set without --method get protects nothing.
set and revoke default to --method post. Setting a key for a GET route without --method get reports success and protects nothing. A configured key protects a route even when the Driftfile declares no auth block for it. See Authentication.Backends & triggers
| Command | Description |
|---|---|
drift atomic backend list | List functions grouped by backend |
drift atomic trigger list | List registered triggers |
drift atomic trigger unregister <name> | Remove a trigger the Driftfile no longer declares |
A trigger is declared, not registered. A queue is a function labelled QUEUE and the queue it drains, with poll (default "500ms") and max_retries (default 3, before a message moves to its dead-letter queue) to tune it. A schedule is a 5-field cron on the function. drift apply deploys either with the function, and there is no command that registers one.
atomic {
backend "default" {
function "GET /nightly-sync" {
handler = "GetNightlySync"
memory = "32MiB"
cron = "0 0 * * *"
}
}
}Alerts
| Command | Description |
|---|---|
drift atomic alert list | List alerts on the active slice |
An alert is declared, not added: write an alert block inside the function it watches, with threshold, window and a webhook = env("NAME"), and drift apply sets it and deletes the ones the file does not name. See Limits and alerts.
Egress
| Command | Description |
|---|---|
drift atomic egress list | Show the slice's mode and declared hosts |
drift atomic egress refresh | Re-resolve DNS, re-apply the allowlist, and print the addresses it now holds |
drift atomic egress test <host> | Is this hostname on the declared list? It reads the list from the slice and matches the name exactly, with no DNS lookup. A “did I spell it right” tool, and a miss exits non-zero. |
There is no add or remove. The Driftfile's egress block, inside edge, is the source of truth; these commands are for inspection.
slice "demo" {}
edge {
egress {
mode = "allowlist"
hosts = ["api.stripe.com"]
}
}Change the list by editing the file and running drift apply. In open mode every public host is reachable; in allowlist mode only the resolved IPs behind the declared hosts are, and a host that is not declared is refused. Either way, private RFC-1918, link-local and CGNAT ranges are always blocked. See Egress for the full model and each command's output.