README
Better Auth 是一个认证框架。它开箱即用地提供完整的功能集,并拥有插件生态,能更轻松地扩展高级能力和基础设施,帮助你在大规模场景下掌控自己的认证系统。
npx auth initimport { betterAuth } from "better-auth"export const auth = betterAuth({ emailAndPassword: { enabled: true, }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET!, }, github: { clientId: process.env.GITHUB_CLIENT_ID!, clientSecret: process.env.GITHUB_CLIENT_SECRET!, }, }, plugins: [ twoFactor(), passkey(), organization(), ],})使用任何你想要的数据库。可以直接通过连接字符串连接,或者使用你喜欢的 ORM 适配器。你的数据会保留在你的数据库中。
Your auth lives in your codebase — so AI can configure it. Ships with MCP server, Claude Code skills, and Cursor rules.
Cursor
npx @better-auth/cli mcp --cursorClaude Code
claude mcp add better-authOpen Code
npx @better-auth/cli mcp --open-codesocial providers
Managed infrastructure on top of the open-source framework.
User management and monitoring platform.
Monitor sign-ups, manage users, track sessions, and surface security insights — with an agentic Cmd+K to do it all in natural language.
Audit Logs
Every auth event captured automatically — sign-ins, password resets, MFA challenges, session changes, and more. Filter, search, and export with configurable retention and log drain to your SIEM.
Transactional Comms
Built-in email and SMS delivery for verification codes, magic links, password resets, and MFA. Customizable templates, abuse protection, and delivery tracking — no third-party setup required.
为你的应用提供安全基础设施。
机器人检测、暴力破解防护、临时邮箱拦截、地理位置限制等能力,都会在威胁触达用户之前实时生效。
Explore plans
Dashboard, audit logs, security detection, transactional comms, and more.
由超过 746+ 位贡献者共同打造。