介绍
Better Auth 是一个与框架无关的、通用的 TypeScript 身份验证和授权框架。它开箱即用地提供了全面的功能,并包含一个插件生态系统,使添加高级功能变得简单。无论你需要双因素认证(2FA)、密码密钥、多租户、多会话支持,甚至企业功能如单点登录(SSO)或创建自己的身份提供者(IDP),它都能让你专注于构建应用,而不是重复造轮子。
🌐 Better Auth is a framework-agnostic, universal authentication and authorization framework for TypeScript. It provides a comprehensive set of features out of the box and includes a plugin ecosystem that simplifies adding advanced functionalities. Whether you need 2FA, passkey, multi-tenancy, multi-session support, or even enterprise features like SSO, creating your own IDP, it lets you focus on building your application instead of reinventing the wheel.
特性
🌐 Features
Better Auth 的目标是成为最全面的认证库。它开箱即用地提供了广泛的功能,并允许你通过插件进行扩展。以下是一些功能:
🌐 Better Auth aims to be the most comprehensive auth library. It provides a wide range of features out of the box and allows you to extend it with plugins. Here are some of the features:
框架无关
支持大多数流行框架
电子邮箱和密码
内置支持安全的电子邮件和密码认证
账户与会话管理
轻松管理用户账户和会话
内置速率限制器
内置速率限制器,支持自定义规则
自动数据库管理
自动数据库管理与迁移
社交登录
多社交登录提供商
组织与访问控制
管理组织和访问控制
两步验证
通过双因素认证保护你的用户
插件生态系统
通过插件获得更多功能
...以及更多!
人工智能工具
🌐 AI tooling
大型语言模型.txt
🌐 LLMs.txt
Better Auth 提供了一个 LLMs.txt 文件,帮助 AI 模型理解如何集成和与你的身份验证系统互动。可以在 https://better-auth.com/llms.txt 查看。
🌐 Better Auth exposes an LLMs.txt that helps AI models understand how to integrate and interact with your authentication system. See it at https://better-auth.com/llms.txt.
技能
🌐 Skills
Better Auth 提供技能,可以添加到你的 AI 编码助手中,帮助它理解 Better Auth 的最佳实践和实现模式。
🌐 Better Auth provides skills that can be added to your AI coding assistant to help it understand Better Auth best practices and implementation patterns.
npx skills add better-auth/skillsMCP
Better Auth 提供了一个 MCP 服务器,因此你可以将其用于任何支持模型上下文协议(MCP)的 AI 模型。
🌐 Better Auth provides an MCP server so you can use it with any AI model that supports the Model Context Protocol (MCP).
命令行选项
🌐 CLI Options
使用 Better Auth CLI 轻松将 MCP 服务器添加到你首选的客户端:
🌐 Use the Better Auth CLI to easily add the MCP server to your preferred client:
npx @better-auth/cli mcp --cursornpx @better-auth/cli mcp --claude-codenpx @better-auth/cli mcp --open-codenpx @better-auth/cli mcp --manual手动配置
🌐 Manual Configuration
或者,你可以为每个客户端手动配置 MCP 服务器:
🌐 Alternatively, you can manually configure the MCP server for each client:
claude mcp add --transport http better-auth https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp {
"$schema": "https://opencode.ai/config.json",
"mcp": {
"better-auth": {
"type": "remote",
"url": "https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp",
"enabled": true,
}
}
}{
"better-auth": {
"url": "https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp"
}
}