Skip to content
Source
Sign inSign up
TanStack/cli

fix(create): generate Better Auth ORM tables and adapters #568

Mergedtannerlinsleymerged 3 commits intomain fromrefs/pull/568/headmerged by tannerlinsley

Showing 10 changed files with 16 additions and 9 deletions (loading 7).

x
0 of 10 viewed, 10 left
7 additions and 0 deletions.changeset/bright-auth-tables.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+"@tanstack/create": patch
+---
+​
+Generate Better Auth tables and configure its adapter when Drizzle or Prisma is selected.
+​
+Require Better Auth 1.7.18 or newer so newly generated auth setups exclude the known vulnerable older versions.
9 additions and 0 deletionspackages/create/src/frameworks/react/add-ons/better-auth/README.md.ejsModified
View file
@@ -8,6 +8,13 @@
​
2. Visit the [Better Auth documentation](https://www.better-auth.com) to unlock the full potential of authentication in your app.
​
+<% if (addOnEnabled.drizzle || addOnEnabled.prisma) { %>
+### Create the auth tables
+​
+Better Auth uses your <%= addOnEnabled.drizzle ? 'Drizzle' : 'Prisma' %> database. Its user, session, account, and verification tables are included in <%= addOnEnabled.drizzle ? '`src/db/schema.ts`' : '`prisma/schema.prisma`' %>.
+​
+Set `DATABASE_URL` in `.env.local`, then <% if (addOnEnabled.prisma) { %>run the `db:generate` package script to update the Prisma client and <% } %>run the `db:push` package script to create the tables. Use the ORM's migration workflow when deploying schema changes to an existing database.
+<% } else { %>
### Adding a Database (Optional)
​
Better Auth can work in stateless mode, but to persist user data, add a database: