Files
better-auth/packages/cli/README.md
2026-01-04 01:28:36 +08:00

49 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.
```bash title="terminal"
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.
```bash title="terminal"
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.
```bash title="terminal"
npx @better-auth/cli@latest migrate
```
### **Secret**
The CLI also provides a way to generate a secret key for your Better Auth
instance.
```bash title="terminal"
npx @better-auth/cli@latest secret
```
## License
MIT