Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #6104

vercel-deployments

Skill này làm gì

Công cụ này giúp bạn đưa website hoặc ứng dụng lên mạng bằng Vercel. Nó cho phép bạn tạo phiên bản thử nghiệm cho mỗi thay đổi và thiết lập các phần của website chạy trên máy chủ đặc biệt.

Khi nào nên dùng

  • ✓Khi bạn hoàn thành việc xây dựng website và muốn đưa nó lên mạng.
  • ✓Khi bạn muốn thử các tính năng mới trước khi phát hành cho mọi người.
  • ✓Khi bạn muốn cấu hình cách website hoạt động ở các khu vực khác nhau trên thế giới.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vercel-deployments/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vercel-deployments/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Đưa website của tôi lên mạng bằng Vercel.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cài một công cụ trên máy tính, kết nối tài khoản Vercel và dùng các lệnh đơn giản để tải dự án lên. Vercel sẽ lo phần còn lại, như tạo địa chỉ internet cho website của bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Vercel Deployments

Ship web apps quickly with preview environments and managed edge infrastructure.

When to Use This Skill

Use this skill when:

  • Deploying Next.js, SvelteKit, Nuxt, or static sites
  • Setting up preview environments for every PR
  • Configuring edge functions and serverless APIs
  • Managing environment variables across preview/production
  • Setting up custom domains and redirects

Prerequisites

  • Node.js 18+
  • Vercel account (free tier works for personal projects)
  • Git repository (GitHub, GitLab, or Bitbucket)

Quick Start

# Install CLI
npm i -g vercel

# Login and link project
vercel login
vercel link

# Deploy to preview
vercel

# Deploy to production
vercel --prod

# Pull environment variables locally
vercel env pull .env.local

Project Configuration

// vercel.json
{
  "framework": "nextjs",
  "buildCommand": "npm run build",
  "outputDirectory": ".next",
  "installCommand": "npm ci",
  "regions": ["iad1", "sfo1", "cdg1"],
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "no-store" },
        { "key": "X-Content-Type-Options", "value": "nosniff" }
      ]
    },
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Frame-Options", "value": "DENY" },
        { "key": "Strict-Transport-Security", "value": "max-age=63072000; includeSubDomains" }
      ]
    }
  ],
  "redirects": [
    { "source": "/blog/:slug", "destination": "/posts/:slug", "permanent": true }
  ],
  "rewrites": [
    { "source": "/api/v1/:path*", "destination": "https://api.example.com/:path*" }
  ]
}

Environment Variables

# Add environment variables
vercel env add DATABASE_URL production
vercel env add DATABASE_URL preview
vercel env add NEXT_PUBLIC_API_URL production

# List all env vars
vercel env ls

# Pull to local .env.local
vercel env pull .env.local

# Remove an env var
vercel env rm SECRET_KEY production

Environment Separation Pattern

# Production — real credentials
vercel env add DATABASE_URL production <<< "postgresql://prod-host:5432/app"
vercel env add STRIPE_SECRET_KEY production

# Preview — staging/test credentials
vercel env add DATABASE_URL preview <<< "postgresql://staging-host:5432/app"
vercel env add STRIPE_SECRET_KEY preview   # Use test mode key

# Development — local values
vercel env add DATABASE_URL development <<< "postgresql://localhost:5432/app"

Edge Functions

// app/api/geo/route.ts — Edge API route (Next.js App Router)
import { NextRequest } from 'next/server';

export const runtime = 'edge';

export function GET(request: NextRequest) {
  const country = request.geo?.country || 'US';
  const city = request.geo?.city || 'Unknown';

  return Response.json({
    country,
    city,
    region: request.geo?.region,
    timestamp: new Date().toISOString(),
  });
}
// middleware.ts — Edge middleware for auth/redirects
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  // Block non-US traffic from admin
  if (request.nextUrl.pathname.startsWith('/admin')) {
    if (request.geo?.country !== 'US') {
      return NextResponse.redirect(new URL('/blocked', request.url));
    }
  }

  // Add security headers
  const response = NextResponse.next();
  response.headers.set('X-Request-Id', crypto.randomUUID());
  return response;
}

export const config = {
  matcher: ['/admin/:path*', '/api/:path*'],
};

GitHub Actions Integration

# .github/workflows/preview.yml
name: Vercel Preview
on: pull_request

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - run: npm ci
      - run: npm run lint
      - run: npm run test

      - name: Deploy to Vercel Preview
        id: deploy
        run: |
          npm i -g vercel
          URL=$(vercel --token ${{ secrets.VERCEL_TOKEN }} --yes)
          echo "url=$URL" >> "$GITHUB_OUTPUT"

      - name: Comment PR with preview URL
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,

…
Câu hỏi thường gặp

Tôi có phải trả tiền để dùng Vercel không?

Không, gói miễn phí đủ cho hầu hết các dự án cá nhân và nhỏ.

Tôi có thể triển khai những loại website nào?

Các website được xây dựng bằng Next.js, SvelteKit, Nuxt hoặc các website tĩnh đơn giản.

‘Preview environments’ (môi trường xem trước) là gì?

Đó là các phiên bản tạm thời của website được tạo tự động cho mỗi thay đổi bạn gửi, giúp bạn xem trước giao diện trước khi nó được đưa vào phiên bản chính.

Chi tiết

Mô tả gốc của tác giả

Deploy frontend and full-stack apps on Vercel with previews, edge functions, environment promotion, and production guardrails.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#6104
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự