fix: 修复 Vercel 部署配置并添加 Neon 数据库文档
- 移除 vercel.json 中不存在的 Secret 引用 (@database_url) - 在 CLAUDE.md 中添加 Neon 数据库配置说明 - 环境变量应直接在 Vercel Dashboard 中设置 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,7 @@ src/app/
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Database (Prisma + PostgreSQL)
|
### Database (Prisma + PostgreSQL)
|
||||||
|
- **Provider**: Neon (serverless PostgreSQL)
|
||||||
- **Schema**: `prisma/schema.prisma` defines models: `Project`, `Tag`, `ExternalLink`, `ProjectTag`
|
- **Schema**: `prisma/schema.prisma` defines models: `Project`, `Tag`, `ExternalLink`, `ProjectTag`
|
||||||
- **Enums**: `ProjectStatus` (ACTIVE/ARCHIVED), `LinkType` (WEBSITE/GITHUB/HUGGINGFACE/PAPER)
|
- **Enums**: `ProjectStatus` (ACTIVE/ARCHIVED), `LinkType` (WEBSITE/GITHUB/HUGGINGFACE/PAPER)
|
||||||
- **Client singleton**: `src/lib/prisma.ts` exports Prisma client instance
|
- **Client singleton**: `src/lib/prisma.ts` exports Prisma client instance
|
||||||
@@ -64,6 +65,13 @@ src/app/
|
|||||||
- `ExternalLink`: `@@unique([projectId, url])` (each project can't have duplicate URLs)
|
- `ExternalLink`: `@@unique([projectId, url])` (each project can't have duplicate URLs)
|
||||||
- **Indexes**: `idx_project_status_createdAt`, `idx_project_slug`, `idx_tag_slug`, `idx_link_projectId`, `idx_link_type`, `idx_link_type_url` (composite for efficient URL-based deduplication)
|
- **Indexes**: `idx_project_status_createdAt`, `idx_project_slug`, `idx_tag_slug`, `idx_link_projectId`, `idx_link_type`, `idx_link_type_url` (composite for efficient URL-based deduplication)
|
||||||
|
|
||||||
|
#### Neon Database Setup
|
||||||
|
- **Dashboard**: https://console.neon.tech
|
||||||
|
- **Connection String Format**: `postgres://[user]:[password]@[host]/[database]?sslmode=require`
|
||||||
|
- **Vercel Integration**: Set `DATABASE_URL` environment variable in Vercel Dashboard (do NOT use `vercel.json` env references)
|
||||||
|
- **Free Tier**: 0.5GB storage, 300 hours compute/month
|
||||||
|
- **Run Migrations**: After deployment, run `pnpm prisma db push` or use Neon's SQL Editor to create tables
|
||||||
|
|
||||||
### Webhook Deduplication Strategy
|
### Webhook Deduplication Strategy
|
||||||
The webhook at `src/app/api/webhook/projects/route.ts` implements a **multi-level deduplication** strategy to prevent duplicate projects:
|
The webhook at `src/app/api/webhook/projects/route.ts` implements a **multi-level deduplication** strategy to prevent duplicate projects:
|
||||||
1. **GitHub URL exact match** (highest priority) - via `ExternalLink` table using `idx_link_type_url` index
|
1. **GitHub URL exact match** (highest priority) - via `ExternalLink` table using `idx_link_type_url` index
|
||||||
|
|||||||
+1
-4
@@ -2,8 +2,5 @@
|
|||||||
"buildCommand": "pnpm prisma generate && pnpm build",
|
"buildCommand": "pnpm prisma generate && pnpm build",
|
||||||
"installCommand": "pnpm install",
|
"installCommand": "pnpm install",
|
||||||
"framework": "nextjs",
|
"framework": "nextjs",
|
||||||
"regions": ["sin1"],
|
"regions": ["sin1"]
|
||||||
"env": {
|
|
||||||
"DATABASE_URL": "@database_url"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user