Files
better-auth/packages/cli
Gustavo Valverde 28ccc8cda9 chore: resolve main-to-next sync conflicts
Conflicts resolved:
- docs/content/docs/plugins/2fa.mdx: kept next's OTP feature, applied main's exported const pattern
- docs/content/docs/plugins/oauth-provider.mdx: kept main's formatting, added back private_key_jwt docs
- docs/content/docs/plugins/sso.mdx: kept next's version with private_key_jwt and SAML options
- packages/sso/src/routes/sso.ts: kept next's version (has security fixes and private_key_jwt)
2026-04-10 19:11:05 +01:00
..
2026-04-09 15:19:07 +01:00
2026-04-09 15:19:07 +01:00
2026-02-15 07:44:50 +00: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 auth@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 auth@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 auth@latest migrate

Secret

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

npx auth@latest secret

License

MIT