diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..1acc8e8 --- /dev/null +++ b/.vercelignore @@ -0,0 +1,12 @@ +node_modules +.git +.vscode +.DS_Store +*.log +.env.local +.env.me +backend +dist +tests +history +patches diff --git a/README.md b/README.md index 5b68ed7..426f158 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,61 @@ ## 🚀 快速开始 -### 🐳 Docker 部署(推荐) +### ☁️ Vercel 一键部署(最快捷) + +适合快速部署和体验,无需服务器,全球 CDN 加速。 + +#### 方式一:一键部署按钮(推荐)⭐ + +点击下方按钮直接部署到 Vercel: + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/lintsinghua/XCodeReviewer) + +#### 方式二:通过 Vercel CLI 部署 + +```bash +# 1. 安装 Vercel CLI +npm i -g vercel + +# 2. 登录 Vercel +vercel login + +# 3. 部署项目 +vercel + +# 4. 部署到生产环境 +vercel --prod +``` + +#### 方式三:通过 Vercel Dashboard 部署 + +1. 访问 [Vercel Dashboard](https://vercel.com/dashboard) +2. 点击 "Add New..." → "Project" +3. 导入你的 GitHub 仓库 +4. Vercel 会自动检测 Vite 项目配置 +5. 配置环境变量(至少需要): + ``` + VITE_LLM_PROVIDER=your_llm_provider + VITE_LLM_API_KEY=your_api_key_here + VITE_USE_LOCAL_DB=true + ``` +6. 点击 "Deploy" + +**✨ Vercel 部署优势**: +- ✅ 全球 CDN 加速,访问速度快 +- ✅ 自动 HTTPS 和域名配置 +- ✅ 零配置,开箱即用 +- ✅ 支持自定义域名 +- ✅ 自动部署(Git 推送后自动更新) + +**⚠️ 注意事项**: +- Vercel 主要用于前端部署,后端 API 需单独部署 +- 推荐使用本地数据库模式(`VITE_USE_LOCAL_DB=true`) +- 部署后可在 `/admin` 页面进行运行时配置 + +--- + +### 🐳 Docker 部署(推荐生产环境) #### 方式一:使用发布的镜像(最简单)⭐ diff --git a/README_EN.md b/README_EN.md index 76ffd88..abd0d1a 100644 --- a/README_EN.md +++ b/README_EN.md @@ -77,7 +77,61 @@ In the fast-paced world of software development, ensuring code quality is crucia ## 🚀 Quick Start -### 🐳 Docker Deployment (Recommended) +### ☁️ Vercel One-Click Deployment (Fastest) + +Perfect for quick deployment and testing without a server, with global CDN acceleration. + +#### Method 1: One-Click Deploy Button (Recommended) ⭐ + +Click the button below to deploy directly to Vercel: + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/lintsinghua/XCodeReviewer) + +#### Method 2: Deploy via Vercel CLI + +```bash +# 1. Install Vercel CLI +npm i -g vercel + +# 2. Login to Vercel +vercel login + +# 3. Deploy project +vercel + +# 4. Deploy to production +vercel --prod +``` + +#### Method 3: Deploy via Vercel Dashboard + +1. Visit [Vercel Dashboard](https://vercel.com/dashboard) +2. Click "Add New..." → "Project" +3. Import your GitHub repository +4. Vercel will automatically detect Vite project configuration +5. Configure environment variables (minimum required): + ``` + VITE_LLM_PROVIDER=your_llm_provider + VITE_LLM_API_KEY=your_api_key_here + VITE_USE_LOCAL_DB=true + ``` +6. Click "Deploy" + +**✨ Vercel Deployment Advantages**: +- ✅ Global CDN acceleration for fast access +- ✅ Automatic HTTPS and domain configuration +- ✅ Zero configuration, ready to use +- ✅ Custom domain support +- ✅ Automatic deployment (auto-update on Git push) + +**⚠️ Important Notes**: +- Vercel is primarily for frontend deployment; backend APIs need separate deployment +- Recommended to use local database mode (`VITE_USE_LOCAL_DB=true`) +- After deployment, configure runtime settings at `/admin` page + +--- + +### 🐳 Docker Deployment (Recommended for Production) #### Method 1: Use Published Image (Easiest) ⭐ diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..4ab32c0 --- /dev/null +++ b/vercel.json @@ -0,0 +1,27 @@ +{ + "version": 2, + "buildCommand": "npm run build", + "outputDirectory": "dist", + "framework": "vite", + "rewrites": [ + { + "source": "/(.*)", + "destination": "/index.html" + } + ], + "headers": [ + { + "source": "/assets/(.*)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + } + ], + "env": { + "VITE_LLM_PROVIDER": "@vite_llm_provider", + "VITE_USE_LOCAL_DB": "@vite_use_local_db" + } +}