Deploy, configure, and manage web applications and serverless architectures on Vercel. Use when configuring vercel.json, managing environment variables, configuring custom domains, setting up edge/serverless functions, debugging builds, or automating deployments via Vercel CLI.
72
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Comprehensive guide and operational runbook for deploying, configuring, and optimizing modern full-stack web applications on Vercel.
Always reference the official documentation and upstream skills for the latest CLI syntax, runtime flags, and platform specifications:
/vercel/vercel — use npx ctx7@latest docs /vercel/vercel "<query>" for live API and CLI lookups.Activate this skill when:
vercel.json (rewrites, redirects, custom headers, security policies, cron jobs, edge functions).development, preview, and production scopes./api/*) or Edge Runtime endpoints.504 GATEWAY_TIMEOUT).npm i -g vercel
# or
npx vercel <command>vercel loginpackage.json "engines" or project settings).To link a local repository to a remote Vercel project non-interactively or interactively:
# Interactive linking
vercel link
# Non-interactive linking with project and org tokens
vercel link --project <project-name> --scope <team-slug> --yesThis creates .vercel/project.json containing projectId and orgId. Add .vercel to your .gitignore:
.vercel
.env*.localManage environment variables across environments without visiting the dashboard.
# Downloads production/preview environment variables into .env.local
vercel env pull
# Pull specific environment into designated file
vercel env pull .env.development.local --environment=development# Add variable interactively
vercel env add DATABASE_URL production
# Non-interactive addition with explicit values
vercel env add NEXT_PUBLIC_API_URL production --value "https://api.example.com" --yes
echo "super-secret-key" | vercel env add JWT_SECRET production preview --yes
# Update an existing variable
vercel env update DATABASE_URL production --value "postgres://user:pass@host:5432/db" --yes
# List and remove variables
vercel env ls
vercel env rm OLD_TOKEN production --yesvercel.json ConfigurationThe vercel.json configuration file controls routing, header policies, runtime resource allocation, and scheduled jobs.
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"cleanUrls": true,
"trailingSlash": false,
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" },
{ "key": "Permissions-Policy", "value": "camera=(), microphone=(), geolocation=()" }
]
},
{
"source": "/assets/(.*)",
"headers": [
{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
]
}
],
"redirects": [
{
"source": "/old-path",
"destination": "/new-path",
"permanent": true
}
],
"rewrites": [
{
"source": "/api/proxy/:path*",
"destination": "https://external-service.internal/:path*"
}
],
"functions": {
"api/**/*.ts": {
"memory": 1024,
"maxDuration": 15
}
},
"crons": [
{
"path": "/api/cron/cleanup",
"schedule": "0 2 * * *"
}
]
}Detailed architectural templates can be found in vercel-config-patterns.md.
Triggers a preview deployment from the current working directory, generating a unique preview URL:
vercelDeploys directly to production domains:
vercel --prodFor high-performance CI/CD builds, prebuild artifacts before uploading:
# 1. Pull environment info and settings
vercel pull --yes --environment=production
# 2. Build artifacts locally or inside runner
vercel build --prod
# 3. Deploy prebuilt artifacts instantly
vercel deploy --prebuilt --prodVercel automatically provisions routes defined in the /api directory:
api/health.ts)import type { VercelRequest, VercelResponse } from '@vercel/node';
export default async function handler(req: VercelRequest, res: VercelResponse) {
if (req.method !== 'GET') {
return res.status(405).json({ error: 'Method not allowed' });
}
return res.status(200).json({
status: 'ok',
timestamp: new Date().toISOString(),
region: process.env.VERCEL_REGION || 'local'
});
}api/edge-geo.ts)export const config = {
runtime: 'edge',
};
export default function handler(request: Request) {
const country = request.headers.get('x-vercel-ip-country') || 'US';
const city = request.headers.get('x-vercel-ip-city') || 'Unknown';
return new Response(
JSON.stringify({ country, city, edge: true }),
{
headers: { 'Content-Type': 'application/json' },
status: 200,
}
);
}When using the crons array in vercel.json, verify incoming requests using the CRON_SECRET header:
import type { VercelRequest, VercelResponse } from '@vercel/node';
export default async function handler(req: VercelRequest, res: VercelResponse) {
const authHeader = req.headers['authorization'];
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
return res.status(401).json({ error: 'Unauthorized' });
}
// Execute scheduled batch logic
return res.status(200).json({ success: true, processed: 100 });
}Sample production workflow using Vercel CLI with GitHub Actions:
name: Vercel Production Deployment
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}NEXT_PUBLIC_ or VITE_ if they are strictly required in the browser. All database credentials, internal endpoints, and private keys must remain un-prefixed."maxDuration" in vercel.json (within plan limits: Hobby up to 60s, Pro up to 300s)./static/*, /_next/static/*) and use stale-while-revalidate for dynamic pages.--prebuilt in CI: Avoid rebuilding in Vercel's cloud if your CI already runs tests and builds. Prebuilding guarantees that the exact code tested in CI is deployed.fs, child_process). Use the standard Serverless Runtime for Node-specific dependencies.x-vercel-protection-bypass: <secret> in request headers..vercel Folder: Never commit .vercel/project.json or credentials to public source control.Execute these commands to verify configuration and deployment status:
# Check current project link status
vercel project ls
# Tail live deployment execution logs
vercel logs <deployment-url-or-id> --follow
# Inspect domain routing and SSL status
vercel domains inspect <your-domain.com>
# Inspect response headers with curl
curl -I https://<your-project>.vercel.app
# Verify presence of 'x-vercel-id', 'x-vercel-cache', and security headers87555db
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.