[GH-ISSUE #7073] feat: export schema generators for external use #10721

Closed
opened 2026-04-13 07:01:54 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @onmax on GitHub (Dec 31, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7073

Problem

External projects need to generate Drizzle/Prisma schemas programmatically. Currently getAuthTables() is exported but the generators in @better-auth/cli/src/generators/ are internal.

Use Case

nuxt-better-auth auto-generates Drizzle schemas for NuxtHub. Currently reimplements the generator instead of using the CLI's version.

Proposal

Export generator functions:

import { generateDrizzleSchema } from 'better-auth/generators'

Single source of truth, bugs fixed once.

Happy to contribute if this sounds reasonable. Open to other alternatives!

Originally created by @onmax on GitHub (Dec 31, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7073 ### Problem External projects need to generate Drizzle/Prisma schemas programmatically. Currently `getAuthTables()` is exported but the generators in `@better-auth/cli/src/generators/` are internal. ### Use Case [nuxt-better-auth](https://github.com/onmax/nuxt-better-auth) auto-generates Drizzle schemas for NuxtHub. Currently [reimplements the generator](https://github.com/onmax/nuxt-better-auth/blob/main/src/schema-generator.ts) instead of using the CLI's version. ### Proposal Export generator functions: ```ts import { generateDrizzleSchema } from 'better-auth/generators' ``` Single source of truth, bugs fixed once. Happy to contribute if this sounds reasonable. Open to other alternatives!
GiteaMirror added the enhancementlocked labels 2026-04-13 07:01:54 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 31, 2025):

It sounds like you are interested in proposing the export of generator functions for external use in Better Auth, which would help projects like nuxt-better-auth generate Drizzle schemas programmatically. Currently, exporting the generators from @better-auth/cli/src/generators/ isn't possible as they're internal, which has led to some workarounds by users.

There are also discussions in the community about similar needs, indicating a general interest in making these generators available for better integration with external projects. Your proposal to export functions like generateDrizzleSchema could provide a solution to the issue faced by users.

If you are happy to contribute to this feature, that would be fantastic! It would be a great way to benefit the community. Make sure to follow the contribution guidelines when submitting your proposal.

Would you like assistance with any specific implementation details or next steps?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3702583122 --> @better-auth-agent[bot] commented on GitHub (Dec 31, 2025): It sounds like you are interested in proposing the export of generator functions for external use in Better Auth, which would help projects like `nuxt-better-auth` generate Drizzle schemas programmatically. Currently, exporting the generators from `@better-auth/cli/src/generators/` isn't possible as they're internal, which has led to some workarounds by users. There are also discussions in the community about similar needs, indicating a general interest in making these generators available for better integration with external projects. Your proposal to export functions like `generateDrizzleSchema` could provide a solution to the issue faced by users. If you are happy to contribute to this feature, that would be fantastic! It would be a great way to benefit the community. Make sure to follow the contribution guidelines when submitting your proposal. Would you like assistance with any specific implementation details or next steps? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@onmax commented on GitHub (Dec 31, 2025):

Related issues:

  • #6231 - Schema generation fails with external models (would benefit from single source)
  • #6606 - CLI generate with pgSchema support (external projects could inherit improvements)
  • #5609 - Expose test utils (similar pattern of exposing internals)
<!-- gh-comment-id:3702585919 --> @onmax commented on GitHub (Dec 31, 2025): Related issues: - #6231 - Schema generation fails with external models (would benefit from single source) - #6606 - CLI generate with pgSchema support (external projects could inherit improvements) - #5609 - Expose test utils (similar pattern of exposing internals)
Author
Owner

@bytaesu commented on GitHub (Jan 1, 2026):

We could consider exposing these under @better-auth/cli/api, similar to drizzle-kit.
https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-kit/package.json#L132

cc @ping-maxwell

<!-- gh-comment-id:3703540565 --> @bytaesu commented on GitHub (Jan 1, 2026): We could consider exposing these under `@better-auth/cli/api`, similar to drizzle-kit. https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-kit/package.json#L132 cc @ping-maxwell
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10721