The CLI
For: a developer or an operator who sets up, migrates, checks, or maintains an API with authtempo.
What it does: this page lists each command of authtempo, and the rules that every command keeps.
Before you start
Section titled “Before you start”- Node 22.13 or newer. The
enginesfield of@authtempo/cligives this floor. - The
@authtempopackages are on npm. Add the CLI to your app withpnpm add -D @authtempo/cli, and run each command aspnpm exec authtempo …. Choose your stack tells how to start an app.
Run it from this repo
Section titled “Run it from this repo”The root of the repo has no authtempo binary, and an app that authtempo init writes does not depend on @authtempo/cli. Build the CLI once in the repo. Then run each command with node and the absolute path of the repo, in the folder of your app.
cd /path/to/authtempopnpm turbo run build --filter=@authtempo/clicd /path/to/my-appnode /path/to/authtempo/packages/cli/dist/bin/authtempo.js --help- Write the path of your clone in place of
/path/to/authtempo. - The command reads and writes each relative path, such as
--configor--users, from the current folder. - A test runs this form from a temporary folder, and checks the folder and the exit codes.
pnpm --filter authtempo-example-worker exec authtempo runs in examples/worker, not in your folder, and exits 1 on any failure. Use it for --help only.
The commands
Section titled “The commands”| Command | What it does | Page |
|---|---|---|
authtempo init |
Writes a new app with a magic link sign-in on one stack. | authtempo init |
authtempo migrate |
Applies the migrations of the adapter, after the version gate. | authtempo migrate |
authtempo import |
Moves the users of another provider into authtempo. | authtempo import |
authtempo check |
Checks that a deployment answers as core promises. | authtempo check |
authtempo keys rotate |
Makes a new signing key through the operator route. | authtempo keys rotate |
authtempo mcp |
Adds the authtempo MCP server to the config of an editor in this project. | authtempo mcp |
authtempo secret |
Makes an app secret or an operator secret from 32 random bytes. | authtempo secret |
authtempo secret status, authtempo secret rewrap |
Counts and reseals the rows of each app secret version through the operator routes. | authtempo secret status, authtempo secret rewrap |
authtempo info |
Prints a support report with no secret value. | authtempo info |
authtempo users |
Reads, creates, bans, unbans, updates, and deletes users, changes the platform role, and turns a second factor off, through the operator user tools. | authtempo users |
authtempo sessions |
Ends the sessions of one user or of all users through the operator user tools. | authtempo sessions |
authtempo audit list |
Lists the audit rows of the operator acts. | authtempo audit list |
authtempo create-admin |
Makes the first platform operator of a deployment. | authtempo create-admin |
authtempo generate |
Prints the schema of the authtempo tables as SQL, Drizzle, or Prisma. | authtempo generate |
authtempo upgrade |
Moves every authtempo package of an app to one version, and prints the Breaking lines and the next steps. | authtempo upgrade |
The flags
Section titled “The flags”| Flag | What it does |
|---|---|
--version |
Prints the version of the CLI and the schema version of its core. |
--json |
Prints one JSON document on stdout. The human lines go to stderr. |
-h, --help |
Prints the complete help. The command ignores every other argument. |
The exit codes
Section titled “The exit codes”| Exit code | What it means |
|---|---|
| 0 | Done. Every check passed, or the command made the change that it named. |
| 1 | A person must look: a check failed, a record or a row needs a person, or a part of the report gave no answer. |
| 2 | A usage error, a malformed input, or a stop. A stop prints one stopped line. |
A stop prints its stopped: line on stderr.
The output
Section titled “The output”- stdout holds the result.
- stderr holds the usage errors, the warnings, the
stopped:line, and each progress line that names what the command reads or connects to. - A result line on stdout can name a file or the base URL, such as
wrote <path>ofinit. --jsonprints one JSON document on stdout, and nothing else there. A script reads that document, not the human lines.- On a usage error or a stop,
--jsonprints one document withexit: 2and the reason instopped. Each other key holds its empty value, such as"",[], ornull. - Each document of
--jsonholdsexit, the exit code of the run, andstopped, which is null when the run did not stop.--version --jsonhas neither key. - The human lines can change in a later version. A JSON document only gains keys, and a removal comes after a deprecation.
- The CLI writes no color and no terminal control.
Secrets
Section titled “Secrets”- No flag takes a secret as its value.
- A connection string comes from
--url-env <NAME>or--url-file <path>. The default variable isDATABASE_URL. - The operator secret comes from
--token-env <NAME>or--token-file <path>. The default variable isAUTHTEMPO_OPERATOR_SECRET. - A libSQL token comes from
--auth-token-env <NAME>or--auth-token-file <path>. The default variable isLIBSQL_AUTH_TOKEN. The token is optional. - A file of
-is stdin. - No output line holds a secret that the command read. The CLI names a database by its host, its port, and its name only.
authtempo secretprints the secret that it makes once, or writes it to a new file that only its owner can read. It replaces no file.
The help
Section titled “The help”authtempo --help,authtempo help <command>, andauthtempo <command> --helpprint the complete help, with the link to the page of the command.- A flag one edit from a known flag gets “Did you mean”, and the command does not run.
- With no command,
authtempoprints the short help on stderr and exits 2.
The stacks entry
Section titled “The stacks entry”@authtempo/cli/stacks holds the stacks of authtempo init, for a tool that lists them. It imports nothing.
| Export | What it is |
|---|---|
STACKS |
The stack names of authtempo init --stack, in order. |
Stack |
One member of STACKS. |
STACK_INFO |
The facts of each stack: its example, its label, its tutorial page, its secrets file, and its steps. |
StackInfo |
One row of STACK_INFO. |