Better Auth database adapter for @effect/sql, version 0.4.1. Integrates Better Auth authentication with Effect SQL ecosystem, supporting PostgreSQL, MySQL, and SQLite via @effect/sql-pg, @effect/sql-mysql2, and @effect/sql-sqlite-node. Released as a thin adapter that accepts an Effect Runtime to share the connection pool, avoiding manual lifecycle management. Supports all Better Auth adapter operations (create, findOne, findMany, update, delete, etc.) and handles database dialect differences like RETURNING clauses. Requires Effect v3.15+, Better Auth v1.2+, and Node.js 20+.
npm install better-auth-effectVerified import paths — ran on the pinned version, not inferred.
Sets up Better Auth with Effect SQL PostgreSQL adapter using Runtime injection, showing layer composition and ManagedRuntime usage.
Use import or set type: module in package.json. For CommonJS projects, use dynamic import: const { effectSqlAdapter } = await import('better-auth-effect')Use Effect.runtime<SqlClient>() inside a Layer or ManagedRuntime.make().runtime() to get the Runtime.
Ensure all database tables (user, account, session, verification) have an id column with auto-increment primary key.
Upgrade to v0.4+ and pass { runtime, dialect, debugLogs? } instead of previous SqlClient parameter.Use import { effectSqlAdapter } from 'better-auth-effect' with native ESM.Ensure runtime is obtained via Effect.runtime<SqlClient>() inside a Layer.
Use 'pg' for PostgreSQL, 'mysql' for MySQL, or 'sqlite' for SQLite.