Configure Vercel across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Vercel configurations. Trigger with phrases like "vercel environments", "vercel staging", "vercel dev prod", "vercel environment setup", "vercel config by env".
/plugin marketplace add jeremylongshore/claude-code-plugins-plus-skills/plugin install vercel-pack@claude-code-plugins-plusThis skill is limited to using the following tools:
Configure Vercel across development, staging, and production environments.
| Environment | Purpose | API Keys | Data |
|---|---|---|---|
| Development | Local dev | Test keys | Sandbox |
| Staging | Pre-prod validation | Staging keys | Test data |
| Production | Live traffic | Production keys | Real data |
config/
├── vercel/
│ ├── base.json # Shared config
│ ├── development.json # Dev overrides
│ ├── staging.json # Staging overrides
│ └── production.json # Prod overrides
{
"timeout": 30000,
"retries": 3,
"cache": {
"enabled": true,
"ttlSeconds": 60
}
}
{
"apiKey": "${VERCEL_API_KEY}",
"baseUrl": "https://api-sandbox.vercel.com",
"debug": true,
"cache": {
"enabled": false
}
}
{
"apiKey": "${VERCEL_API_KEY_STAGING}",
"baseUrl": "https://api-staging.vercel.com",
"debug": false
}
{
"apiKey": "${VERCEL_API_KEY_PROD}",
"baseUrl": "https://api.vercel.com",
"debug": false,
"retries": 5
}
// src/vercel/config.ts
import baseConfig from '../../config/vercel/base.json';
type Environment = 'development' | 'staging' | 'production';
function detectEnvironment(): Environment {
const env = process.env.NODE_ENV || 'development';
const validEnvs: Environment[] = ['development', 'staging', 'production'];
return validEnvs.includes(env as Environment)
? (env as Environment)
: 'development';
}
export function getVercelConfig() {
const env = detectEnvironment();
const envConfig = require(`../../config/vercel/${env}.json`);
return {
...baseConfig,
...envConfig,
environment: env,
};
}
# .env.local (git-ignored)
VERCEL_API_KEY=sk_test_dev_***
env:
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY_${{ matrix.environment }} }}
# AWS Secrets Manager
aws secretsmanager get-secret-value --secret-id vercel/production/api-key
# GCP Secret Manager
gcloud secrets versions access latest --secret=vercel-api-key
# HashiCorp Vault
vault kv get -field=api_key secret/vercel/production
// Prevent production operations in non-prod
function guardProductionOperation(operation: string): void {
const config = getVercelConfig();
if (config.environment !== 'production') {
console.warn(`[vercel] ${operation} blocked in ${config.environment}`);
throw new Error(`${operation} only allowed in production`);
}
}
// Usage
async function deleteAllData() {
guardProductionOperation('deleteAllData');
// Dangerous operation here
}
const featureFlags: Record<Environment, Record<string, boolean>> = {
development: {
newFeature: true,
betaApi: true,
},
staging: {
newFeature: true,
betaApi: false,
},
production: {
newFeature: false,
betaApi: false,
},
};
Set up the base and per-environment configuration files.
Add logic to detect and load environment-specific config.
Store API keys securely using your secret management solution.
Implement safeguards for production-only operations.
| Issue | Cause | Solution |
|---|---|---|
| Wrong environment | Missing NODE_ENV | Set environment variable |
| Secret not found | Wrong secret path | Verify secret manager config |
| Config merge fails | Invalid JSON | Validate config files |
| Production guard triggered | Wrong environment | Check NODE_ENV value |
const env = getVercelConfig();
console.log(`Running in ${env.environment} with ${env.baseUrl}`);
For observability setup, see vercel-observability.