vercel-deployment

Configure and deploy Next.js applications to Vercel with edge and serverless runtimes.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill vercel-deployment-duccuong159
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-deployment
Source: https://github.com/DucCuong159/Realtime-chatapp/tree/main/.agent/skills/vercel-deployment
Command: npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill vercel-deployment-duccuong159

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deploying Next.js applications to Vercel involves many pitfalls: leaked secrets via NEXT_PUBLIC_ variables, edge runtime incompatibilities, cold start issues, caching confusion, and environment misconfiguration. This Skill provides expert patterns and sharp-edge warnings to deploy correctly the first time. ## Core Features & Use Cases - Environment Variable Management: Correctly separate public, private, and per-environment (development/preview/production) variables. - Runtime Selection Guidance: Choose between Edge and Node.js serverless runtimes based on API compatibility and cold-start requirements. - Troubleshooting Playbooks: Diagnose CORS errors, function timeouts, stale cached pages, oversized bundles, and missing runtime env vars. - Use Case: A team setting up preview deployments for pull requests uses this Skill to configure separate staging databases, protect preview URLs, and avoid corrupting production data. ## Quick Start Ask the AI to review your Next.js project configuration and guide you through deploying it to Vercel with proper environment variables and runtime settings.

Frequently Asked Questions about vercel-deployment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Next.js app to Vercel with environment variables?

Configure environment variables in the Vercel Dashboard under Settings, separating Development, Preview, and Production values. Use NEXT_PUBLIC_ only for browser-safe values and keep secrets like database URLs server-only.

Edge runtime vs serverless in Next.js, which should I use?

Use the edge runtime for fast cold starts and simple tasks like auth checks or redirects. Use the Node.js serverless runtime when you need full Node APIs such as fs, database drivers, or heavy computation.

Why is my NEXT_PUBLIC_ environment variable a security risk?

NEXT_PUBLIC_ variables are inlined into the JavaScript bundle at build time and visible in browser DevTools. Never use this prefix for service role keys, database URLs, or JWT secrets; access those only in server-side code.

Why does my Vercel serverless function have slow cold starts?

Slow cold starts usually come from large function bundles exceeding efficient size limits, often caused by heavy dependencies like puppeteer or sharp. Use dynamic imports, the edge runtime, or external services for heavy processing.

How do I fix CORS errors on Vercel API routes?

Add Access-Control-Allow-Origin, Allow-Methods, and Allow-Headers headers to your API route responses, and implement an OPTIONS handler for preflight requests. You can also set headers globally in next.config.js for all /api routes.

Why does my Vercel page show stale data after deployment?

Vercel caches pages aggressively at the edge, so old versions may be served until the cache expires. Use export const revalidate, force-dynamic, or on-demand revalidation with revalidatePath and revalidateTag to control freshness.