CLI
Learn about the Entro Auth CLI commands for generating, migrating, and checking database schemas, creating initial admins, initializing projects, generating secret keys, and gathering diagnostic info.
Entro Auth comes with a built-in CLI to help you manage and check database schemas, create initial admin users, initialize your project, generate a secret key for your application, and gather diagnostic information about your setup.
Generate
The generate command creates the schema required by Entro Auth. If you're using the Drizzle adapter, this command generates a Drizzle schema file. If you're using the built-in Kysely adapter, it generates an SQL file you can run directly on your database. That file holds only what your database is missing: the command reads the database to compare it with your schema, so the database in your auth config has to be reachable when you run it.
npx @entro314labs/entro-auth-cli@latest generateOptions
-c, --cwd- The working directory. Defaults to the current directory.--output- Where to save the generated schema. By default, Drizzle writes./auth-schema.tsand Kysely writes an SQL file named after the current time in./entro-auth_migrations/. If--outputis an existing directory, the file is written inside it.--config- The path to your Entro Auth config file. By default, the CLI will search for an auth.ts file in ./, ./utils, ./lib, or any of these directories under thesrcdirectory.-y, --yes- Skip the confirmation prompt and generate the schema directly.--adapter- The schema generator to use:drizzleorkysely.--dialect- The target database provider. It is required with--adapter drizzle.--if-not-exists- Write statements that can be run again:IF NOT EXISTSon every table, column and index. For the built-in Kysely adapter on PostgreSQL only; the other databases cannot add a column only when it is missing. The file still holds only what the database you point it at lacks, so run it against an empty database to get the whole schema as one repeatable file.
Generate Without a Database Connection
Drizzle can generate a schema without using the configured database adapter. The CLI still loads your config to include plugins and schema customizations.
npx @entro314labs/entro-auth-cli@latest generate --adapter drizzle --dialect postgresqlProp
Type
Kysely introspects the configured database, so --dialect has no effect with --adapter kysely.
If --adapter is omitted, the CLI uses the adapter configured in your Entro Auth config file. Passing --dialect by itself has no effect.
Migrate
The migrate command applies the Entro Auth schema directly to your database. This is available if you're using the built-in Kysely adapter. For other adapters, you'll need to apply the schema using your ORM's migration tool.
npx @entro314labs/entro-auth-cli@latest migrateOptions
--config- The path to your Entro Auth config file. By default, the CLI will search for an auth.ts file in ./, ./utils, ./lib, or any of these directories under thesrcdirectory.--yes- Skip the confirmation prompt and apply the schema directly.
Using PostgreSQL with a non-default schema?
Set database.schemaName to select the schema explicitly. Otherwise, the migrate command uses the connection's search_path. See the PostgreSQL adapter documentation for configuration details.
Check
The check command runs all available checks. Run it whenever you want to verify your Entro Auth setup, manually or in automation:
npx @entro314labs/entro-auth-cli@latest check --config ./src/auth.tsSchema
The check schema command verifies that your configured schema can hold what Entro Auth writes. It does not create schema files or apply migrations.
npx @entro314labs/entro-auth-cli@latest check schema --config ./src/auth.tsThe schema check reads the live database for Kysely and the configured schema object for Drizzle. The Drizzle check does not confirm that migrations have been applied to the database. If validation is unavailable for your adapter, the command fails instead of silently skipping it. It also runs when runtime validation is disabled with advanced.database.validateSchema: false.
Options
Both check and check schema accept:
-c, --cwd- The working directory. Defaults to the current directory.--config- The path to your Entro Auth config file. By default, the CLI searches the usual config locations.
Create Admin
The create-admin command creates an initial admin user through your configured Entro Auth instance. It requires the Admin plugin and a persistent database, and it uses the same server-side auth.api.createUser path as the Admin plugin so passwords are hashed and database hooks still run.
npx @entro314labs/entro-auth-cli@latest create-admin --email admin@example.com --name "Admin" --role adminIf users already exist, the command asks for confirmation. Use --force or --yes to skip that prompt.
Options
--email- The email address for the admin user.--password- The password for the admin user. If omitted, the CLI will prompt for it.--name- The name for the admin user. Defaults toAdmin.--role- The role to assign. Defaults toadmin.--data- Additional user fields as a JSON object.--no-email-verified- Create the admin user with an unverified email. By default, the CLI marks the admin email as verified.--config- The path to your Entro Auth config file.--force- Create the admin user even when users already exist.--yes- Skip the existing-users confirmation prompt.
Init
The init command sets up Entro Auth in your project.
If the project already has an auth config file in one of the usual locations, init leaves that file as it is and skips the database, email & password and social provider steps, since those only feed a new config. Add a database, sign-in methods and providers to your existing config by hand.
npx @entro314labs/entro-auth-cli@latest initOptions
-c, --cwd- The working directory. Defaults to the current directory.--package-manager- The package manager to install with:npm,pnpm,yarn, orbun. Defaults to the package manager detected in the working directory.--config- Accepted, butinitdoes not read it yet: it looks for an existing auth config in the usual locations.
Upgrade
The upgrade command updates older @entro314labs/entro-auth dependencies and official @entro314labs/entro-auth-* packages that participate in the synchronized release train to the version of the CLI being run. It compares the minimum version allowed by each package.json specifier; specifiers whose minimum is the same or newer are left unchanged. Packages outside the release train are not changed.
npx @entro314labs/entro-auth-cli@latest upgradeOptions
--cwd- The project directory containing thepackage.jsonto update. Defaults to the current directory.--yes- Skip the confirmation prompt and install the updates directly.
Info
The info command provides diagnostic information about your Entro Auth setup and environment. Useful for debugging and sharing when seeking support.
npx @entro314labs/entro-auth-cli@latest infoOutput
The command displays:
- System: OS, CPU, memory, Node.js version
- Package Manager: Detected manager and version
- Entro Auth: Version and configuration (sensitive data auto-redacted)
- Frameworks: Detected frameworks (Next.js, React, Vue, etc.)
- Databases: Database clients and ORMs (Drizzle, Kysely, etc.)
Options
--config- Path to your Entro Auth config file--json- Output as JSON for sharing or programmatic use
Examples
# Basic usage
npx @entro314labs/entro-auth-cli@latest info
# Custom config path
npx @entro314labs/entro-auth-cli@latest info --config ./config/auth.ts
# JSON output
npx @entro314labs/entro-auth-cli@latest info --json > auth-info.jsonSensitive data like secrets, API keys, and database URLs are automatically replaced with [REDACTED] for safe sharing.
Secret
The CLI also provides a way to generate a secret key for your Entro Auth instance.
npx @entro314labs/entro-auth-cli@latest secretScripts and CI
Without an interactive terminal, such as in CI, the CLI can't prompt. Pass the answers as flags instead, such as --yes to confirm:
npx @entro314labs/entro-auth-cli@latest migrate --yesWhen a command can't continue, it fails and names what it needs, such as a flag or a terminal.
Common Issues
Error: Cannot find module X
The CLI resolves most imports for you: tsconfig.json path aliases, package.json subpath imports (including SvelteKit 3's #lib), and stubbed framework virtual modules ($env/*, $app/*, cloudflare:workers, Vite assets like ?raw). On SvelteKit 2, run svelte-kit sync first so .svelte-kit/tsconfig.json exists and $lib resolves.
A few module types can't load outside their bundler (e.g. .svelte components or import.meta.glob). Keep those out of your config file's import graph.
API
Learn how to call Entro Auth API endpoints on the server, pass body, headers, and query parameters, retrieve response headers, and handle errors.
Client
Learn how to set up the Entro Auth client for React, Vue, Svelte, and other frameworks, use hooks, configure fetch options, handle errors, and extend with client plugins.