deploying-vercel
SKILL.md
Deploying on Vercel
When to use this skill
- When the user mentions "Vercel", "deployment", or "hosting" (for web apps).
- When the user asks to "ship it", "go live", or "publish" a Next.js/React/Vue/Vite app.
- When configuring
vercel.json(rewrites, headers, redirects). - When setting up Vercel Functions (Edge or Serverless).
Workflow
- Installation & Login:
npm i -g vercelvercel login
- Deployment:
- Preview: Run
vercelin the project root to deploy a preview URL. - Production: Run
vercel --prodto deploy to the production domain. - Git Integration: Push to the connected Git branch (e.g.,
main) for automatic deployment.
- Preview: Run
- Project Configuration:
- Use
vercel linkto link a local folder to a Vercel project. - Use
vercel env pullto download environment variables to.env.local.
- Use
- Local Development:
vercel devreplicates the Vercel environment locally (including Serverless Functions).
Instructions
Project Structure (Vite/Static)
Vercel automatically detects most frameworks. For strict control, ensure your package.json has a build script (e.g., vite build).
vercel.json Configuration
Use this file for routing and caching headers.
{
"rewrites": [
{ "source": "/api/:match*", "destination": "https://api.backend.com/:match*" },
{ "source": "/(.*)", "destination": "/index.html" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "Cache-Control", "value": "public, max-age=0, must-revalidate" }
]
}
]
}
Note: For single-page apps (SPA) like Vite/React, the rewrite to /index.html is crucial if not using the default framework output.
Serverless Functions
- Place files in
api/:api/hello.js-> mapped to/api/hello
- Edge Functions:
- Use
export const config = { runtime: 'edge' };in your function file.
- Use
Environment Variables
- Manage via Dashboard: Settings > Environment Variables.
- Important: Do not commit
.envfiles. Usevercel env pullto get them locally.
Troubleshooting
- Build Fails: Check
npm run buildlocally first. - 404 on Routes: Ensure SPAs have a rewrite to
/index.html. - CORS Issues: Add CORS headers in
vercel.jsonor your API function.
Resources
Weekly Installs
2
Repository
pauloviccs/vicc…screatorGitHub Stars
3
First Seen
14 days ago
Security Audits
Installed on
trae2
gemini-cli2
claude-code2
github-copilot2
codex2
kimi-cli2