Add --database option to CLI init #1270

Closed
opened 2026-03-13 08:30:45 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @tanosugi on GitHub (May 26, 2025).

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

I can't choose the location of the file where the db is exported in npx @better-auth/cli@latest init.

Describe the solution you'd like

How about adding the --database (or -db for short) option to npx @better-auth/cli@latest init
so that auth.ts can specify where to save the file to import the db?

Describe alternatives you've considered

modify mannually.

Additional context

how to use:

npx @better-auth/cli@latest init --database @/db

Following contents will be written on auth.js

import { db } from "@/db";

tsconfig.json:

"paths": {"@/*": ["./src/*"]}
Originally created by @tanosugi on GitHub (May 26, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I can't choose the location of the file where the db is exported in npx @better-auth/cli@latest init. ### Describe the solution you'd like How about adding the --database (or -db for short) option to npx @better-auth/cli@latest init so that auth.ts can specify where to save the file to import the db? ### Describe alternatives you've considered modify mannually. ### Additional context how to use: ``` npx @better-auth/cli@latest init --database @/db ``` Following contents will be written on auth.js ```typescript import { db } from "@/db"; ``` tsconfig.json: ``` "paths": {"@/*": ["./src/*"]} ```
Author
Owner

@tunnckoCore commented on GitHub (May 28, 2025):

the generate command have where the schema to be output, there you can set it to src/db

@tunnckoCore commented on GitHub (May 28, 2025): the generate command have where the schema to be output, there you can set it to src/db
Author
Owner

@Kinfe123 commented on GitHub (May 28, 2025):

We have pretty intuitive guides in the documentation that can help you add those configurations, so make sure to reference them and adjust them accordingly. However, we don’t plan to include this as part of the CLI for now

@Kinfe123 commented on GitHub (May 28, 2025): We have pretty intuitive guides in the documentation that can help you add those configurations, so make sure to reference them and adjust them accordingly. However, we don’t plan to include this as part of the CLI for now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1270