← ClaudeAtlas

better-auth-setuplisted

Production-ready Better Auth integration for fullstack projects. Covers both the backend (Bun + Hono + Drizzle + PostgreSQL) and the frontend reverse proxy architecture (Next.js, Cloudflare Workers, or any framework proxying auth requests to a separate backend). Sets up email/password auth, session cookies, OAuth providers (Google, GitHub), API key auth, organization/multi-tenant support, email verification, CORS, security headers, auth middleware, tenant context, proxy forwarding headers, dynamic baseURL with allowedHosts, cookie prefix handling, and test infrastructure — all in one pass with zero gotchas. Use this skill whenever setting up Better Auth, adding OAuth/social login, configuring a reverse proxy for auth, debugging redirect_uri_mismatch errors, fixing state_mismatch cookie issues, session cookies not persisting after OAuth callback, or when the user mentions Better Auth, OAuth proxy, auth setup, login, signup, session management, API keys, multi-tenant auth, or "session cookie not working".
fysoul17/devlyn-cli · ★ 1 · API & Backend · score 67
Install: claude install-skill fysoul17/devlyn-cli
# Better Auth Production Setup Set up a complete, production-hardened authentication system using Better Auth. This skill covers two deployment architectures: 1. **Backend-only** — Better Auth running directly in a Hono + Bun + Drizzle + PostgreSQL API server 2. **Fullstack with proxy** — A separate frontend (e.g., Next.js on Cloudflare Workers) that proxies auth requests to the backend The setup produces a dual-auth system: session cookies for browser users and API keys for programmatic access, with multi-tenant organization support and plan-based access control. Every configuration choice addresses a real production gotcha that caused hours of debugging. ## Reference Files Read these when each step directs you to them: - `${CLAUDE_SKILL_DIR}/references/schema.md` — Complete Drizzle schema (auth, org, API key tables) - `${CLAUDE_SKILL_DIR}/references/middleware.md` — Auth middleware, tenant context, types, error handler - `${CLAUDE_SKILL_DIR}/references/api-keys.md` — Key generation, CRUD routes, security patterns - `${CLAUDE_SKILL_DIR}/references/config-and-entry.md` — Env config, error types, entry point wiring - `${CLAUDE_SKILL_DIR}/references/testing.md` — Test preload, seed factory, integration patterns - `${CLAUDE_SKILL_DIR}/references/proxy-setup.md` — Reverse proxy architecture, forwarding headers, OAuth callback routing - `${CLAUDE_SKILL_DIR}/references/proxy-gotchas.md` — Proxy-specific troubleshooting (redirect_uri_mismatch, state_mismatch, cookie prefix iss