feat(deployment): Add Vercel deployment support and configuration

- Add .vercelignore to exclude unnecessary files from Vercel deployment
- Update README.md and README_EN.md with detailed Vercel deployment instructions
- Create vercel.json with deployment configuration
- Add one-click deployment button and multiple deployment methods
- Include environment variable setup guidance
- Highlight Vercel deployment advantages and important notes
- Improve documentation for easier deployment and setup process
Enhances project deployment flexibility and provides clear, step-by-step guidance for users looking to quickly deploy the application on Vercel.
This commit is contained in:
lintsinghua 2025-11-11 17:01:29 +08:00
parent 688b3bd461
commit eec852914a
4 changed files with 149 additions and 2 deletions

12
.vercelignore Normal file
View File

@ -0,0 +1,12 @@
node_modules
.git
.vscode
.DS_Store
*.log
.env.local
.env.me
backend
dist
tests
history
patches

View File

@ -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 部署(推荐生产环境)
#### 方式一:使用发布的镜像(最简单)⭐

View File

@ -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) ⭐

27
vercel.json Normal file
View File

@ -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"
}
}