better-auth

Installation
Summary

Self-hosted TypeScript auth for Cloudflare Workers with OAuth, 2FA, passkeys, organizations, and 80+ production-ready endpoints.

  • Requires Drizzle ORM or Kysely for D1 (no direct adapter); use drizzleAdapter() or new Kysely({ dialect: new D1Dialect() }) with nodejs_compat flag in wrangler.toml
  • Provides 80+ auto-generated REST endpoints covering authentication, sessions, 2FA, organizations, admin operations, and social OAuth—zero endpoint code needed
  • Includes 15+ plugins: OAuth 2.1 Provider, SSO (SAML/OIDC), Stripe, Passkey, Magic Link, Email OTP, Anonymous, Bearer tokens, API keys, and more
  • Supports stateless JWT sessions, session caching via KV, rate limiting, database hooks, and fresh session enforcement; breaking changes in v1.4.0 (ESM-only) and v1.4.6 (admin impersonation disabled by default)
SKILL.md

better-auth - D1 Adapter & Error Prevention Guide

Package: better-auth@1.4.16 (Jan 21, 2026) Breaking Changes: ESM-only (v1.4.0), Admin impersonation prevention default (v1.4.6), Multi-team table changes (v1.3), D1 requires Drizzle/Kysely (no direct adapter)


⚠️ CRITICAL: D1 Adapter Requirement

better-auth DOES NOT have d1Adapter(). You MUST use:

  • Drizzle ORM (recommended): drizzleAdapter(db, { provider: "sqlite" })
  • Kysely: new Kysely({ dialect: new D1Dialect({ database: env.DB }) })

See Issue #1 below for details.


What's New in v1.4.10 (Dec 31, 2025)

Related skills
Installs
438
GitHub Stars
776
First Seen
Jan 20, 2026