vercel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vercel Skill

Vercel 技能

Comprehensive assistance with Vercel deployment, API integration, and platform features. This skill provides practical guidance for building and deploying modern web applications on Vercel's AI Cloud platform.
为Vercel部署、API集成及平台功能提供全方位协助。本技能为在Vercel AI Cloud平台上构建和部署现代Web应用提供实用指导。

When to Use This Skill

何时使用本技能

This skill should be triggered when:
  • Deployment & CI/CD: Deploying applications, configuring continuous deployment, or setting up preview environments
  • API Integration: Working with Vercel REST API endpoints for programmatic deployments and management
  • CLI Operations: Using Vercel CLI commands for local development and deployment workflows
  • Configuration: Setting up
    vercel.json
    for build commands, routing, environment variables, or cron jobs
  • Framework Setup: Configuring Next.js, SvelteKit, Nuxt, or other supported frameworks
  • Serverless Functions: Creating and deploying serverless functions or Edge runtime code
  • Domain Management: Managing custom domains, SSL certificates, or DNS configuration
  • Environment Variables: Setting up secrets and environment variables for different environments
  • Team Management: Working with team resources, access tokens, or collaboration features
  • AI Integration: Deploying AI-powered applications, agents, or MCP servers
在以下场景中可触发本技能:
  • 部署与CI/CD:部署应用、配置持续部署或设置预览环境
  • API集成:使用Vercel REST API端点进行程序化部署与管理
  • CLI操作:使用Vercel CLI命令完成本地开发与部署工作流
  • 配置管理:设置
    vercel.json
    以配置构建命令、路由、环境变量或定时任务
  • 框架配置:配置Next.js、SvelteKit、Nuxt或其他受支持的框架
  • Serverless函数:创建并部署Serverless函数或Edge运行时代码
  • 域名管理:管理自定义域名、SSL证书或DNS配置
  • 环境变量:为不同环境设置密钥与环境变量
  • 团队管理:使用团队资源、访问令牌或协作功能
  • AI集成:部署AI驱动的应用、Agent或MCP服务器

Quick Reference

快速参考

Authentication with Access Token

使用访问令牌进行身份验证

bash
undefined
bash
undefined

Using cURL with Vercel API

使用cURL调用Vercel API

curl -X GET "https://api.vercel.com/v9/projects"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
-H "Content-Type: application/json"
undefined
curl -X GET "https://api.vercel.com/v9/projects"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
-H "Content-Type: application/json"
undefined

Basic CLI Deployment

基础CLI部署

bash
undefined
bash
undefined

Deploy to production

部署到生产环境

vercel --prod
vercel --prod

Deploy with environment variables

带环境变量部署

vercel --env NEXT_PUBLIC_API_URL=https://api.example.com
vercel --env NEXT_PUBLIC_API_URL=https://api.example.com

Force new deployment without cache

忽略缓存强制重新部署

vercel --force
vercel --force

Deploy with build logs

查看构建日志部署

vercel --logs
undefined
vercel --logs
undefined

CI/CD Deployment Workflow

CI/CD部署工作流

bash
undefined
bash
undefined

Pull environment variables and project settings

拉取环境变量与项目设置

vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
vercel pull --yes --environment=preview --token=$VERCEL_TOKEN

Build locally

本地构建

vercel build --token=$VERCEL_TOKEN
vercel build --token=$VERCEL_TOKEN

Deploy pre-built artifacts

部署预构建产物

vercel deploy --prebuilt --token=$VERCEL_TOKEN
undefined
vercel deploy --prebuilt --token=$VERCEL_TOKEN
undefined

vercel.json - Cron Jobs Configuration

vercel.json - 定时任务配置

json
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "crons": [
    {
      "path": "/api/every-minute",
      "schedule": "* * * * *"
    },
    {
      "path": "/api/every-hour",
      "schedule": "0 * * * *"
    },
    {
      "path": "/api/daily-cleanup",
      "schedule": "0 0 * * *"
    }
  ]
}
json
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "crons": [
    {
      "path": "/api/every-minute",
      "schedule": "* * * * *"
    },
    {
      "path": "/api/every-hour",
      "schedule": "0 * * * *"
    },
    {
      "path": "/api/daily-cleanup",
      "schedule": "0 0 * * *"
    }
  ]
}

vercel.json - Build Configuration

vercel.json - 构建配置

json
{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "nextjs",
  "installCommand": "npm install"
}
json
{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "nextjs",
  "installCommand": "npm install"
}

Environment Variables Configuration

环境变量配置

json
{
  "env": {
    "API_URL": "https://api.example.com",
    "FEATURE_FLAG": "true"
  },
  "build": {
    "env": {
      "BUILD_TIME": "@now"
    }
  }
}
json
{
  "env": {
    "API_URL": "https://api.example.com",
    "FEATURE_FLAG": "true"
  },
  "build": {
    "env": {
      "BUILD_TIME": "@now"
    }
  }
}

Accessing Team Resources via API

通过API访问团队资源

bash
undefined
bash
undefined

Get team deployments

获取团队部署记录

curl -X GET "https://api.vercel.com/v6/deployments?teamId=TEAM_ID"
-H "Authorization: Bearer YOUR_TOKEN"
curl -X GET "https://api.vercel.com/v6/deployments?teamId=TEAM_ID"
-H "Authorization: Bearer YOUR_TOKEN"

Create deployment for team project

为团队项目创建部署

curl -X POST "https://api.vercel.com/v13/deployments?teamId=TEAM_ID"
-H "Authorization: Bearer YOUR_TOKEN"
-H "Content-Type: application/json"
-d '{"name": "my-project", "files": []}'
undefined
curl -X POST "https://api.vercel.com/v13/deployments?teamId=TEAM_ID"
-H "Authorization: Bearer YOUR_TOKEN"
-H "Content-Type: application/json"
-d '{"name": "my-project", "files": []}'
undefined

Bun Runtime Configuration

Bun运行时配置

json
{
  "bunVersion": "1.0.0",
  "functions": {
    "api/**/*.ts": {
      "runtime": "bun"
    }
  }
}
json
{
  "bunVersion": "1.0.0",
  "functions": {
    "api/**/*.ts": {
      "runtime": "bun"
    }
  }
}

Serverless Function Example

Serverless函数示例

javascript
// api/hello.js
export default function handler(req, res) {
  const { name = 'World' } = req.query;
  res.status(200).json({
    message: `Hello ${name}!`,
    timestamp: new Date().toISOString()
  });
}
javascript
// api/hello.js
export default function handler(req, res) {
  const { name = 'World' } = req.query;
  res.status(200).json({
    message: `Hello ${name}!`,
    timestamp: new Date().toISOString()
  });
}

Edge Function Example

Edge函数示例

javascript
// middleware.js
export const config = {
  matcher: '/api/:path*',
};

export default function middleware(req) {
  const response = NextResponse.next();
  response.headers.set('x-custom-header', 'my-value');
  return response;
}
javascript
// middleware.js
export const config = {
  matcher: '/api/:path*',
};

export default function middleware(req) {
  const response = NextResponse.next();
  response.headers.set('x-custom-header', 'my-value');
  return response;
}

Key Concepts

核心概念

REST API Architecture

REST API架构

The Vercel REST API operates at
https://api.vercel.com
following REST principles. All requests require:
  • Authentication: Bearer token in Authorization header
  • Content-Type:
    application/json
    for all requests
  • HTTP Versions: Supports HTTP/1, 1.1, and 2 (HTTP/2 preferred)
  • TLS: Supports TLS 1.2 and 1.3 with resumption
Vercel REST API运行于
https://api.vercel.com
,遵循REST原则。所有请求需满足:
  • 身份验证:在Authorization头中携带Bearer令牌
  • 内容类型:所有请求需设置
    application/json
  • HTTP版本:支持HTTP/1、1.1及2(推荐使用HTTP/2)
  • TLS:支持TLS 1.2和1.3,支持会话恢复

Rate Limiting

请求频率限制

API responses include rate limit headers:
  • X-RateLimit-Limit
    : Maximum requests allowed
  • X-RateLimit-Remaining
    : Requests left in current window
  • X-RateLimit-Reset
    : Reset time (UTC epoch seconds)
Exceeding limits returns HTTP 429 with "too_many_requests" error.
API响应包含频率限制头信息:
  • X-RateLimit-Limit
    :允许的最大请求数
  • X-RateLimit-Remaining
    :当前周期内剩余请求数
  • X-RateLimit-Reset
    :重置时间(UTC纪元秒数)
超出限制将返回HTTP 429错误,错误码为"too_many_requests"。

Pagination

分页机制

  • Default: 20 items per page
  • Maximum: 100 items per page
  • Navigate with
    until
    query parameter and
    next
    /
    prev
    timestamps
  • 默认:每页20条数据
  • 最大:每页100条数据
  • 使用
    until
    查询参数及
    next
    /
    prev
    时间戳进行分页导航

Token Security

令牌安全

  • Set expiration dates (1 day to 1 year)
  • Store tokens securely immediately after creation
  • Tokens display only once and cannot be retrieved later
  • Use team-scoped tokens for team resource access
  • 设置过期时间(1天至1年)
  • 创建后立即安全存储令牌
  • 令牌仅显示一次,无法后续找回
  • 使用团队范围令牌访问团队资源

Deployment Workflow

部署工作流

  1. Preview Deployments: Automatic deployments for every git push to non-production branches
  2. Production Deployments: Deployments to production domain from main branch or via
    --prod
    flag
  3. Build Artifacts: Local builds with
    vercel build
    upload only compiled output
  4. Environment Variables: Different values for development, preview, and production
  1. 预览部署:每次向非生产分支推送代码时自动部署
  2. 生产部署:从主分支或通过
    --prod
    标志部署到生产域名
  3. 构建产物:使用
    vercel build
    本地构建后,仅上传编译后的输出文件
  4. 环境变量:开发、预览和生产环境使用不同的变量值

Reference Files

参考文件

This skill includes comprehensive documentation in
references/
:
  • api.md - Vercel REST API endpoints, authentication, and integration patterns
  • llms-full.md - Complete Vercel documentation for comprehensive reference
  • llms-small.md - Condensed documentation for quick lookups
Use
view
to read specific reference files when detailed information is needed.
本技能在
references/
目录中包含完整文档:
  • api.md - Vercel REST API端点、身份验证及集成模式
  • llms-full.md - 完整Vercel文档,供全面参考
  • llms-small.md - 精简版文档,供快速查阅
如需详细信息,可使用
view
命令查看特定参考文件。

Working with This Skill

如何使用本技能

For Beginners

初学者指南

Start with basic deployment workflows:
  1. Install Vercel CLI:
    npm i -g vercel
  2. Authenticate:
    vercel login
  3. Deploy your first project:
    vercel
  4. Learn about
    vercel.json
    configuration basics
从基础部署工作流开始:
  1. 安装Vercel CLI:
    npm i -g vercel
  2. 身份验证:
    vercel login
  3. 部署首个项目:
    vercel
  4. 学习
    vercel.json
    基础配置

For Intermediate Users

中级用户指南

Focus on:
  • Custom build configurations in
    vercel.json
  • Environment variable management across environments
  • Setting up cron jobs for scheduled tasks
  • Working with serverless functions
  • Git integration and preview deployments
重点关注以下内容:
  • vercel.json
    中的自定义构建配置
  • 跨环境的环境变量管理
  • 设置定时任务以执行计划任务
  • Serverless函数的使用
  • Git集成与预览部署

For Advanced Users

高级用户指南

Explore:
  • Vercel REST API for programmatic deployments
  • Custom CI/CD pipelines with
    vercel build
    and
    vercel deploy --prebuilt
  • Edge runtime and middleware configurations
  • Multi-tenant application patterns
  • Team management and access control
  • AI SDK integration and agent deployment
探索以下内容:
  • 使用Vercel REST API进行程序化部署
  • 结合
    vercel build
    vercel deploy --prebuilt
    构建自定义CI/CD流水线
  • Edge运行时与中间件配置
  • 多租户应用模式
  • 团队管理与访问控制
  • AI SDK集成与Agent部署

Navigation Tips

导航技巧

  • Use CLI commands for rapid iteration during development
  • Use REST API for automation and custom workflows
  • Reference
    vercel.json
    schema for configuration validation
  • Check rate limits when building high-volume integrations
  • Use team IDs for accessing shared resources
  • 使用CLI命令在开发过程中快速迭代
  • 使用REST API实现自动化与自定义工作流
  • 参考
    vercel.json
    架构进行配置验证
  • 构建高流量集成时注意检查请求频率限制
  • 使用团队ID访问共享资源

Platform Capabilities

平台能力

Computing Infrastructure

计算基础设施

  • Serverless Functions: Node.js, Python, Go, Ruby, Bun, Wasm runtimes
  • Edge Runtime: Low-latency edge computing
  • Fluid Compute: Active CPU allocation for optimal performance
  • Streaming Support: Real-time data streaming capabilities
  • Cron Jobs: Scheduled function execution
  • Serverless函数:支持Node.js、Python、Go、Ruby、Bun、Wasm运行时
  • Edge运行时:低延迟边缘计算
  • Fluid Compute:动态CPU分配以优化性能
  • 流支持:实时数据流式传输能力
  • 定时任务:计划函数执行

Development Features

开发功能

  • Framework Support: Next.js, SvelteKit, Nuxt, Astro, and 30+ more
  • Git Integration: GitHub, GitLab, Bitbucket, Azure DevOps
  • Automatic CI/CD: Preview environments for every push
  • Environment Variables: Secure secrets management
  • Deployment Protection: Password protection and access control
  • 框架支持:Next.js、SvelteKit、Nuxt、Astro等30+种框架
  • Git集成:GitHub、GitLab、Bitbucket、Azure DevOps
  • 自动CI/CD:每次推送代码自动生成预览环境
  • 环境变量:安全的密钥管理
  • 部署保护:密码保护与访问控制

AI Capabilities

AI能力

  • AI SDK: Language model integration framework
  • AI Gateway: Multi-provider LLM routing
  • Agent Building: Frameworks for AI agents
  • MCP Servers: Model Context Protocol server deployment
  • AI SDK:语言模型集成框架
  • AI网关:多供应商LLM路由
  • Agent构建:AI Agent开发框架
  • MCP服务器:Model Context Protocol服务器部署

Performance & Optimization

性能与优化

  • CDN: Global edge network
  • Image Optimization: Automatic image processing
  • OG Image Generation: Dynamic social media images
  • Caching: Intelligent caching strategies
  • CDN:全球边缘网络
  • 图片优化:自动图片处理
  • OG图片生成:动态社交媒体图片
  • 缓存策略:智能缓存机制

Common Use Cases

常见使用场景

  1. Marketing Sites: Rapid deployment with preview environments
  2. E-commerce Platforms: Composable commerce with serverless architecture
  3. SaaS Applications: Multi-tenant applications with edge computing
  4. AI Applications: AI-powered apps with intelligent infrastructure
  5. API Backends: Hosting RESTful APIs and GraphQL servers
  6. Static Sites: Optimized static site delivery
  7. Jamstack Applications: Modern web architectures
  1. 营销网站:快速部署并支持预览环境
  2. 电商平台:基于Serverless架构的可组合电商系统
  3. SaaS应用:采用边缘计算的多租户应用
  4. AI应用:AI驱动的智能基础设施应用
  5. API后端:托管RESTful API与GraphQL服务器
  6. 静态网站:优化的静态站点交付
  7. Jamstack应用:现代Web架构

Resources

资源

Official Documentation

官方文档

references/

references/

Organized documentation extracted from official sources. These files contain:
  • Detailed API endpoint specifications
  • Complete configuration options
  • Framework-specific deployment guides
  • Code examples with best practices
  • Links to original documentation
从官方资源提取的结构化文档,包含:
  • 详细的API端点规范
  • 完整的配置选项
  • 框架专属部署指南
  • 最佳实践代码示例
  • 官方文档链接

scripts/

scripts/

Add helper scripts here for common automation tasks such as:
  • Deployment automation scripts
  • Environment variable management
  • Team resource provisioning
  • Batch operations on projects
此处可添加用于常见自动化任务的辅助脚本,例如:
  • 部署自动化脚本
  • 环境变量管理脚本
  • 团队资源配置脚本
  • 项目批量操作脚本

assets/

assets/

Add templates, boilerplate, or example projects here such as:
  • vercel.json
    templates for different use cases
  • Serverless function boilerplates
  • Edge middleware examples
  • CI/CD workflow templates
此处可添加模板、样板代码或示例项目,例如:
  • 适用于不同场景的
    vercel.json
    模板
  • Serverless函数样板代码
  • Edge中间件示例
  • CI/CD工作流模板

Best Practices

最佳实践

  1. Security
    • Always set expiration dates on access tokens
    • Use team-scoped tokens for shared resources
    • Store tokens in secure environment variables
    • Rotate tokens regularly
  2. Performance
    • Use
      --prebuilt
      for faster deployments in CI/CD
    • Enable caching for build dependencies
    • Optimize images using Vercel's image optimization
    • Use Edge runtime for low-latency operations
  3. Configuration
    • Version control your
      vercel.json
      configuration
    • Use environment-specific settings appropriately
    • Document custom build commands
    • Test configurations in preview environments first
  4. API Integration
    • Implement retry logic for rate-limited requests
    • Handle pagination for large result sets
    • Monitor rate limit headers proactively
    • Use team IDs consistently for team resources
  1. 安全
    • 始终为访问令牌设置过期时间
    • 对共享资源使用团队范围令牌
    • 将令牌存储在安全的环境变量中
    • 定期轮换令牌
  2. 性能
    • 在CI/CD中使用
      --prebuilt
      以加快部署速度
    • 启用构建依赖缓存
    • 使用Vercel的图片优化功能优化图片
    • 对低延迟操作使用Edge运行时
  3. 配置
    • vercel.json
      配置进行版本控制
    • 合理使用环境专属设置
    • 记录自定义构建命令
    • 先在预览环境中测试配置
  4. API集成
    • 为受频率限制的请求实现重试逻辑
    • 处理大结果集的分页
    • 主动监控频率限制头信息
    • 访问团队资源时统一使用团队ID

Notes

说明

  • This skill provides guidance based on Vercel's latest documentation (as of January 2025)
  • Reference files preserve structure and examples from official documentation
  • Code examples include proper language detection for syntax highlighting
  • Quick reference patterns are extracted from common usage scenarios
  • 本技能基于Vercel最新文档提供指导(截至2025年1月)
  • 参考文件保留了官方文档的结构与示例
  • 代码示例包含语法高亮所需的正确语言标识
  • 快速参考模式提取自常见使用场景

Updating

更新方法

To refresh this skill with updated documentation:
  1. Re-run the documentation scraper with Vercel URLs
  2. Update reference files with latest API changes
  3. Verify code examples against current API versions
  4. Test configurations with latest CLI version
如需使用更新后的文档刷新本技能:
  1. 使用Vercel URL重新运行文档抓取工具
  2. 用最新的API变更更新参考文件
  3. 根据当前API版本验证代码示例
  4. 使用最新版CLI测试配置