[PR #5704] [MERGED] feat: better-auth/minimal #6167

Closed
opened 2026-03-13 12:49:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5704
Author: @bytaesu
Created: 10/31/2025
Status: Merged
Merged: 11/11/2025
Merged by: @Bekacru

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


📝 Commits (10+)

  • 87bc067 feat: add better-auth/minimal and restructure the project
  • 8a69ded fix: restore
  • 11f7f71 fix: add missing typesVersions
  • fd3cfbf fix: use updated context in createInternalAdapter
  • 6e6671c fix: cleanup comment
  • 4a0b176 fix: esm only
  • eb3df44 test: drop async from describe
  • ed41f04 fix: replace dynamic import type with AuthContext in initFn
  • 9e0b08a refactor: cleanup imports
  • 254fc32 refactor: revert imports

📊 Changes

31 files changed (+2034 additions, -518 deletions)

View changed files

📝 docs/content/docs/guides/optimizing-for-performance.mdx (+61 -0)
📝 packages/better-auth/package.json (+8 -0)
📝 packages/better-auth/src/api/to-auth-endpoints.test.ts (+1 -1)
📝 packages/better-auth/src/auth/auth.test.ts (+2 -1)
packages/better-auth/src/auth/auth.ts (+17 -0)
📝 packages/better-auth/src/auth/base.ts (+7 -34)
packages/better-auth/src/auth/index.ts (+1 -0)
packages/better-auth/src/auth/minimal.test.ts (+64 -0)
packages/better-auth/src/auth/minimal.ts (+15 -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__/base.test.ts.snap (+9 -18)
packages/better-auth/src/context/base.test.ts (+1428 -0)
📝 packages/better-auth/src/context/base.ts (+32 -105)
packages/better-auth/src/context/helpers.ts (+83 -0)
packages/better-auth/src/context/init-minimal.test.ts (+44 -0)
packages/better-auth/src/context/init-minimal.ts (+28 -0)
packages/better-auth/src/context/init.test.ts (+59 -0)
packages/better-auth/src/context/init.ts (+31 -0)
packages/better-auth/src/db/adapter-base.ts (+43 -0)

...and 11 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

Introduce better-auth/minimal to use adapter-based auth without Kysely, reducing bundle size. Also split context and DB adapter setup to support both minimal and full (Kysely) implementations; migrations only available in the full build.

  • New Features

    • New export: better-auth/minimal with betterAuth using initMinimal.
    • Minimal mode disallows migrations and direct DB connections (clear errors).
    • Adapter selection without Kysely via getBaseAdapter; memory adapter used by default.
    • Package exports and typesVersions updated; build entry added for auth-minimal.
  • Refactors

    • Introduced createAuthContext base; separate init (Kysely) and init-minimal.
    • Replaced db/utils with adapter-base, adapter-kysely, and field-converter.
    • Auth factory split: createBetterAuth with shared logic; Auth type moved to types/auth.
    • Plugin helpers extracted to context/helpers; imports updated to new context index; tests adjusted to new paths.

Written for commit 62ece0c20f. 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/5704 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 10/31/2025 **Status:** ✅ Merged **Merged:** 11/11/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2025-10-31/feat/better-auth-minimal-clean` --- ### 📝 Commits (10+) - [`87bc067`](https://github.com/better-auth/better-auth/commit/87bc067dce191ba0179544a1fad17a4e24599f7b) feat: add better-auth/minimal and restructure the project - [`8a69ded`](https://github.com/better-auth/better-auth/commit/8a69deddcb3a1c15b6dbd84332fa75cbb844fbfb) fix: restore - [`11f7f71`](https://github.com/better-auth/better-auth/commit/11f7f71fee9f2dfeb02931d49868f2800485e9bf) fix: add missing typesVersions - [`fd3cfbf`](https://github.com/better-auth/better-auth/commit/fd3cfbf3639a0667b77072bc69adeaf06898e42f) fix: use updated context in createInternalAdapter - [`6e6671c`](https://github.com/better-auth/better-auth/commit/6e6671cd7f6acc771621519e49e706de1249c526) fix: cleanup comment - [`4a0b176`](https://github.com/better-auth/better-auth/commit/4a0b176d88cbe41a87e7d573558cf5193b92c457) fix: esm only - [`eb3df44`](https://github.com/better-auth/better-auth/commit/eb3df441a063ff128a867f14b24ad73c147887f2) test: drop async from describe - [`ed41f04`](https://github.com/better-auth/better-auth/commit/ed41f049fb3a6a4b12df9b7c426597d404f415b9) fix: replace dynamic import type with AuthContext in initFn - [`9e0b08a`](https://github.com/better-auth/better-auth/commit/9e0b08aa9101eb1c3dc693e011a27f109cb7fe14) refactor: cleanup imports - [`254fc32`](https://github.com/better-auth/better-auth/commit/254fc3270998430a2ab051474281ceb63292e935) refactor: revert imports ### 📊 Changes **31 files changed** (+2034 additions, -518 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/guides/optimizing-for-performance.mdx` (+61 -0) 📝 `packages/better-auth/package.json` (+8 -0) 📝 `packages/better-auth/src/api/to-auth-endpoints.test.ts` (+1 -1) 📝 `packages/better-auth/src/auth/auth.test.ts` (+2 -1) ➕ `packages/better-auth/src/auth/auth.ts` (+17 -0) 📝 `packages/better-auth/src/auth/base.ts` (+7 -34) ➕ `packages/better-auth/src/auth/index.ts` (+1 -0) ➕ `packages/better-auth/src/auth/minimal.test.ts` (+64 -0) ➕ `packages/better-auth/src/auth/minimal.ts` (+15 -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__/base.test.ts.snap` (+9 -18) ➕ `packages/better-auth/src/context/base.test.ts` (+1428 -0) 📝 `packages/better-auth/src/context/base.ts` (+32 -105) ➕ `packages/better-auth/src/context/helpers.ts` (+83 -0) ➕ `packages/better-auth/src/context/init-minimal.test.ts` (+44 -0) ➕ `packages/better-auth/src/context/init-minimal.ts` (+28 -0) ➕ `packages/better-auth/src/context/init.test.ts` (+59 -0) ➕ `packages/better-auth/src/context/init.ts` (+31 -0) ➕ `packages/better-auth/src/db/adapter-base.ts` (+43 -0) _...and 11 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 Introduce better-auth/minimal to use adapter-based auth without Kysely, reducing bundle size. Also split context and DB adapter setup to support both minimal and full (Kysely) implementations; migrations only available in the full build. - **New Features** - New export: better-auth/minimal with betterAuth using initMinimal. - Minimal mode disallows migrations and direct DB connections (clear errors). - Adapter selection without Kysely via getBaseAdapter; memory adapter used by default. - Package exports and typesVersions updated; build entry added for auth-minimal. - **Refactors** - Introduced createAuthContext base; separate init (Kysely) and init-minimal. - Replaced db/utils with adapter-base, adapter-kysely, and field-converter. - Auth factory split: createBetterAuth with shared logic; Auth type moved to types/auth. - Plugin helpers extracted to context/helpers; imports updated to new context index; tests adjusted to new paths. <sup>Written for commit 62ece0c20f515e342806d36443751794c8e99a52. 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-03-13 12:49:55 -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#6167