Skip to content

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.

  • Node 22.13 or newer. The engines field of @authtempo/cli gives this floor.
  • The @authtempo packages are on npm. Add the CLI to your app with pnpm add -D @authtempo/cli, and run each command as pnpm exec authtempo …. Choose your stack tells how to start an app.

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.

Terminal window
cd /path/to/authtempo
pnpm turbo run build --filter=@authtempo/cli
cd /path/to/my-app
node /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 --config or --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.

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
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.
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.

  • 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> of init.
  • --json prints 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, --json prints one document with exit: 2 and the reason in stopped. Each other key holds its empty value, such as "", [], or null.
  • Each document of --json holds exit, the exit code of the run, and stopped, which is null when the run did not stop. --version --json has 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.
  • No flag takes a secret as its value.
  • A connection string comes from --url-env <NAME> or --url-file <path>. The default variable is DATABASE_URL.
  • The operator secret comes from --token-env <NAME> or --token-file <path>. The default variable is AUTHTEMPO_OPERATOR_SECRET.
  • A libSQL token comes from --auth-token-env <NAME> or --auth-token-file <path>. The default variable is LIBSQL_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 secret prints the secret that it makes once, or writes it to a new file that only its owner can read. It replaces no file.
  • authtempo --help, authtempo help <command>, and authtempo <command> --help print 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, authtempo prints the short help on stderr and exits 2.

@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.