Better Auth's own configuration file #1341

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

Originally created by @sovetski on GitHub (Jun 11, 2025).

Is this suited for github?

  • Yes, this is suited for github

Currently, it's not possible to specify the path to the auth.js file. By default, it looks in the root directory, or in the lib or utils folders, as explained in the documentation. However, sometimes we need to organize files differently, and having this path hardcoded limits flexibility (even if it’s not a major issue).

Another problem is related to the npx @better-auth/cli generate command. It defaults to using ./prisma/schema.prisma, but in a monorepo setup, the Prisma schema is often located elsewhere. With the current setup, you have to manually copy and paste the changes after running the generate command.

Describe the solution you'd like

I think Better Auth should have a separate configuration file, such as better-auth.config.js, which could be placed at the root, in a /config folder, or elsewhere.

Describe alternatives you've considered

I know that we have the parameters to pass to the CLI like explained here: https://www.better-auth.com/docs/concepts/cli

But a config file is much better

Additional context

No response

Originally created by @sovetski on GitHub (Jun 11, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently, it's not possible to specify the path to the auth.js file. By default, it looks in the root directory, or in the lib or utils folders, as explained in the documentation. However, sometimes we need to organize files differently, and having this path hardcoded limits flexibility (even if it’s not a major issue). Another problem is related to the npx @better-auth/cli generate command. It defaults to using ./prisma/schema.prisma, but in a monorepo setup, the Prisma schema is often located elsewhere. With the current setup, you have to manually copy and paste the changes after running the generate command. ### Describe the solution you'd like I think Better Auth should have a separate configuration file, such as better-auth.config.js, which could be placed at the root, in a /config folder, or elsewhere. ### Describe alternatives you've considered I know that we have the parameters to pass to the CLI like explained here: https://www.better-auth.com/docs/concepts/cli But a config file is much better ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 08:33:56 -05:00
Author
Owner

@ctrhub commented on GitHub (Jun 18, 2025):

Hey @sovetski. I randomly came here and maybe this could help you:

"db:auth:generate": "npx @better-auth/cli generate --y --config=./src/backend/lib/auth.tsx --output=./src/backend/schemas/drizzle/better-auth.schema.ts",

This is how i approached the issue. Hope this is relevant to your problem.

@ctrhub commented on GitHub (Jun 18, 2025): Hey @sovetski. I randomly came here and maybe this could help you: ``` "db:auth:generate": "npx @better-auth/cli generate --y --config=./src/backend/lib/auth.tsx --output=./src/backend/schemas/drizzle/better-auth.schema.ts", ``` This is how i approached the issue. Hope this is relevant to your problem.
Author
Owner

@ping-maxwell commented on GitHub (Jul 1, 2025):

We have had some thought about this in the past, but we don't want to confuse new users since at this point there would be three separate auth related configs

Using the CLI you can already specify the paths, like @ctrhub said, this should suffice.

@ping-maxwell commented on GitHub (Jul 1, 2025): We have had some thought about this in the past, but we don't want to confuse new users since at this point there would be three separate auth related configs Using the CLI you can already specify the paths, like @ctrhub said, this should suffice.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1341