Goal
Add a Kysely ORM adapter alongside the existing Drizzle adapter. Kysely is the ORM better-auth uses internally, making this a native integration path.
Blocked by: better-auth 1.6 upgrade evaluation (may change the integration surface)
Subpath Exports
| Subpath |
What |
./kysely |
Adapter barrel |
./kysely/schema/sqlite |
Audit log table definition (Kysely createTable) |
./kysely/schema/pg |
PostgreSQL variant |
./kysely/schema/mysql |
MySQL variant |
./kysely/soft-delete/sqlite |
Soft-delete column helpers |
./kysely/soft-delete/pg |
PG variant |
./kysely/soft-delete/mysql |
MySQL variant |
Adapter Must Implement
- Query filters: notDeleted, onlyDeleted, includingDeleted (Kysely query builder)
- Automatic soft-delete: interceptor that converts delete to update
- Audit logging: insert audit entries via Kysely
- Audit query: getRecordHistory via Kysely
- GDPR purge: purgeUserData via Kysely query builder
- Schema definitions: audit log table per dialect
Design Constraints
- Core types, context, pure helpers come from
@rafters/ledger (no duplication)
- Follow the same pattern as
src/drizzle/ -- same file structure, same exports shape
- Kysely is an optional peer dependency
- Tests in
test/kysely/ mirroring test/drizzle/
Out of Scope
- Prisma adapter (evaluate if demand exists)
- Changes to core
- better-auth plugin changes (evaluate after 1.6)
Complete When
All Drizzle adapter functionality has a Kysely equivalent. Tests pass. Docs updated with Kysely examples.
Goal
Add a Kysely ORM adapter alongside the existing Drizzle adapter. Kysely is the ORM better-auth uses internally, making this a native integration path.
Blocked by: better-auth 1.6 upgrade evaluation (may change the integration surface)
Subpath Exports
./kysely./kysely/schema/sqlite./kysely/schema/pg./kysely/schema/mysql./kysely/soft-delete/sqlite./kysely/soft-delete/pg./kysely/soft-delete/mysqlAdapter Must Implement
Design Constraints
@rafters/ledger(no duplication)src/drizzle/-- same file structure, same exports shapetest/kysely/mirroringtest/drizzle/Out of Scope
Complete When
All Drizzle adapter functionality has a Kysely equivalent. Tests pass. Docs updated with Kysely examples.