[GH-ISSUE #874] [CLI] Custom path to tsconfig #25800

Closed
opened 2026-04-17 16:03:59 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @draylegend on GitHub (Dec 13, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/874

Given

nx workspace with Angular, Elysia and tsconfig.base.json in the root of the project.

Issue

Can't generate schema.prisma because of missing tsconfig.json.

Solutions:

  • Add an option like --tsConfig or --ts-config to specify the path to a custom TypeScript config.
    bunx @better-auth/cli generate --config libs/core/api/src/lib/auth.ts --ts-config tsconfig.base.json

  • Alternatively, allow a better-auth.config.ts file in the project root to manage configurations.

    // better-auth.config.ts
    
    import { defineConfig } from '@better-auth/cli';
    
    export default defineConfig({
      config: 'libs/core/api/src/lib/auth.ts', // or even better `@my-company/core/api`. Assuming auth is exported.
      tsConfig: 'tsconfig.base.json',
    });
    

    bunx @better-auth/cli generate would use the config defined above.

Upd. actually it does generate when the auth.ts is provided. Nevertheless it would be great to setup everything related to CLI in the auth-better.config.ts (or similar) file.

Originally created by @draylegend on GitHub (Dec 13, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/874 ### Given nx workspace with Angular, Elysia and `tsconfig.base.json` in the root of the project. ### Issue Can't generate `schema.prisma` because of missing `tsconfig.json`. ### Solutions: * Add an option like `--tsConfig` or `--ts-config` to specify the path to a custom TypeScript config. `bunx @better-auth/cli generate --config libs/core/api/src/lib/auth.ts --ts-config tsconfig.base.json` * Alternatively, allow a `better-auth.config.ts` file in the project root to manage configurations. ```ts // better-auth.config.ts import { defineConfig } from '@better-auth/cli'; export default defineConfig({ config: 'libs/core/api/src/lib/auth.ts', // or even better `@my-company/core/api`. Assuming auth is exported. tsConfig: 'tsconfig.base.json', }); ``` `bunx @better-auth/cli generate` would use the config defined above. Upd. actually it does generate when the `auth.ts` is provided. Nevertheless it would be great to setup everything related to CLI in the `auth-better.config.ts` (or similar) file.
GiteaMirror added the lockedenhancement labels 2026-04-17 16:04:00 -05:00
Author
Owner

@BayBreezy commented on GitHub (Dec 13, 2024):

I think a config file for betterAuth would be great for real.

<!-- gh-comment-id:2542103237 --> @BayBreezy commented on GitHub (Dec 13, 2024): I think a config file for betterAuth would be great for real.
Author
Owner

@draylegend commented on GitHub (Dec 18, 2024):

found a similar issue #794

<!-- gh-comment-id:2551651136 --> @draylegend commented on GitHub (Dec 18, 2024): found a similar issue #794
Author
Owner

@draylegend commented on GitHub (Dec 18, 2024):

Upd. actually it does generate when the auth.ts is provided. Nevertheless it would be great to setup everything related to CLI in the auth-better.config.ts (or similar) file.

<!-- gh-comment-id:2551661196 --> @draylegend commented on GitHub (Dec 18, 2024): Upd. actually it does generate when the `auth.ts` is provided. Nevertheless it would be great to setup everything related to CLI in the `auth-better.config.ts` (or similar) file.
Author
Owner

@draylegend commented on GitHub (Jan 31, 2025):

I don't need maps for none of the models, so it'd be great to set it in the config to mapModels: false (or similar) as well

<!-- gh-comment-id:2627715580 --> @draylegend commented on GitHub (Jan 31, 2025): I don't need maps for none of the models, so it'd be great to set it in the config to `mapModels: false` (or similar) as well
Author
Owner

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

we have added a minimal config flags there in cli but for the rest of them it should be intuitive enough to move things around and make it works.

<!-- gh-comment-id:2923316240 --> @Kinfe123 commented on GitHub (May 30, 2025): we have added a minimal config flags there in cli but for the rest of them it should be intuitive enough to move things around and make it works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25800