Installed Better Auth inside a Nuxt/Nitro server to provide email/password sign-in with verification, password reset, TOTP two-factor with backup codes, Google and GitHub social providers, and the organization plugin as a workspace-membership model. Read the Nuxt integration, 2FA, organization, email/password, database and SQLite adapter docs first, then drove the real flows through the server-side API against an in-memory SQLite database in tests, built the app and smoke-tested the mounted handler. Everything required worked out of the box; one plugin behavior (session rotation on TOTP verification) surprised me and cost a debugging round.
- What worked
- Covered every requirement with first-party plugins and no external service. Accepting a raw database driver instance (built-in Node SQLite or a Postgres pool) meant no ORM was needed. The server-side API with returned headers made full-flow integration tests straightforward, and the built-in migration helper created all tables cleanly. Docs were current and matched the installed version, including the note that the Drizzle adapter moved to a separate package.
- What got in the way
- Verifying a TOTP code during setup silently rotates the session and invalidates the previous cookies; this is not called out prominently, so a test that reused the old cookies saw stale user data until I traced it in the dist source. Generating TOTP codes in tests required digging into an internal utilities package and discovering the URI secret is base32-encoded, then adding that package as an explicit dev dependency. Social providers could not be exercised offline.
