[PR #5690] [CLOSED] feat: add better-auth/minimal #31762

Closed
opened 2026-04-17 22:38:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5690
Author: @bytaesu
Created: 10/31/2025
Status: Closed

Base: canaryHead: 2025-10-31/feat/better-auth-minimal


📝 Commits (10+)

  • 75993e0 feat: add better-auth/minimal and restructure the project
  • a1fb27e fix: restore
  • 2af71df fix: add missing typesVersions
  • 82532e2 fix: use updated context in createInternalAdapter
  • 6d7e3bb fix: type mismatch for 'banned' on UserWithRole (#5701)
  • c6241f2 fix: delete duplicate email existence check in changeEmail endpoint (#5699)
  • c4890c8 fix(adapters): mongodb id issue (#5686)
  • b697739 feat: esm only (#5703)
  • 1e7f4d3 fix: cleanup comment
  • 7c4d7b5 fix: esm only

📊 Changes

48 files changed (+828 additions, -806 deletions)

View changed files

📝 packages/better-auth/package.json (+110 -408)
📝 packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts (+51 -5)
📝 packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (+38 -28)
📝 packages/better-auth/src/adapters/tests/normal.ts (+42 -0)
📝 packages/better-auth/src/api/routes/update-user.ts (+2 -9)
📝 packages/better-auth/src/api/to-auth-endpoints.test.ts (+1 -1)
packages/better-auth/src/auth/auth-minimal.test.ts (+64 -0)
packages/better-auth/src/auth/auth-minimal.ts (+12 -0)
📝 packages/better-auth/src/auth/auth.test.ts (+2 -1)
packages/better-auth/src/auth/auth.ts (+12 -0)
📝 packages/better-auth/src/auth/base.ts (+8 -35)
packages/better-auth/src/auth/index.ts (+1 -0)
📝 packages/better-auth/src/call.test.ts (+1 -1)
📝 packages/better-auth/src/client/types.ts (+1 -2)
📝 packages/better-auth/src/context/__snapshots__/init.test.ts.snap (+0 -0)
📝 packages/better-auth/src/context/base.ts (+32 -105)
packages/better-auth/src/context/helpers.ts (+83 -0)
packages/better-auth/src/context/index.ts (+2 -0)
packages/better-auth/src/context/init-minimal.test.ts (+51 -0)
packages/better-auth/src/context/init-minimal.ts (+31 -0)

...and 28 more files

📄 Description

This PR introduces better-auth/minimal, which is aimed at reducing bundle size when Kysely is not used. Additionally, the project structure has been modified to remove Kysely.


Summary by cubic

Add a Kysely-free build at better-auth/minimal to cut bundle size when you use adapters instead of direct DB connections. The default better-auth build stays the same and supports migrations and Kysely; all packages are now ESM-only.

  • New Features

    • New entrypoint better-auth/minimal exporting betterAuth without Kysely or migrations (runMigrations throws).
    • Minimal requires an adapter and rejects direct DB connections; default better-auth keeps Kysely and migrations.
    • Split init paths (init, initMinimal) with shared createAuthContext and adapter helpers (getAdapterWithKysely / getAdapterWithoutKysely).
    • ESM-only builds across packages with simplified exports.
  • Bug Fixes

    • MongoDB adapter: correct ObjectId handling for gt/gte/lt/lte/ne and null/undefined IDs.
    • Prisma adapter: handle ne with null and in/not_in with nulls; avoid empty-in edge case.
    • changeEmail: remove duplicate email existence check; return UNPROCESSABLE_ENTITY with a specific error code.
    • Admin types: fix UserWithRole.banned type.

Written for commit da16fde3c7. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5690 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 10/31/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `2025-10-31/feat/better-auth-minimal` --- ### 📝 Commits (10+) - [`75993e0`](https://github.com/better-auth/better-auth/commit/75993e04d90f24ab6849d8cea78ed53a4f915d99) feat: add better-auth/minimal and restructure the project - [`a1fb27e`](https://github.com/better-auth/better-auth/commit/a1fb27e5861693e46aeaca2f3f7cfdb2e707c71c) fix: restore - [`2af71df`](https://github.com/better-auth/better-auth/commit/2af71df03111552ebffd3a13e8febda641dd0303) fix: add missing typesVersions - [`82532e2`](https://github.com/better-auth/better-auth/commit/82532e259b833fcd609b1f6f99cca8e54f15440c) fix: use updated context in createInternalAdapter - [`6d7e3bb`](https://github.com/better-auth/better-auth/commit/6d7e3bb3f59edb97091c7a99b31979c312dd5557) fix: type mismatch for 'banned' on UserWithRole (#5701) - [`c6241f2`](https://github.com/better-auth/better-auth/commit/c6241f26b5f779ad17fe597022853e0f3d790a67) fix: delete duplicate email existence check in changeEmail endpoint (#5699) - [`c4890c8`](https://github.com/better-auth/better-auth/commit/c4890c813e360b1f3d1d2f978e9543821af662d6) fix(adapters): mongodb id issue (#5686) - [`b697739`](https://github.com/better-auth/better-auth/commit/b69773910aee728e66cc835d1954b556ae7174f1) feat: esm only (#5703) - [`1e7f4d3`](https://github.com/better-auth/better-auth/commit/1e7f4d3e2e51f0effe61dd41b6de29a302fa8995) fix: cleanup comment - [`7c4d7b5`](https://github.com/better-auth/better-auth/commit/7c4d7b5a772b0aa1b48e76b4059cb58f1e5ae0be) fix: esm only ### 📊 Changes **48 files changed** (+828 additions, -806 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/package.json` (+110 -408) 📝 `packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts` (+51 -5) 📝 `packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts` (+38 -28) 📝 `packages/better-auth/src/adapters/tests/normal.ts` (+42 -0) 📝 `packages/better-auth/src/api/routes/update-user.ts` (+2 -9) 📝 `packages/better-auth/src/api/to-auth-endpoints.test.ts` (+1 -1) ➕ `packages/better-auth/src/auth/auth-minimal.test.ts` (+64 -0) ➕ `packages/better-auth/src/auth/auth-minimal.ts` (+12 -0) 📝 `packages/better-auth/src/auth/auth.test.ts` (+2 -1) ➕ `packages/better-auth/src/auth/auth.ts` (+12 -0) 📝 `packages/better-auth/src/auth/base.ts` (+8 -35) ➕ `packages/better-auth/src/auth/index.ts` (+1 -0) 📝 `packages/better-auth/src/call.test.ts` (+1 -1) 📝 `packages/better-auth/src/client/types.ts` (+1 -2) 📝 `packages/better-auth/src/context/__snapshots__/init.test.ts.snap` (+0 -0) 📝 `packages/better-auth/src/context/base.ts` (+32 -105) ➕ `packages/better-auth/src/context/helpers.ts` (+83 -0) ➕ `packages/better-auth/src/context/index.ts` (+2 -0) ➕ `packages/better-auth/src/context/init-minimal.test.ts` (+51 -0) ➕ `packages/better-auth/src/context/init-minimal.ts` (+31 -0) _...and 28 more files_ </details> ### 📄 Description This PR introduces `better-auth/minimal`, which is aimed at reducing bundle size when Kysely is not used. Additionally, the project structure has been modified to remove Kysely. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a Kysely-free build at better-auth/minimal to cut bundle size when you use adapters instead of direct DB connections. The default better-auth build stays the same and supports migrations and Kysely; all packages are now ESM-only. - **New Features** - New entrypoint better-auth/minimal exporting betterAuth without Kysely or migrations (runMigrations throws). - Minimal requires an adapter and rejects direct DB connections; default better-auth keeps Kysely and migrations. - Split init paths (init, initMinimal) with shared createAuthContext and adapter helpers (getAdapterWithKysely / getAdapterWithoutKysely). - ESM-only builds across packages with simplified exports. - **Bug Fixes** - MongoDB adapter: correct ObjectId handling for gt/gte/lt/lte/ne and null/undefined IDs. - Prisma adapter: handle ne with null and in/not_in with nulls; avoid empty-in edge case. - changeEmail: remove duplicate email existence check; return UNPROCESSABLE_ENTITY with a specific error code. - Admin types: fix UserWithRole.banned type. <sup>Written for commit da16fde3c71dd28e853d05034d60f9d434b9500e. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:38:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#31762