覆盖邮箱/密码登录、Google OAuth、密码重置、邮箱验证、修改邮箱与密码、删除账户等认证流程
react-supabase-auth-starter — Vite 启动器模板
作者 jjmendezrodriguez
基于 React、TypeScript 与 Supabase 的认证模板,包含邮箱密码登录、Google OAuth、密码重置、邮箱验证、账户管理与受保护路由,并配有 i18n、单元测试、E2E 测试和 GitHub Actions 流水线。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
使用 Zustand 管理认证与 UI 状态,提供受保护路由、会话持久化和自动令牌刷新
内置英语与西班牙语国际化,语言选择持久化到 localStorage,可基于 JSON 添加语言
包含 Vitest 单元测试与 Playwright 跨三种浏览器的 E2E 测试,并支持覆盖率报告
提供 GitHub Actions 流水线(lint、测试、构建、安全审计)与 Vercel 部署配置
README 记录了 TypeScript 严格模式、输入校验、客户端限流、Supabase RLS 与安全响应头等安全措施
模板详细介绍
该模板提供一个完整的认证前端基础,使用 React、TypeScript、Vite、Tailwind CSS v4 与 Zustand 构建,认证与数据由 Supabase 提供。README 列出的认证流程包括:邮箱/密码登录(含实时校验)、Google OAuth、密码重置与邮件找回、带邮箱验证的账户创建、修改邮箱、修改密码、删除账户,以及受保护路由、会话持久化和自动刷新令牌。界面部分包含认证弹窗、仪表盘(个人资料与设置)、首页交互效果、密码强度提示、加载与错误状态、确认弹窗,以及英语和西班牙语国际化,语言选择保存在 localStorage。安全方面 README 提到 TypeScript 严格模式、输入校验、带指数退避的客户端限流、Vercel 安全响应头、Supabase RLS 策略、环境变量管理、audit-ci 漏洞扫描、Dependabot 和 SECURITY.md。测试与工程化方面包含 Vitest 与 Testing Library 单元测试、Playwright 跨 Chromium/Firefox/WebKit 的 E2E 测试、覆盖率报告,以及 GitHub Actions 的 lint、测试、构建、安全审计流程和 Vercel 部署。README 未说明后端业务数据模型、生产环境运维细节或具体部署后的可用性保证。
适合你的项目吗?
适用场景
- 为新项目搭建带 Supabase 认证的前端基础,减少从零编写登录、注册和密码找回流程的工作量
- 需要邮箱密码与 Google OAuth 两种登录方式,并包含账户设置与受保护页面的应用
- 希望前端具备英语/西班牙语切换能力,并保留用户语言偏好的项目
- 需要单元测试、跨浏览器 E2E 测试和 CI 流水线作为起点的团队
- 使用 Supabase 作为认证与数据后端,并计划部署到 Vercel 的项目
适合人群
- 使用 React 与 TypeScript 开发、需要现成认证流程的前端项目
- 以 Supabase 作为认证后端的应用
- 希望模板自带测试、CI 与安全配置的工程团队
- 需要多语言支持(英语、西班牙语)的 Web 应用
- 计划通过 Vercel 部署并利用其安全响应头配置的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Bun(推荐)或 Node.js 18+,以及一个 Supabase 账户
- 2
克隆仓库后进入 frontEnd 目录,执行 bun install 安装依赖
- 3
复制 .env.example 为 .env,并填入 Supabase 的 VITE_SUPABASE_URL 与 VITE_SUPABASE_ANON_KEY
- 4
执行 bun dev 启动开发服务器,README 说明默认访问地址为 http://localhost:5174
- 5
README 未提供 Supabase 项目内建表、RLS 策略或 OAuth 提供方配置的完整步骤,需参考 frontEnd/README.md 等文档
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 使用前需要一个 Supabase 账户(README 说明有免费套餐可用),认证与数据依赖该外部服务。
- 必须配置 Supabase 项目 URL 环境变量,否则应用无法连接后端认证服务。
- 必须配置 Supabase 匿名密钥环境变量,属于外部服务凭据要求。
- 需从 Supabase 控制台获取凭据,意味着需要注册并登录 Supabase 账户。
- 删除账户功能依赖部署 Supabase Edge Function,需要额外的 Supabase 服务端配置。
- 如需品牌化邮件投递,需自行配置自定义 SMTP 服务,可能产生外部服务成本。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
- Supabase account (free tier available)
README 原文
VITE_SUPABASE_URL=https://your-project.supabase.co
README 原文
VITE_SUPABASE_ANON_KEY=your-anon-key
README 原文
Get your Supabase credentials from: **[Supabase Dashboard → Settings → API](https://supabase.com/dashboard/project/_/settings/api)**
README 原文
supabase functions deploy delete-user
README 原文
https://github.com/jjmendezrodriguez/react-supabase-auth-starter/blob/main/LICENSEhttps://github.com/jjmendezrodriguez/react-supabase-auth-starter/blob/main/README.md3. _(Optional)_ Configure custom SMTP for branded email delivery under **Project Settings → Auth → SMTP Settings**
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-16。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 85 / 100
- 技术栈
- Vite · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-06-11
- 截图检查日期
- 2026-10-16
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Vite。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: codex-user-requested-batch-review-20261017 · 2026-10-16
查看当时使用的来源资料
SHA-256: ee1e3b7284b360aa2c31a1bb3c8baea73e86cb52683707194d0413d17b897a34
2026-10-16T16:13:48.339Z
来源文件 / 仓库# 🔐 React Supabase Auth Starter > **A production-ready authentication template** built with React 19 + TypeScript + Supabase, following Staff Engineer standards. Secure auth flows, i18n, comprehensive testing, automated CI/CD with security auditing, and enforced code quality — ready to deploy in minutes. [](https://react-supabase-auth-starter.vercel.app/) [](LICENSE) [](https://github.com/jjmendezrodriguez/react-supabase-auth-starter/actions) [](https://react.dev/) [](https://www.typescriptlang.org/) [](https://supabase.com/) [](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjjmendezrodriguez%2Freact-supabase-auth-starter&env=VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY&envDescription=Supabase%20credentials%20needed%20for%20authentication.%20Get%20them%20from%20your%20Supabase%20project%20dashboard.&envLink=https%3A%2F%2Fsupabase.com%2Fdashboard%2Fproject%2F_%2Fsettings%2Fapi&project-name=react-supabase-auth-starter&root-directory=frontEnd) --- ## 🎯 What is This? This is not just another auth boilerplate. It's a **complete foundation** for production web apps, designed with the same standards used at companies like Google, Meta, and Stripe. Every decision — from folder structure to CI pipeline — follows Staff Engineer-level practices documented in 3000+ lines of coding standards. **🚀 Live Demo:** [https://react-supabase-auth-starter.vercel.app/](https://react-supabase-auth-starter.vercel.app/) ### 📸 Screenshots | Home Page | Login Modal | Signup Modal | | :-------------------------------------: | :----------------------------------------------: | :------------------------------------------------: | |  |  |  | | Forgot Password | Dashboard - Profile | Dashboard - Settings | | :------------------------------------------------------: | :----------------------------------------------------------: | :------------------------------------------------------------: | |  |  |  | | Language Switcher | Home (Light On) | Info Page | | :----------------------------------------------------------: | :----------------------------------------------: | :------------------------------------------: | |  |  |  | --- ## ✨ Key Features ### 🔐 Complete Authentication System - ✅ Email/Password login with real-time validation - ✅ Google OAuth integration (extensible to GitHub, Apple, etc.) - ✅ Password reset flow with email recovery - ✅ Account creation with email verification - ✅ Change email, change password, delete account - ✅ Protected routes with Zustand state management - ✅ Session persistence and automatic token refresh - ✅ Client-side rate limiter with exponential backoff ### 🎨 Modern UI/UX - ✅ Clean, responsive design with Tailwind CSS v4 - ✅ Smooth animations (animated tabs, modal transitions) - ✅ Interactive home page (light switch, rain, wind effects) - ✅ Password strength indicator with visual feedback - ✅ Loading states, error handling, and confirmation modals ### 🌍 Internationalization (i18n) - ✅ Full English and Spanish support - ✅ Easy to add new languages (JSON-based) - ✅ Persistent language selection (localStorage) - ✅ Real-time translation without page reload ### 🔒 Security (Staff Engineer Level) - ✅ TypeScript strict mode — zero implicit `any` - ✅ Input sanitization and validation (email, password strength) - ✅ Client-side rate limiter with exponential backoff (brute-force protection) - ✅ Security headers via Vercel (CSP, HSTS, X-Frame-Options, Referrer-Policy) - ✅ RLS (Row Level Security) policies on Supabase - ✅ Environment variables for all secrets (zero hardcoded keys) - ✅ Automated vulnerability scanning (audit-ci in CI pipeline) - ✅ Dependabot for weekly dependency updates - ✅ SECURITY.md with vulnerability reporting process ### 🧪 Comprehensive Testing - ✅ **Unit tests** — Vitest + Testing Library (utils, hooks, components) - ✅ **E2E tests** — Playwright across 3 browsers (Chromium, Firefox, WebKit) - ✅ Test coverage reporting with @vitest/coverage-v8 - ✅ Dedicated test fixtures and helpers ### 🚀 CI/CD & DevOps - ✅ **GitHub Actions** — Lint → Test → Build → Security Audit (every PR) - ✅ **Playwright CI** — E2E tests in 3 browsers with artifact uploads - ✅ **Dependency caching** — 85% faster CI builds - ✅ **Branch protection** — PR required, code owner review, status checks - ✅ **CODEOWNERS** — Automatic review assignment for critical paths - ✅ **PR Template** — Standardized PR descriptions with security checklist - ✅ **Dependabot** — Automated weekly dependency scanning - ✅ **Vercel deployment** — Automatic preview deploys on PRs ### 📖 Professional Documentation - ✅ **AGENTS.md** — 3000+ lines of coding standards (Security, Architecture, Testing, CI/CD, Performance) - ✅ **PROJECT_STRUCTURE.md** — File organization guide with migration paths - ✅ **SECURITY.md** — Vulnerability reporting and security practices - ✅ **CONTRIBUTING.md** — Contribution guidelines and PR standards - ✅ **JSDoc comments** — All exported functions documented - ✅ **Inline comments** — Code explains "why", not just "what" --- ## 🛠 Tech Stack | Category | Technologies | | ---------------- | --------------------------------------------------- | | **Frontend** | React 19, TypeScript 5.9, Vite 7, SWC | | **Styling** | Tailwind CSS v4 (via Vite plugin) | | **State** | Zustand 5 (auth + UI stores) | | **Backend/Auth** | Supabase (Auth, PostgreSQL, RLS, Edge Functions) | | **Runtime** | Bun (package manager + task runner) | | **Unit Testing** | Vitest, Testing Library, jsdom | | **E2E Testing** | Playwright (Chromium, Firefox, WebKit) | | **CI/CD** | GitHub Actions (lint, test, build, audit) | | **Deployment** | Vercel (with security headers) | | **Code Quality** | ESLint, Prettier, Husky, lint-staged | | **Security** | audit-ci, Dependabot, CODEOWNERS, branch protection | | **i18n** | react-i18next, i18next | --- ## 🚀 Quick Start ### Prerequisites - [Bun](https://bun.sh/) (recommended) or Node.js 18+ - Supabase account (free tier available) ### Installation ```bash # Clone the repository git clone https://github.com/jjmendezrodriguez/react-supabase-auth-starter.git cd react-supabase-auth-starter # Navigate to frontend cd frontEnd # Install dependencies bun install # Set up environment variables cp .env.example .env # Edit .env with your Supabase credentials # Start development server bun dev ``` Visit `http://localhost:5174` 🎉 --- ## 📁 Project Structure ```files frontEnd/ ├── src/ │ ├── components/ # React components │ │ ├── auth/ # Authentication modals │ │ └── dashboard/ # User dashboard │ ├── hooks/ # Custom React hooks │ ├── services/ # External integrations │ │ └── supabase/ # Supabase client │ ├── stores/ # Zustand state stores │ ├── utils/ # Pure utility functions │ ├── pages/ # Route pages │ └── locales/ # i18n translations ├── e2e/ # Playwright E2E tests ├── test/ # Vitest unit tests ├── docs/ # Documentation └── .github/workflows/ # CI/CD pipelines ``` See [PROJECT_STRUCTURE.md](frontEnd/PROJECT_STRUCTURE.md) for detailed organization. --- ## 📚 Documentation This project is thoroughly documented — not just code comments, but full engineering guides: | Document | Purpose | | --------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | **[AGENTS.md](frontEnd/AGENTS.md)** | 3000+ lines of coding standards — security, architecture, testing, CI/CD, performance, scalability | | **[PROJECT_STRUCTURE.md](frontEnd/PROJECT_STRUCTURE.md)** | File organization guide with Type-based → Feature-based migration path | | **[SECURITY.md](SECURITY.md)** | Security practices, vulnerability reporting, and incident response | | **[CONTRIBUTING.md](CONTRIBUTING.md)** | Contribution guidelines, PR standards, and code review process | | **[E2E_TESTING_GUIDE.md](frontEnd/E2E_TESTING_GUIDE.md)** | Playwright E2E testing guide with patterns and best practices | | **[Frontend README](frontEnd/README.md)** | Detailed frontend architecture, Supabase setup, and component docs | --- ## 💡 Why This Template? Most auth templates give you a login form and call it done. This one gives you the **full engineering foundation**: ```txt ❌ Typical auth template: ✅ This template: ───────────────────────── ───────────────────────── Login form Complete auth system (7 flows) No tests Unit + E2E tests (3 browsers) No CI/CD GitHub Actions pipeline (4 stages) No security Rate limiting, CSP, HSTS, audit-ci No docs 3000+ lines of engineering standards "Works on my machine" Vercel deploy in 2 minutes ``` **Time saved:** ~3-4 weeks of setup and security hardening for every new project. --- ## 🧪 Available Scripts ```bash # Development bun dev # Start development server bun build # Build for production bun lint # Run ESLint bun preview # Preview production build # Unit Tests (Vitest) bun test # Run tests in watch mode bun test:run # Run tests once bun test:coverage # Generate coverage report bun test:ui # Open Vitest UI # E2E Tests (Playwright) bun test:e2e # Run all E2E tests bun test:e2e:headed # Run with visible browser bun test:e2e:ui # Open Playwright UI bun test:e2e:debug # Debug mode bun test:e2e:report # View last HTML report bun test:e2e:codegen # Record new tests ``` --- ## 🔧 Environment Setup Create a `.env` file in `frontEnd/` (or copy the example): ```bash cp frontEnd/.env.example frontEnd/.env ``` ```env VITE_SUPABASE_URL=https://your-project.supabase.co VITE_SUPABASE_ANON_KEY=your-anon-key ``` Get your Supabase credentials from: **[Supabase Dashboard → Settings → API](https://supabase.com/dashboard/project/_/settings/api)** --- ## 🗄️ Database Setup ### 1. Create `profiles` table ```sql CREATE TABLE profiles ( id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE, first_name TEXT, last_name TEXT, email TEXT, avatar_url TEXT, bio TEXT, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW() ); ``` ### 2. Enable Row Level Security (RLS) ```sql ALTER TABLE profiles ENABLE ROW LEVEL SECURITY; -- Users can view their own profile CREATE POLICY "Users can view own profile" ON profiles FOR SELECT USING (auth.uid() = id); -- Users can update their own profile CREATE POLICY "Users can update own profile" ON profiles FOR UPDATE USING (auth.uid() = id); -- Users can insert their own profile CREATE POLICY "Users can insert own profile" ON profiles FOR INSERT WITH CHECK (auth.uid() = id); ``` ### 3. Create Database Triggers These triggers keep profiles in sync with Supabase Auth: - **`on_auth_user_created`** — Auto-creates a profile row when a new user signs up - **`on_auth_user_email_updated`** — Syncs email changes from auth to profiles - **`on_profile_name_updated`** — Syncs name changes from profiles to auth.users metadata ### 4. Deploy Edge Function (optional) The `delete-user` Edge Function handles privileged account deletion: ```bash supabase functions deploy delete-user ``` > **See:** [frontEnd/README.md](frontEnd/README.md#supabase-database-setup) for detailed SQL and trigger definitions. --- ## 📧 Email Templates Supabase sends automatic emails for authentication events. To customize them: 1. Go to **Supabase Dashboard → Authentication → Email Templates** 2. Edit these templates to match your brand: | Template | When it's sent | | ------------------ | ------------------------------------- | | **Confirm signup** | After user creates an account | | **Reset password** | When user requests password recovery | | **Magic link** | When using passwordless login | | **Change email** | When user updates their email address | | **Invite user** | When you invite users via dashboard | 3. _(Optional)_ Configure custom SMTP for branded email delivery under **Project Settings → Auth → SMTP Settings** > **Docs:** [Supabase Email Templates](https://supabase.com/docs/guides/auth/auth-email-templates) · [Custom SMTP](https://supabase.com/docs/guides/auth/auth-smtp) --- ## 🤝 Contributing Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and development process. --- ## 📄 License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. --- ## 👨💻 Author **Jose Mendez** — Software Engineer Building production-grade tools with Staff Engineer standards. 💼 [LinkedIn](https://linkedin.com/in/jjmendezrodriguez) · 🐙 [GitHub](https://github.com/jjmendezrodriguez) --- ## 🌟 Show Your Support If this template saved you time or taught you something, give it a ⭐️ on GitHub! **Found a bug?** [Open an issue](https://github.com/jjmendezrodriguez/react-supabase-auth-starter/issues) · **Want to contribute?** Read [CONTRIBUTING.md](CONTRIBUTING.md)
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

cove
The Cove Stack: 🏝️ minimal TanStack Start template with Vite+, Better Auth, Drizzle ORM, shadcn/ui
Vite · SaaS

vite-react-boilerplate
A production ready, scalable starter template for Vite + React
Vite · 启动器

vital
Starter template for Vite with React (TypeScript). Supports Tailwind. Vitest and @react/testing-library config…
Vite · 启动器

react-vite-admin
This Starter utilizes React, Recoil, React Query, React Hooks, Typescript, Axios And Vite. 全新技术栈的后台管理系统
Vite · 后台

typescript-react_best_practices-vite_template
<⚡⚛️> Start your React project with Vite following code best practices (TypeScript, Linting, testing, CI/CD…)
Vite · 启动器

cloudflare-starter-kit
Template (boilerplate) repository for scaffolding Cloudflare Workers projects
Vite · 启动器
