[PR #5722] feat: async import in getAdapter #14426

Closed
opened 2026-04-13 09:28:10 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5722

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5722 **State:** closed **Merged:** Yes --- <!-- 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. -->
GiteaMirror added the pull-request label 2026-04-13 09:28:10 -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#14426