@intentsolutionsio/vercel-pack 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +67 -44
- package/package.json +4 -4
- package/skills/vercel-advanced-troubleshooting/SKILL.md +185 -195
- package/skills/vercel-advanced-troubleshooting/references/errors.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
- package/skills/vercel-advanced-troubleshooting/references/examples.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/systematic-isolation.md +56 -0
- package/skills/vercel-advanced-troubleshooting/references/timing-analysis.md +35 -0
- package/skills/vercel-architecture-variants/SKILL.md +227 -216
- package/skills/vercel-architecture-variants/references/errors.md +11 -0
- package/skills/vercel-architecture-variants/references/examples.md +12 -0
- package/skills/vercel-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
- package/skills/vercel-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
- package/skills/vercel-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
- package/skills/vercel-ci-integration/SKILL.md +183 -73
- package/skills/vercel-ci-integration/references/errors.md +10 -0
- package/skills/vercel-ci-integration/references/examples.md +36 -0
- package/skills/vercel-ci-integration/references/implementation.md +54 -0
- package/skills/vercel-common-errors/SKILL.md +164 -60
- package/skills/vercel-common-errors/references/errors.md +53 -0
- package/skills/vercel-common-errors/references/examples.md +23 -0
- package/skills/vercel-cost-tuning/SKILL.md +158 -145
- package/skills/vercel-cost-tuning/references/cost-estimation.md +34 -0
- package/skills/vercel-cost-tuning/references/cost-reduction-strategies.md +40 -0
- package/skills/vercel-cost-tuning/references/errors.md +11 -0
- package/skills/vercel-cost-tuning/references/examples.md +15 -0
- package/skills/vercel-data-handling/SKILL.md +202 -155
- package/skills/vercel-data-handling/references/errors.md +11 -0
- package/skills/vercel-data-handling/references/examples.md +27 -0
- package/skills/vercel-data-handling/references/implementation.md +223 -0
- package/skills/vercel-debug-bundle/SKILL.md +163 -67
- package/skills/vercel-debug-bundle/references/errors.md +12 -0
- package/skills/vercel-debug-bundle/references/examples.md +24 -0
- package/skills/vercel-debug-bundle/references/implementation.md +54 -0
- package/skills/vercel-deploy-integration/SKILL.md +163 -156
- package/skills/vercel-deploy-integration/references/errors.md +11 -0
- package/skills/vercel-deploy-integration/references/examples.md +21 -0
- package/skills/vercel-deploy-integration/references/google-cloud-run.md +36 -0
- package/skills/vercel-deploy-integration/references/vercel-deployment.md +35 -0
- package/skills/vercel-deploy-preview/SKILL.md +164 -39
- package/skills/vercel-edge-functions/SKILL.md +185 -37
- package/skills/vercel-enterprise-rbac/SKILL.md +185 -170
- package/skills/vercel-enterprise-rbac/references/errors.md +11 -0
- package/skills/vercel-enterprise-rbac/references/examples.md +12 -0
- package/skills/vercel-enterprise-rbac/references/role-implementation.md +33 -0
- package/skills/vercel-enterprise-rbac/references/sso-integration.md +35 -0
- package/skills/vercel-hello-world/SKILL.md +141 -55
- package/skills/vercel-incident-runbook/SKILL.md +186 -138
- package/skills/vercel-incident-runbook/references/errors.md +11 -0
- package/skills/vercel-incident-runbook/references/examples.md +10 -0
- package/skills/vercel-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
- package/skills/vercel-install-auth/SKILL.md +130 -53
- package/skills/vercel-known-pitfalls/SKILL.md +235 -233
- package/skills/vercel-known-pitfalls/references/errors.md +11 -0
- package/skills/vercel-known-pitfalls/references/examples.md +12 -0
- package/skills/vercel-load-scale/SKILL.md +197 -204
- package/skills/vercel-load-scale/references/capacity-planning.md +47 -0
- package/skills/vercel-load-scale/references/errors.md +11 -0
- package/skills/vercel-load-scale/references/examples.md +26 -0
- package/skills/vercel-load-scale/references/load-testing-with-k6.md +59 -0
- package/skills/vercel-load-scale/references/scaling-patterns.md +65 -0
- package/skills/vercel-local-dev-loop/SKILL.md +159 -71
- package/skills/vercel-local-dev-loop/references/errors.md +11 -0
- package/skills/vercel-local-dev-loop/references/examples.md +21 -0
- package/skills/vercel-local-dev-loop/references/implementation.md +60 -0
- package/skills/vercel-migration-deep-dive/SKILL.md +202 -187
- package/skills/vercel-migration-deep-dive/references/errors.md +11 -0
- package/skills/vercel-migration-deep-dive/references/examples.md +12 -0
- package/skills/vercel-migration-deep-dive/references/implementation-plan.md +80 -0
- package/skills/vercel-migration-deep-dive/references/pre-migration-assessment.md +39 -0
- package/skills/vercel-multi-env-setup/SKILL.md +167 -164
- package/skills/vercel-multi-env-setup/references/configuration-structure.md +59 -0
- package/skills/vercel-multi-env-setup/references/errors.md +11 -0
- package/skills/vercel-multi-env-setup/references/examples.md +11 -0
- package/skills/vercel-observability/SKILL.md +205 -195
- package/skills/vercel-observability/references/alert-configuration.md +40 -0
- package/skills/vercel-observability/references/errors.md +11 -0
- package/skills/vercel-observability/references/examples.md +13 -0
- package/skills/vercel-observability/references/metrics-collection.md +65 -0
- package/skills/vercel-performance-tuning/SKILL.md +212 -156
- package/skills/vercel-performance-tuning/references/caching-strategy.md +49 -0
- package/skills/vercel-performance-tuning/references/errors.md +11 -0
- package/skills/vercel-performance-tuning/references/examples.md +13 -0
- package/skills/vercel-policy-guardrails/SKILL.md +276 -193
- package/skills/vercel-policy-guardrails/references/errors.md +11 -0
- package/skills/vercel-policy-guardrails/references/eslint-rules.md +46 -0
- package/skills/vercel-policy-guardrails/references/examples.md +10 -0
- package/skills/vercel-prod-checklist/SKILL.md +219 -94
- package/skills/vercel-prod-checklist/references/errors.md +11 -0
- package/skills/vercel-prod-checklist/references/examples.md +25 -0
- package/skills/vercel-prod-checklist/references/implementation.md +60 -0
- package/skills/vercel-rate-limits/SKILL.md +187 -100
- package/skills/vercel-rate-limits/references/errors.md +11 -0
- package/skills/vercel-rate-limits/references/examples.md +46 -0
- package/skills/vercel-rate-limits/references/implementation.md +66 -0
- package/skills/vercel-reference-architecture/SKILL.md +226 -180
- package/skills/vercel-reference-architecture/references/errors.md +11 -0
- package/skills/vercel-reference-architecture/references/examples.md +13 -0
- package/skills/vercel-reference-architecture/references/key-components.md +65 -0
- package/skills/vercel-reference-architecture/references/project-structure.md +40 -0
- package/skills/vercel-reliability-patterns/SKILL.md +272 -211
- package/skills/vercel-reliability-patterns/references/circuit-breaker.md +36 -0
- package/skills/vercel-reliability-patterns/references/dead-letter-queue.md +48 -0
- package/skills/vercel-reliability-patterns/references/errors.md +11 -0
- package/skills/vercel-reliability-patterns/references/examples.md +11 -0
- package/skills/vercel-reliability-patterns/references/idempotency-keys.md +36 -0
- package/skills/vercel-sdk-patterns/SKILL.md +264 -92
- package/skills/vercel-sdk-patterns/references/errors.md +11 -0
- package/skills/vercel-sdk-patterns/references/examples.md +45 -0
- package/skills/vercel-sdk-patterns/references/implementation.md +67 -0
- package/skills/vercel-security-basics/SKILL.md +186 -96
- package/skills/vercel-security-basics/references/errors.md +10 -0
- package/skills/vercel-security-basics/references/examples.md +70 -0
- package/skills/vercel-security-basics/references/implementation.md +39 -0
- package/skills/vercel-upgrade-migration/SKILL.md +167 -67
- package/skills/vercel-upgrade-migration/references/errors.md +10 -0
- package/skills/vercel-upgrade-migration/references/examples.md +51 -0
- package/skills/vercel-upgrade-migration/references/implementation.md +29 -0
- package/skills/vercel-webhooks-events/SKILL.md +208 -132
- package/skills/vercel-webhooks-events/references/errors.md +11 -0
- package/skills/vercel-webhooks-events/references/event-handler-pattern.md +37 -0
- package/skills/vercel-webhooks-events/references/examples.md +16 -0
- package/skills/vercel-webhooks-events/references/signature-verification.md +33 -0
|
@@ -1,222 +1,225 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vercel-multi-env-setup
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
description: 'Configure Vercel across development, preview, and production environments
|
|
4
|
+
with scoped secrets.
|
|
5
|
+
|
|
6
|
+
Use when setting up per-environment configuration, managing environment-specific
|
|
7
|
+
variables,
|
|
8
|
+
|
|
9
|
+
or implementing environment isolation on Vercel.
|
|
10
|
+
|
|
7
11
|
Trigger with phrases like "vercel environments", "vercel staging",
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
|
|
13
|
+
"vercel dev prod", "vercel environment setup", "vercel env scoping".
|
|
14
|
+
|
|
15
|
+
'
|
|
16
|
+
allowed-tools: Read, Write, Edit, Bash(vercel:*)
|
|
10
17
|
version: 1.0.0
|
|
11
18
|
license: MIT
|
|
12
19
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
20
|
+
tags:
|
|
21
|
+
- saas
|
|
22
|
+
- vercel
|
|
23
|
+
- deployment
|
|
24
|
+
- environments
|
|
25
|
+
- configuration
|
|
26
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
13
27
|
---
|
|
14
|
-
|
|
15
|
-
# Vercel Multi-Environment Setup
|
|
28
|
+
# Vercel Multi-Env Setup
|
|
16
29
|
|
|
17
30
|
## Overview
|
|
18
|
-
Configure Vercel across development, staging, and production environments.
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
- Separate Vercel accounts or API keys per environment
|
|
22
|
-
- Secret management solution (Vault, AWS Secrets Manager, etc.)
|
|
23
|
-
- CI/CD pipeline with environment variables
|
|
24
|
-
- Environment detection in application
|
|
32
|
+
Configure Vercel's three built-in environments (Development, Preview, Production) with scoped environment variables, branch-specific preview URLs, and custom environments for staging. Uses Vercel's native environment system and the REST API for automation.
|
|
25
33
|
|
|
26
|
-
##
|
|
34
|
+
## Prerequisites
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
| Staging | Pre-prod validation | Staging keys | Test data |
|
|
32
|
-
| Production | Live traffic | Production keys | Real data |
|
|
36
|
+
- Vercel project linked and deployed
|
|
37
|
+
- Separate database instances per environment (recommended)
|
|
38
|
+
- Access to Vercel dashboard or VERCEL_TOKEN for API
|
|
33
39
|
|
|
34
|
-
##
|
|
40
|
+
## Instructions
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
config/
|
|
38
|
-
├── vercel/
|
|
39
|
-
│ ├── base.json # Shared config
|
|
40
|
-
│ ├── development.json # Dev overrides
|
|
41
|
-
│ ├── staging.json # Staging overrides
|
|
42
|
-
│ └── production.json # Prod overrides
|
|
43
|
-
```
|
|
42
|
+
### Step 1: Understand Vercel's Environment Model
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"timeout": 30000,
|
|
49
|
-
"retries": 3,
|
|
50
|
-
"cache": {
|
|
51
|
-
"enabled": true,
|
|
52
|
-
"ttlSeconds": 60
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
44
|
+
Vercel provides three built-in environments:
|
|
56
45
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"debug": true,
|
|
63
|
-
"cache": {
|
|
64
|
-
"enabled": false
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
46
|
+
| Environment | Trigger | URL Pattern | Use Case |
|
|
47
|
+
|-------------|---------|-------------|----------|
|
|
48
|
+
| Production | Push to production branch | `yourdomain.com` | Live traffic |
|
|
49
|
+
| Preview | Push to any other branch | `project-git-branch-team.vercel.app` | PR review |
|
|
50
|
+
| Development | `vercel dev` locally | `localhost:3000` | Local dev |
|
|
68
51
|
|
|
69
|
-
###
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"apiKey": "${VERCEL_API_KEY_STAGING}",
|
|
73
|
-
"baseUrl": "https://api-staging.vercel.com",
|
|
74
|
-
"debug": false
|
|
75
|
-
}
|
|
76
|
-
```
|
|
52
|
+
### Step 2: Scope Environment Variables
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"baseUrl": "https://api.vercel.com",
|
|
83
|
-
"debug": false,
|
|
84
|
-
"retries": 5
|
|
85
|
-
}
|
|
86
|
-
```
|
|
54
|
+
```bash
|
|
55
|
+
# Add a variable scoped to Production only
|
|
56
|
+
vercel env add DATABASE_URL production
|
|
57
|
+
# Enter: postgres://prod-host:5432/myapp
|
|
87
58
|
|
|
88
|
-
|
|
59
|
+
# Add a variable scoped to Preview only
|
|
60
|
+
vercel env add DATABASE_URL preview
|
|
61
|
+
# Enter: postgres://staging-host:5432/myapp_staging
|
|
89
62
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
# Add a variable scoped to Development only
|
|
64
|
+
vercel env add DATABASE_URL development
|
|
65
|
+
# Enter: postgres://localhost:5432/myapp_dev
|
|
93
66
|
|
|
94
|
-
|
|
67
|
+
# Add a variable available in ALL environments
|
|
68
|
+
vercel env add NEXT_PUBLIC_APP_NAME production preview development
|
|
69
|
+
# Enter: My App
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return validEnvs.includes(env as Environment)
|
|
100
|
-
? (env as Environment)
|
|
101
|
-
: 'development';
|
|
102
|
-
}
|
|
71
|
+
# List all env vars with their scopes
|
|
72
|
+
vercel env ls
|
|
73
|
+
```
|
|
103
74
|
|
|
104
|
-
|
|
105
|
-
const env = detectEnvironment();
|
|
106
|
-
const envConfig = require(`../../config/vercel/${env}.json`);
|
|
75
|
+
### Step 3: Via REST API (Automation)
|
|
107
76
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
```bash
|
|
78
|
+
# Create env vars with specific scoping
|
|
79
|
+
curl -X POST "https://api.vercel.com/v9/projects/my-app/env" \
|
|
80
|
+
-H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
81
|
+
-H "Content-Type: application/json" \
|
|
82
|
+
-d '{
|
|
83
|
+
"key": "DATABASE_URL",
|
|
84
|
+
"value": "postgres://prod-host:5432/myapp",
|
|
85
|
+
"type": "encrypted",
|
|
86
|
+
"target": ["production"]
|
|
87
|
+
}'
|
|
88
|
+
|
|
89
|
+
# Upsert — update if exists, create if not
|
|
90
|
+
curl -X POST "https://api.vercel.com/v9/projects/my-app/env?upsert=true" \
|
|
91
|
+
-H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
92
|
+
-H "Content-Type: application/json" \
|
|
93
|
+
-d '{
|
|
94
|
+
"key": "DATABASE_URL",
|
|
95
|
+
"value": "postgres://staging-host:5432/myapp_staging",
|
|
96
|
+
"type": "encrypted",
|
|
97
|
+
"target": ["preview"]
|
|
98
|
+
}'
|
|
99
|
+
|
|
100
|
+
# List all env vars for a project
|
|
101
|
+
curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
102
|
+
"https://api.vercel.com/v9/projects/my-app/env" \
|
|
103
|
+
| jq '.envs[] | {key, target, type}'
|
|
114
104
|
```
|
|
115
105
|
|
|
116
|
-
|
|
106
|
+
### Step 4: Custom Environments (Beyond Dev/Preview/Prod)
|
|
107
|
+
|
|
108
|
+
Vercel supports custom environments for staging, QA, etc.:
|
|
117
109
|
|
|
118
|
-
### Local Development
|
|
119
110
|
```bash
|
|
120
|
-
#
|
|
121
|
-
|
|
111
|
+
# Create a custom environment via API
|
|
112
|
+
curl -X POST "https://api.vercel.com/v1/projects/my-app/custom-environments" \
|
|
113
|
+
-H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
114
|
+
-H "Content-Type: application/json" \
|
|
115
|
+
-d '{
|
|
116
|
+
"name": "Staging",
|
|
117
|
+
"slug": "staging",
|
|
118
|
+
"branchPattern": "staging"
|
|
119
|
+
}'
|
|
122
120
|
```
|
|
123
121
|
|
|
124
|
-
|
|
125
|
-
```yaml
|
|
126
|
-
env:
|
|
127
|
-
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY_${{ matrix.environment }} }}
|
|
128
|
-
```
|
|
122
|
+
Or in the dashboard: **Settings > Environments > Create Environment**
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
# AWS Secrets Manager
|
|
133
|
-
aws secretsmanager get-secret-value --secret-id vercel/production/api-key
|
|
124
|
+
Custom environments let you:
|
|
134
125
|
|
|
135
|
-
|
|
136
|
-
|
|
126
|
+
- Link a specific Git branch to the environment
|
|
127
|
+
- Scope environment variables to it
|
|
128
|
+
- Assign a custom domain (e.g., `staging.yourdomain.com`)
|
|
137
129
|
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
### Step 5: Branch-Specific Preview Domains
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Assign a custom domain to a specific branch
|
|
134
|
+
# In dashboard: Settings > Domains > Add
|
|
135
|
+
# Set Git Branch: "staging"
|
|
136
|
+
# Domain: staging.yourdomain.com
|
|
137
|
+
|
|
138
|
+
# Via API — add domain to project with branch targeting
|
|
139
|
+
curl -X POST "https://api.vercel.com/v9/projects/my-app/domains" \
|
|
140
|
+
-H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
141
|
+
-H "Content-Type: application/json" \
|
|
142
|
+
-d '{
|
|
143
|
+
"name": "staging.yourdomain.com",
|
|
144
|
+
"gitBranch": "staging"
|
|
145
|
+
}'
|
|
140
146
|
```
|
|
141
147
|
|
|
142
|
-
|
|
148
|
+
### Step 6: Environment Detection in Code
|
|
143
149
|
|
|
144
150
|
```typescript
|
|
145
|
-
//
|
|
146
|
-
function
|
|
147
|
-
|
|
151
|
+
// src/lib/env.ts — detect environment at runtime
|
|
152
|
+
export function getEnvironment(): 'production' | 'preview' | 'development' {
|
|
153
|
+
return (process.env.VERCEL_ENV as any) ?? 'development';
|
|
154
|
+
}
|
|
148
155
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
// Environment-specific behavior
|
|
157
|
+
export function getApiBaseUrl(): string {
|
|
158
|
+
switch (getEnvironment()) {
|
|
159
|
+
case 'production':
|
|
160
|
+
return 'https://api.yourdomain.com';
|
|
161
|
+
case 'preview':
|
|
162
|
+
return `https://${process.env.VERCEL_URL}`;
|
|
163
|
+
case 'development':
|
|
164
|
+
return 'http://localhost:3000';
|
|
152
165
|
}
|
|
153
166
|
}
|
|
154
167
|
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
// Production safeguards
|
|
169
|
+
export function assertNotProduction(operation: string): void {
|
|
170
|
+
if (getEnvironment() === 'production') {
|
|
171
|
+
throw new Error(`Dangerous operation "${operation}" blocked in production`);
|
|
172
|
+
}
|
|
159
173
|
}
|
|
160
174
|
```
|
|
161
175
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
```typescript
|
|
165
|
-
const featureFlags: Record<Environment, Record<string, boolean>> = {
|
|
166
|
-
development: {
|
|
167
|
-
newFeature: true,
|
|
168
|
-
betaApi: true,
|
|
169
|
-
},
|
|
170
|
-
staging: {
|
|
171
|
-
newFeature: true,
|
|
172
|
-
betaApi: false,
|
|
173
|
-
},
|
|
174
|
-
production: {
|
|
175
|
-
newFeature: false,
|
|
176
|
-
betaApi: false,
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
```
|
|
176
|
+
### Step 7: Pull Env Vars for Local Development
|
|
180
177
|
|
|
181
|
-
|
|
178
|
+
```bash
|
|
179
|
+
# Pull Development-scoped vars to local file
|
|
180
|
+
vercel env pull .env.development.local
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
# Pull Preview-scoped vars (for testing preview behavior locally)
|
|
183
|
+
vercel env pull --environment=preview .env.preview.local
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
# .gitignore these files
|
|
186
|
+
echo '.env*.local' >> .gitignore
|
|
187
|
+
```
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
Store API keys securely using your secret management solution.
|
|
189
|
+
## Environment Variable Types
|
|
191
190
|
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
| Type | Dashboard Visibility | Log Visibility | Use Case |
|
|
192
|
+
|------|---------------------|---------------|----------|
|
|
193
|
+
| `plain` | Visible | Visible | Non-sensitive config |
|
|
194
|
+
| `encrypted` | Hidden after save | Hidden | API keys, secrets |
|
|
195
|
+
| `sensitive` | Always hidden | Hidden | High-security secrets |
|
|
196
|
+
| `system` | Auto-set by Vercel | Visible | `VERCEL_ENV`, `VERCEL_URL` |
|
|
194
197
|
|
|
195
198
|
## Output
|
|
196
|
-
- Multi-environment config structure
|
|
197
|
-
- Environment detection logic
|
|
198
|
-
- Secure secret management
|
|
199
|
-
- Production safeguards enabled
|
|
200
199
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
| Secret not found | Wrong secret path | Verify secret manager config |
|
|
206
|
-
| Config merge fails | Invalid JSON | Validate config files |
|
|
207
|
-
| Production guard triggered | Wrong environment | Check NODE_ENV value |
|
|
200
|
+
- Environment variables scoped per environment (dev/preview/prod)
|
|
201
|
+
- Custom staging environment with dedicated branch and domain
|
|
202
|
+
- Environment detection logic for runtime behavior switching
|
|
203
|
+
- Local development env vars pulled from Vercel
|
|
208
204
|
|
|
209
|
-
##
|
|
205
|
+
## Error Handling
|
|
210
206
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
| Error | Cause | Solution |
|
|
208
|
+
|-------|-------|----------|
|
|
209
|
+
| Env var undefined in preview | Not scoped to Preview target | Re-add with Preview in target array |
|
|
210
|
+
| Wrong database in production | Preview DB URL used in prod | Check env var scoping per environment |
|
|
211
|
+
| `vercel env pull` empty | No Development-scoped vars | Add vars with Development target |
|
|
212
|
+
| Custom env not triggering | Branch pattern doesn't match | Check branch name matches environment slug |
|
|
213
|
+
| Sensitive var can't be read | type=sensitive hides value | Re-add the var if value is lost |
|
|
216
214
|
|
|
217
215
|
## Resources
|
|
218
|
-
|
|
219
|
-
- [
|
|
216
|
+
|
|
217
|
+
- [Environment Variables](https://vercel.com/docs/environment-variables)
|
|
218
|
+
- [Environments](https://vercel.com/docs/deployments/environments)
|
|
219
|
+
- [System Environment Variables](https://vercel.com/docs/environment-variables/system-environment-variables)
|
|
220
|
+
- [Managing Environment Variables](https://vercel.com/docs/environment-variables/managing-environment-variables)
|
|
221
|
+
- [REST API: Environment Variables](https://vercel.com/docs/rest-api/sdk/examples/environment-variables)
|
|
220
222
|
|
|
221
223
|
## Next Steps
|
|
222
|
-
|
|
224
|
+
|
|
225
|
+
For observability and monitoring, see `vercel-observability`.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Configuration Structure
|
|
2
|
+
|
|
3
|
+
## Configuration Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
config/
|
|
7
|
+
├── vercel/
|
|
8
|
+
│ ├── base.json # Shared config
|
|
9
|
+
│ ├── development.json # Dev overrides
|
|
10
|
+
│ ├── staging.json # Staging overrides
|
|
11
|
+
│ └── production.json # Prod overrides
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### base.json
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"timeout": 30000,
|
|
19
|
+
"retries": 3,
|
|
20
|
+
"cache": {
|
|
21
|
+
"enabled": true,
|
|
22
|
+
"ttlSeconds": 60
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### development.json
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"apiKey": "${VERCEL_API_KEY}",
|
|
32
|
+
"baseUrl": "https://api-sandbox.vercel.com",
|
|
33
|
+
"debug": true,
|
|
34
|
+
"cache": {
|
|
35
|
+
"enabled": false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### staging.json
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"apiKey": "${VERCEL_API_KEY_STAGING}",
|
|
45
|
+
"baseUrl": "https://api-staging.vercel.com",
|
|
46
|
+
"debug": false
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### production.json
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"apiKey": "${VERCEL_API_KEY_PROD}",
|
|
55
|
+
"baseUrl": "https://api.vercel.com",
|
|
56
|
+
"debug": false,
|
|
57
|
+
"retries": 5
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Error Handling Reference
|
|
2
|
+
|
|
3
|
+
| Issue | Cause | Solution |
|
|
4
|
+
|-------|-------|----------|
|
|
5
|
+
| Wrong environment | Missing NODE_ENV | Set environment variable |
|
|
6
|
+
| Secret not found | Wrong secret path | Verify secret manager config |
|
|
7
|
+
| Config merge fails | Invalid JSON | Validate config files |
|
|
8
|
+
| Production guard triggered | Wrong environment | Check NODE_ENV value |
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
### Quick Environment Check
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const env = getVercelConfig();
|
|
7
|
+
console.log(`Running in ${env.environment} with ${env.baseUrl}`);
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|