Skip to main content
The theauth add command fetches a component from the theAuth registry and writes its source files into your application.

theauth add writes component source into your repo.

add

Copies theAuth UI components into your project as source you own, in the shadcn style.
Options: --dir <path>, --overwrite, --dry-run, --registry <dir|url>. See UI components.

init

Options: Files it writes, relative to the project directory: Re-running init is safe: files that exist are reported as skipped and left alone. It does not edit package.json; it prints the install command for the package manager it detected (npm, pnpm, yarn or bun). Sample output and the follow-up curl are in the quickstart. theauth init --agent is a different mode that installs the assistant skill and MCP config.

doctor

Reads the process environment plus .env and .env.local in the current directory (the process environment wins), then checks: schema reads the ledger the same way theauth db status does, using DATABASE_URL or the database in theauth.config.mjs when you have one. allow-unauthenticated and trusted-proxy scan your src, server, app, lib and routes folders.

Live mode

--live [url] also calls the running server. Give it the URL where you mounted the handler (default http://localhost:3000/api/theauth; --url is an alias): When MCP is not mounted both well-known documents answer 404 and live-mcp-metadata passes. Metadata that points at a different origin than the one you probe (a BASE_URL of http://localhost:3001 while the server listens on 3000, for example) fails with the endpoints it could not reach.

Config rules

When theauth.config.mjs or theauth.config.js is present, the doctor reads it and checks the settings below. A .ts config loads only when the command runs under a TypeScript loader. Each rule has a severity: fail (exit 1), warn, or info. A rule appears only when it fires. Messages name settings and counts, never secret values. audit.secrets_table_collision is the one rule that reads the database. It runs a dry run of the migrator, which checks the table layout first and writes nothing, and it is left out when there is no database url, the SQLite file does not exist yet, or the database cannot be read (schema reports that). Fixes for each id are in the fix field of the output.

Exit code and JSON

Exit code is 1 when any check reaches the --fail-on severity, and 0 otherwise. Severities order as info < warn < fail: A check counts as its severity when it has one (config rules and some live checks), otherwise as its status. A value other than info, warn or fail is a usage error (exit 1, help text printed). With --json the ok field is false exactly when the exit code would be 1. The default is unchanged, so existing CI that runs theauth doctor behaves as before. With --json the output is:
status is pass, warn or fail; fix appears on non-passing checks. Config rules and the live cors.wildcard and headers.security_off_https checks also carry severity (info, warn or fail). For those, status is fail when severity is fail and warn otherwise. The shape is stable: new checks and fields only add entries, so key on id and ignore ids and fields you do not know. A check is left out when it does not apply (no DATABASE_URL, no adapter in source, no --live, no config file, or a rule that did not fire).

secret

Uses node:crypto. Bytes range from 16 to 128.

completions

Not yet

theauth migrate still prints a notice: tables are created on first run. A real migration and generate command is not part of this release.
Last modified on October 18, 2026