Files
better-auth/packages/cli
Saviru 5c6ccfa688 docs: update to React Router v7 and improve docs (#7457)
Co-authored-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Paola Estefanía de Campos <84341268+Paola3stefania@users.noreply.github.com>
Co-authored-by: Tim Keller <36288711+tjkeller-xyz@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Alex Yang <himself65@users.noreply.github.com>
Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-02-05 18:46:34 +00:00
..
2025-11-29 09:18:23 -08:00

Better Auth CLI

Better Auth comes with a built-in CLI to help you manage the database schema needed for both core functionality and plugins.

Init

The CLI includes an init command to add Better Auth to your project.

npx @better-auth/cli@latest init

Generate

The generate command creates the schema required by Better Auth. If youre using a database adapter like Prisma or Drizzle, this command will generate the right schema for your ORM. If youre using the built-in Kysely adapter, it will generate an SQL file you can run directly on your database.

npx @better-auth/cli@latest generate

Migrate

The migrate command applies the Better Auth schema directly to your database. This is available if youre using the built-in Kysely adapter. For other adapters, youll need to apply the schema using your ORMs migration tool.

npx @better-auth/cli@latest migrate

Secret

The CLI also provides a way to generate a secret key for your Better Auth instance.

npx @better-auth/cli@latest secret

License

MIT