[PR #5722] [MERGED] feat: async import in getAdapter #6179

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5722
Author: @himself65
Created: 11/2/2025
Status: Merged
Merged: 11/2/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/31/async-import-2


📝 Commits (1)

  • 7ad1206 feat: async import in getAdapter

📊 Changes

1 file changed (+4 additions, -3 deletions)

View changed files

📝 packages/better-auth/src/db/utils.ts (+4 -3)

📄 Description

Summary by cubic

Lazy-load database adapters and drivers to avoid loading unused DB code and optional peer errors. This reduces bundle size and prevents runtime issues when pg/mysql/mongodb are not installed.

  • Refactors
    • getAdapter now dynamically imports memoryAdapter, createKyselyAdapter, and kyselyAdapter.
    • Test utils lazily import Kysely, dialects, sql, MongoClient, and connection pools only when needed.
    • Consolidated DB imports via ../db and switched client import to ../client.
    • Postgres/MySQL teardown now uses lazy sql and per-DB instance creation.

Written for commit 7ad12063bd. 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/5722 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/2/2025 **Status:** ✅ Merged **Merged:** 11/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/31/async-import-2` --- ### 📝 Commits (1) - [`7ad1206`](https://github.com/better-auth/better-auth/commit/7ad12063bd4b178f2bc5b83e179b33e028dbef9c) feat: async import in `getAdapter` ### 📊 Changes **1 file changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/utils.ts` (+4 -3) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Lazy-load database adapters and drivers to avoid loading unused DB code and optional peer errors. This reduces bundle size and prevents runtime issues when pg/mysql/mongodb are not installed. - **Refactors** - getAdapter now dynamically imports memoryAdapter, createKyselyAdapter, and kyselyAdapter. - Test utils lazily import Kysely, dialects, sql, MongoClient, and connection pools only when needed. - Consolidated DB imports via ../db and switched client import to ../client. - Postgres/MySQL teardown now uses lazy sql and per-DB instance creation. <sup>Written for commit 7ad12063bd4b178f2bc5b83e179b33e028dbef9c. 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:50:14 -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#6179