重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
system-design-generator by patricio0312rev/skills
npx skills add https://github.com/patricio0312rev/skills --skill system-design-generator根据需求创建全面的系统架构方案。
# 系统设计:[功能/产品名称]
## 概述
简要描述我们要构建什么以及为什么。
## 需求
### 功能性需求
- 用户可以上传视频(最大 1GB)
- 系统在 5 分钟内处理视频
- 处理完成后用户收到通知
### 非功能性需求
- 每天处理 1000 次上传
- 99.9% 的可用性
- 视频处理时间 <5 分钟(p95)
- 成本:每视频 <$0.50
## 高层架构
┌─────────┐ ┌──────────┐ ┌─────────────┐ │ 客户端 │─────▶│ API │─────▶│ 上传 │ │ │ │ 网关 │ │ 服务 │ └─────────┘ └──────────┘ └─────────────┘ │ ▼ ┌─────────────┐ │ 存储 │ │ (S3) │ └─────────────┘ │ ▼ ┌─────────────┐ │ 处理 │◀─┐ │ 队列 │ │ └─────────────┘ │ │ │ ▼ │ ┌─────────────┐ │ │ 处理器 │─┘ │ 工作器 │ └─────────────┘ │ ▼ ┌─────────────┐ │通知 │ │ 服务 │ └─────────────┘
## 组件
### 1. API 网关
**职责:**
- 身份验证
- 速率限制
- 请求路由
**技术:** Kong/AWS API Gateway
**扩展:** 基于请求数/秒自动扩展
### 2. 上传服务
**职责:**
- 生成预签名的 S3 URL
- 验证文件元数据
- 将处理任务加入队列
**API:**
POST /uploads 请求: { filename, size, content_type } 响应: { upload_url, upload_id }
**技术:** Node.js + Express
**扩展:** 水平扩展(无状态)
### 3. 存储 (S3)
**职责:**
- 存储原始视频
- 存储处理后的输出
- 通过 CDN 提供内容
**结构:**
/uploads/{user_id}/{upload_id}/original.mp4 /processed/{user_id}/{upload_id}/output.mp4
### 4. 处理队列
**职责:**
- 缓冲处理任务
- 确保至少一次交付
- 用于失败任务的死信队列
**技术:** AWS SQS
**配置:**
- 可见性超时:15 分钟
- 重试 3 次后进入死信队列
### 5. 处理器工作器
**职责:**
- 转码视频
- 生成缩略图
- 更新数据库
**技术:** Python + FFmpeg
**扩展:** 基于队列深度自动扩展
## 数据流
### 上传流程
1. 客户端向上传服务请求上传 URL
2. 上传服务生成预签名的 S3 URL
3. 客户端直接上传到 S3
4. 客户端通知上传服务上传完成
5. 上传服务将处理任务加入队列
6. 返回 upload_id 给客户端
### 处理流程
1. 工作器轮询队列中的任务
2. 从 S3 下载视频
3. 处理视频(转码、生成缩略图)
4. 将结果上传到 S3
5. 更新数据库状态
6. 发送通知
7. 从队列中删除消息
## 数据模型
```typescript
interface Upload {
id: string;
user_id: string;
filename: string;
size: number;
status: 'pending' | 'processing' | 'complete' | 'failed';
original_url: string;
processed_url?: string;
created_at: Date;
processed_at?: Date;
}
interface ProcessingJob {
upload_id: string;
attempts: number;
error?: string;
}
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
POST /uploads - 请求上传 URL
GET /uploads/:id - 获取上传状态
DELETE /uploads/:id - 取消上传
GET /uploads - 列出用户上传
POST {webhook_url}
{
"event": "upload.completed",
"upload_id": "...",
"status": "complete",
"processed_url": "..."
}
每月 (1000 次上传/天):
指标:
告警:
视频保留策略?(30 天?1 年?)
最大视频时长?(影响处理时间)
区域数据驻留要求?
### 组件名称
**职责:**
- 主要职责
- 次要职责
**技术栈:**
- 语言:[Python/Node/Go]
- 框架:[Express/FastAPI/Gin]
- 数据库:[PostgreSQL/MongoDB]
**API/接口:**
```typescript
interface ComponentAPI {
method(params): ReturnType;
}
扩展策略:
依赖项:
故障处理:
使用指数退避重试
对下游服务使用熔断器
回退到缓存数据
每周安装次数
53
仓库
GitHub 星标数
20
首次出现
2026 年 1 月 24 日
安全审计
安装于
codex45
opencode45
gemini-cli44
github-copilot39
cursor38
claude-code37
Create comprehensive system architecture plans from requirements.
# System Design: [Feature/Product Name]
## Overview
Brief description of what we're building and why.
## Requirements
### Functional
- User can upload videos (max 1GB)
- System processes video within 5 minutes
- User receives notification when complete
### Non-Functional
- Handle 1000 uploads/day
- 99.9% uptime
- Process videos in <5 minutes (p95)
- Cost: <$0.50 per video
## High-Level Architecture
┌─────────┐ ┌──────────┐ ┌─────────────┐ │ Client │─────▶│ API │─────▶│ Upload │ │ │ │ Gateway │ │ Service │ └─────────┘ └──────────┘ └─────────────┘ │ ▼ ┌─────────────┐ │ Storage │ │ (S3) │ └─────────────┘ │ ▼ ┌─────────────┐ │ Processing │◀─┐ │ Queue │ │ └─────────────┘ │ │ │ ▼ │ ┌─────────────┐ │ │ Processor │─┘ │ Workers │ └─────────────┘ │ ▼ ┌─────────────┐ │Notification │ │ Service │ └─────────────┘
## Components
### 1. API Gateway
**Responsibilities:**
- Authentication
- Rate limiting
- Request routing
**Technology:** Kong/AWS API Gateway
**Scaling:** Auto-scale based on requests/sec
### 2. Upload Service
**Responsibilities:**
- Generate pre-signed S3 URLs
- Validate file metadata
- Enqueue processing jobs
**API:**
POST /uploads Request: { filename, size, content_type } Response: { upload_url, upload_id }
**Technology:** Node.js + Express
**Scaling:** Horizontal (stateless)
### 3. Storage (S3)
**Responsibilities:**
- Store raw videos
- Store processed outputs
- Serve content via CDN
**Structure:**
/uploads/{user_id}/{upload_id}/original.mp4 /processed/{user_id}/{upload_id}/output.mp4
### 4. Processing Queue
**Responsibilities:**
- Buffer processing jobs
- Ensure at-least-once delivery
- DLQ for failed jobs
**Technology:** AWS SQS
**Configuration:**
- Visibility timeout: 15 minutes
- DLQ after 3 retries
### 5. Processor Workers
**Responsibilities:**
- Transcode videos
- Generate thumbnails
- Update database
**Technology:** Python + FFmpeg
**Scaling:** Auto-scale on queue depth
## Data Flow
### Upload Flow
1. Client requests upload URL from Upload Service
2. Upload Service generates pre-signed S3 URL
3. Client uploads directly to S3
4. Client notifies Upload Service of completion
5. Upload Service enqueues processing job
6. Returns upload_id to client
### Processing Flow
1. Worker polls queue for jobs
2. Downloads video from S3
3. Processes video (transcode, thumbnail)
4. Uploads results to S3
5. Updates database status
6. Sends notification
7. Deletes message from queue
## Data Model
```typescript
interface Upload {
id: string;
user_id: string;
filename: string;
size: number;
status: 'pending' | 'processing' | 'complete' | 'failed';
original_url: string;
processed_url?: string;
created_at: Date;
processed_at?: Date;
}
interface ProcessingJob {
upload_id: string;
attempts: number;
error?: string;
}
POST /uploads - Request upload URL
GET /uploads/:id - Get upload status
DELETE /uploads/:id - Cancel upload
GET /uploads - List user uploads
POST {webhook_url}
{
"event": "upload.completed",
"upload_id": "...",
"status": "complete",
"processed_url": "..."
}
Monthly (1000 uploads/day):
Metrics:
Alerts:
Video retention policy? (30 days? 1 year?)
Maximum video duration? (affects processing time)
Regional data residency requirements?
### Component Name
**Responsibilities:**
- Primary responsibility
- Secondary responsibility
**Technology Stack:**
- Language: [Python/Node/Go]
- Framework: [Express/FastAPI/Gin]
- Database: [PostgreSQL/MongoDB]
**API/Interface:**
```typescript
interface ComponentAPI {
method(params): ReturnType;
}
Scaling Strategy:
Dependencies:
Failure Handling:
Retry with exponential backoff
Circuit breaker for downstream services
Fallback to cached data
Weekly Installs
53
Repository
GitHub Stars
20
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex45
opencode45
gemini-cli44
github-copilot39
cursor38
claude-code37
API设计指南:REST/GraphQL设计原则、规范文档与版本控制策略
11,500 周安装