@intentsolutionsio/vercel-pack 1.0.0
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/.claude-plugin/plugin.json +17 -0
- package/000-docs/001-BL-LICN-license.txt +3 -0
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/package.json +43 -0
- package/skills/vercel-advanced-troubleshooting/SKILL.md +261 -0
- package/skills/vercel-architecture-variants/SKILL.md +284 -0
- package/skills/vercel-ci-integration/SKILL.md +124 -0
- package/skills/vercel-common-errors/SKILL.md +109 -0
- package/skills/vercel-cost-tuning/SKILL.md +201 -0
- package/skills/vercel-data-handling/SKILL.md +220 -0
- package/skills/vercel-debug-bundle/SKILL.md +111 -0
- package/skills/vercel-deploy-integration/SKILL.md +209 -0
- package/skills/vercel-deploy-preview/SKILL.md +71 -0
- package/skills/vercel-edge-functions/SKILL.md +73 -0
- package/skills/vercel-enterprise-rbac/SKILL.md +222 -0
- package/skills/vercel-hello-world/SKILL.md +96 -0
- package/skills/vercel-incident-runbook/SKILL.md +203 -0
- package/skills/vercel-install-auth/SKILL.md +90 -0
- package/skills/vercel-known-pitfalls/SKILL.md +334 -0
- package/skills/vercel-load-scale/SKILL.md +274 -0
- package/skills/vercel-local-dev-loop/SKILL.md +117 -0
- package/skills/vercel-migration-deep-dive/SKILL.md +244 -0
- package/skills/vercel-multi-env-setup/SKILL.md +222 -0
- package/skills/vercel-observability/SKILL.md +250 -0
- package/skills/vercel-performance-tuning/SKILL.md +214 -0
- package/skills/vercel-policy-guardrails/SKILL.md +257 -0
- package/skills/vercel-prod-checklist/SKILL.md +119 -0
- package/skills/vercel-rate-limits/SKILL.md +149 -0
- package/skills/vercel-reference-architecture/SKILL.md +238 -0
- package/skills/vercel-reliability-patterns/SKILL.md +290 -0
- package/skills/vercel-sdk-patterns/SKILL.md +147 -0
- package/skills/vercel-security-basics/SKILL.md +140 -0
- package/skills/vercel-upgrade-migration/SKILL.md +112 -0
- package/skills/vercel-webhooks-events/SKILL.md +199 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vercel-load-scale
|
|
3
|
+
description: |
|
|
4
|
+
Implement Vercel load testing, auto-scaling, and capacity planning strategies.
|
|
5
|
+
Use when running performance tests, configuring horizontal scaling,
|
|
6
|
+
or planning capacity for Vercel integrations.
|
|
7
|
+
Trigger with phrases like "vercel load test", "vercel scale",
|
|
8
|
+
"vercel performance test", "vercel capacity", "vercel k6", "vercel benchmark".
|
|
9
|
+
allowed-tools: Read, Write, Edit, Bash(k6:*), Bash(kubectl:*)
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Vercel Load & Scale
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Load testing, scaling strategies, and capacity planning for Vercel integrations.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- k6 load testing tool installed
|
|
22
|
+
- Kubernetes cluster with HPA configured
|
|
23
|
+
- Prometheus for metrics collection
|
|
24
|
+
- Test environment API keys
|
|
25
|
+
|
|
26
|
+
## Load Testing with k6
|
|
27
|
+
|
|
28
|
+
### Basic Load Test
|
|
29
|
+
```javascript
|
|
30
|
+
// vercel-load-test.js
|
|
31
|
+
import http from 'k6/http';
|
|
32
|
+
import { check, sleep } from 'k6';
|
|
33
|
+
|
|
34
|
+
export const options = {
|
|
35
|
+
stages: [
|
|
36
|
+
{ duration: '2m', target: 10 }, // Ramp up
|
|
37
|
+
{ duration: '5m', target: 10 }, // Steady state
|
|
38
|
+
{ duration: '2m', target: 50 }, // Ramp to peak
|
|
39
|
+
{ duration: '5m', target: 50 }, // Stress test
|
|
40
|
+
{ duration: '2m', target: 0 }, // Ramp down
|
|
41
|
+
],
|
|
42
|
+
thresholds: {
|
|
43
|
+
http_req_duration: ['p(95)<100'],
|
|
44
|
+
http_req_failed: ['rate<0.01'],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default function () {
|
|
49
|
+
const response = http.post(
|
|
50
|
+
'https://api.vercel.com/v1/resource',
|
|
51
|
+
JSON.stringify({ test: true }),
|
|
52
|
+
{
|
|
53
|
+
headers: {
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
'Authorization': `Bearer ${__ENV.VERCEL_API_KEY}`,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
check(response, {
|
|
61
|
+
'status is 200': (r) => r.status === 200,
|
|
62
|
+
'latency < 100ms': (r) => r.timings.duration < 100,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
sleep(1);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Run Load Test
|
|
70
|
+
```bash
|
|
71
|
+
# Install k6
|
|
72
|
+
brew install k6 # macOS
|
|
73
|
+
# or: sudo apt install k6 # Linux
|
|
74
|
+
|
|
75
|
+
# Run test
|
|
76
|
+
k6 run --env VERCEL_API_KEY=${VERCEL_API_KEY} vercel-load-test.js
|
|
77
|
+
|
|
78
|
+
# Run with output to InfluxDB
|
|
79
|
+
k6 run --out influxdb=http://localhost:8086/k6 vercel-load-test.js
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Scaling Patterns
|
|
83
|
+
|
|
84
|
+
### Horizontal Scaling
|
|
85
|
+
```yaml
|
|
86
|
+
# kubernetes HPA
|
|
87
|
+
apiVersion: autoscaling/v2
|
|
88
|
+
kind: HorizontalPodAutoscaler
|
|
89
|
+
metadata:
|
|
90
|
+
name: vercel-integration-hpa
|
|
91
|
+
spec:
|
|
92
|
+
scaleTargetRef:
|
|
93
|
+
apiVersion: apps/v1
|
|
94
|
+
kind: Deployment
|
|
95
|
+
name: vercel-integration
|
|
96
|
+
minReplicas: 2
|
|
97
|
+
maxReplicas: 20
|
|
98
|
+
metrics:
|
|
99
|
+
- type: Resource
|
|
100
|
+
resource:
|
|
101
|
+
name: cpu
|
|
102
|
+
target:
|
|
103
|
+
type: Utilization
|
|
104
|
+
averageUtilization: 70
|
|
105
|
+
- type: Pods
|
|
106
|
+
pods:
|
|
107
|
+
metric:
|
|
108
|
+
name: vercel_queue_depth
|
|
109
|
+
target:
|
|
110
|
+
type: AverageValue
|
|
111
|
+
averageValue: 100
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Connection Pooling
|
|
115
|
+
```typescript
|
|
116
|
+
import { Pool } from 'generic-pool';
|
|
117
|
+
|
|
118
|
+
const vercelPool = Pool.create({
|
|
119
|
+
create: async () => {
|
|
120
|
+
return new VercelClient({
|
|
121
|
+
apiKey: process.env.VERCEL_API_KEY!,
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
destroy: async (client) => {
|
|
125
|
+
await client.close();
|
|
126
|
+
},
|
|
127
|
+
max: None,
|
|
128
|
+
min: None,
|
|
129
|
+
idleTimeoutMillis: 30000,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
async function withVercelClient<T>(
|
|
133
|
+
fn: (client: VercelClient) => Promise<T>
|
|
134
|
+
): Promise<T> {
|
|
135
|
+
const client = await vercelPool.acquire();
|
|
136
|
+
try {
|
|
137
|
+
return await fn(client);
|
|
138
|
+
} finally {
|
|
139
|
+
vercelPool.release(client);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Capacity Planning
|
|
145
|
+
|
|
146
|
+
### Metrics to Monitor
|
|
147
|
+
| Metric | Warning | Critical |
|
|
148
|
+
|--------|---------|----------|
|
|
149
|
+
| CPU Utilization | > 70% | > 85% |
|
|
150
|
+
| Memory Usage | > 75% | > 90% |
|
|
151
|
+
| Request Queue Depth | > 100 | > 500 |
|
|
152
|
+
| Error Rate | > 1% | > 5% |
|
|
153
|
+
| P95 Latency | > 500ms | > 2000ms |
|
|
154
|
+
|
|
155
|
+
### Capacity Calculation
|
|
156
|
+
```typescript
|
|
157
|
+
interface CapacityEstimate {
|
|
158
|
+
currentRPS: number;
|
|
159
|
+
maxRPS: number;
|
|
160
|
+
headroom: number;
|
|
161
|
+
scaleRecommendation: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function estimateVercelCapacity(
|
|
165
|
+
metrics: SystemMetrics
|
|
166
|
+
): CapacityEstimate {
|
|
167
|
+
const currentRPS = metrics.requestsPerSecond;
|
|
168
|
+
const avgLatency = metrics.p50Latency;
|
|
169
|
+
const cpuUtilization = metrics.cpuPercent;
|
|
170
|
+
|
|
171
|
+
// Estimate max RPS based on current performance
|
|
172
|
+
const maxRPS = currentRPS / (cpuUtilization / 100) * 0.7; // 70% target
|
|
173
|
+
const headroom = ((maxRPS - currentRPS) / currentRPS) * 100;
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
currentRPS,
|
|
177
|
+
maxRPS: Math.floor(maxRPS),
|
|
178
|
+
headroom: Math.round(headroom),
|
|
179
|
+
scaleRecommendation: headroom < 30
|
|
180
|
+
? 'Scale up soon'
|
|
181
|
+
: headroom < 50
|
|
182
|
+
? 'Monitor closely'
|
|
183
|
+
: 'Adequate capacity',
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Benchmark Results Template
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
## Vercel Performance Benchmark
|
|
192
|
+
**Date:** YYYY-MM-DD
|
|
193
|
+
**Environment:** [staging/production]
|
|
194
|
+
**SDK Version:** X.Y.Z
|
|
195
|
+
|
|
196
|
+
### Test Configuration
|
|
197
|
+
- Duration: 10 minutes
|
|
198
|
+
- Ramp: 10 → 100 → 10 VUs
|
|
199
|
+
- Target endpoint: /v1/resource
|
|
200
|
+
|
|
201
|
+
### Results
|
|
202
|
+
| Metric | Value |
|
|
203
|
+
|--------|-------|
|
|
204
|
+
| Total Requests | 50,000 |
|
|
205
|
+
| Success Rate | 99.9% |
|
|
206
|
+
| P50 Latency | 120ms |
|
|
207
|
+
| P95 Latency | 350ms |
|
|
208
|
+
| P99 Latency | 800ms |
|
|
209
|
+
| Max RPS Achieved | 150 |
|
|
210
|
+
|
|
211
|
+
### Observations
|
|
212
|
+
- [Key finding 1]
|
|
213
|
+
- [Key finding 2]
|
|
214
|
+
|
|
215
|
+
### Recommendations
|
|
216
|
+
- [Scaling recommendation]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Instructions
|
|
220
|
+
|
|
221
|
+
### Step 1: Create Load Test Script
|
|
222
|
+
Write k6 test script with appropriate thresholds.
|
|
223
|
+
|
|
224
|
+
### Step 2: Configure Auto-Scaling
|
|
225
|
+
Set up HPA with CPU and custom metrics.
|
|
226
|
+
|
|
227
|
+
### Step 3: Run Load Test
|
|
228
|
+
Execute test and collect metrics.
|
|
229
|
+
|
|
230
|
+
### Step 4: Analyze and Document
|
|
231
|
+
Record results in benchmark template.
|
|
232
|
+
|
|
233
|
+
## Output
|
|
234
|
+
- Load test script created
|
|
235
|
+
- HPA configured
|
|
236
|
+
- Benchmark results documented
|
|
237
|
+
- Capacity recommendations defined
|
|
238
|
+
|
|
239
|
+
## Error Handling
|
|
240
|
+
| Issue | Cause | Solution |
|
|
241
|
+
|-------|-------|----------|
|
|
242
|
+
| k6 timeout | Rate limited | Reduce RPS |
|
|
243
|
+
| HPA not scaling | Wrong metrics | Verify metric name |
|
|
244
|
+
| Connection refused | Pool exhausted | Increase pool size |
|
|
245
|
+
| Inconsistent results | Warm-up needed | Add ramp-up phase |
|
|
246
|
+
|
|
247
|
+
## Examples
|
|
248
|
+
|
|
249
|
+
### Quick k6 Test
|
|
250
|
+
```bash
|
|
251
|
+
k6 run --vus 10 --duration 30s vercel-load-test.js
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Check Current Capacity
|
|
255
|
+
```typescript
|
|
256
|
+
const metrics = await getSystemMetrics();
|
|
257
|
+
const capacity = estimateVercelCapacity(metrics);
|
|
258
|
+
console.log('Headroom:', capacity.headroom + '%');
|
|
259
|
+
console.log('Recommendation:', capacity.scaleRecommendation);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Scale HPA Manually
|
|
263
|
+
```bash
|
|
264
|
+
kubectl scale deployment vercel-integration --replicas=5
|
|
265
|
+
kubectl get hpa vercel-integration-hpa
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Resources
|
|
269
|
+
- [k6 Documentation](https://k6.io/docs/)
|
|
270
|
+
- [Kubernetes HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)
|
|
271
|
+
- [Vercel Rate Limits](https://vercel.com/docs/rate-limits)
|
|
272
|
+
|
|
273
|
+
## Next Steps
|
|
274
|
+
For reliability patterns, see `vercel-reliability-patterns`.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vercel-local-dev-loop
|
|
3
|
+
description: |
|
|
4
|
+
Configure Vercel local development with hot reload and testing.
|
|
5
|
+
Use when setting up a development environment, configuring test workflows,
|
|
6
|
+
or establishing a fast iteration cycle with Vercel.
|
|
7
|
+
Trigger with phrases like "vercel dev setup", "vercel local development",
|
|
8
|
+
"vercel dev environment", "develop with vercel".
|
|
9
|
+
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Vercel Local Dev Loop
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Set up a fast, reproducible local development workflow for Vercel.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- Completed `vercel-install-auth` setup
|
|
22
|
+
- Node.js 18+ with npm/pnpm
|
|
23
|
+
- Code editor with TypeScript support
|
|
24
|
+
- Git for version control
|
|
25
|
+
|
|
26
|
+
## Instructions
|
|
27
|
+
|
|
28
|
+
### Step 1: Create Project Structure
|
|
29
|
+
```
|
|
30
|
+
my-vercel-project/
|
|
31
|
+
├── src/
|
|
32
|
+
│ ├── vercel/
|
|
33
|
+
│ │ ├── client.ts # Vercel client wrapper
|
|
34
|
+
│ │ ├── config.ts # Configuration management
|
|
35
|
+
│ │ └── utils.ts # Helper functions
|
|
36
|
+
│ └── index.ts
|
|
37
|
+
├── tests/
|
|
38
|
+
│ └── vercel.test.ts
|
|
39
|
+
├── .env.local # Local secrets (git-ignored)
|
|
40
|
+
├── .env.example # Template for team
|
|
41
|
+
└── package.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Configure Environment
|
|
45
|
+
```bash
|
|
46
|
+
# Copy environment template
|
|
47
|
+
cp .env.example .env.local
|
|
48
|
+
|
|
49
|
+
# Install dependencies
|
|
50
|
+
npm install
|
|
51
|
+
|
|
52
|
+
# Start development server
|
|
53
|
+
npm run dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 3: Setup Hot Reload
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"scripts": {
|
|
60
|
+
"dev": "tsx watch src/index.ts",
|
|
61
|
+
"test": "vitest",
|
|
62
|
+
"test:watch": "vitest --watch"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Step 4: Configure Testing
|
|
68
|
+
```typescript
|
|
69
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
70
|
+
import { VercelClient } from '../src/vercel/client';
|
|
71
|
+
|
|
72
|
+
describe('Vercel Client', () => {
|
|
73
|
+
it('should initialize with API key', () => {
|
|
74
|
+
const client = new VercelClient({ apiKey: 'test-key' });
|
|
75
|
+
expect(client).toBeDefined();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Output
|
|
81
|
+
- Working development environment with hot reload
|
|
82
|
+
- Configured test suite with mocking
|
|
83
|
+
- Environment variable management
|
|
84
|
+
- Fast iteration cycle for Vercel development
|
|
85
|
+
|
|
86
|
+
## Error Handling
|
|
87
|
+
| Error | Cause | Solution |
|
|
88
|
+
|-------|-------|----------|
|
|
89
|
+
| Module not found | Missing dependency | Run `npm install` |
|
|
90
|
+
| Port in use | Another process | Kill process or change port |
|
|
91
|
+
| Env not loaded | Missing .env.local | Copy from .env.example |
|
|
92
|
+
| Test timeout | Slow network | Increase test timeout |
|
|
93
|
+
|
|
94
|
+
## Examples
|
|
95
|
+
|
|
96
|
+
### Mock Vercel Responses
|
|
97
|
+
```typescript
|
|
98
|
+
vi.mock('vercel', () => ({
|
|
99
|
+
VercelClient: vi.fn().mockImplementation(() => ({
|
|
100
|
+
// Mock methods here
|
|
101
|
+
})),
|
|
102
|
+
}));
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Debug Mode
|
|
106
|
+
```bash
|
|
107
|
+
# Enable verbose logging
|
|
108
|
+
DEBUG=VERCEL=* npm run dev
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Resources
|
|
112
|
+
- [Vercel SDK Reference](https://vercel.com/docs/sdk)
|
|
113
|
+
- [Vitest Documentation](https://vitest.dev/)
|
|
114
|
+
- [tsx Documentation](https://github.com/esbuild-kit/tsx)
|
|
115
|
+
|
|
116
|
+
## Next Steps
|
|
117
|
+
See `vercel-sdk-patterns` for production-ready code patterns.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vercel-migration-deep-dive
|
|
3
|
+
description: |
|
|
4
|
+
Execute Vercel major re-architecture and migration strategies with strangler fig pattern.
|
|
5
|
+
Use when migrating to or from Vercel, performing major version upgrades,
|
|
6
|
+
or re-platforming existing integrations to Vercel.
|
|
7
|
+
Trigger with phrases like "migrate vercel", "vercel migration",
|
|
8
|
+
"switch to vercel", "vercel replatform", "vercel upgrade major".
|
|
9
|
+
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(node:*), Bash(kubectl:*)
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Vercel Migration Deep Dive
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Comprehensive guide for migrating to or from Vercel, or major version upgrades.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- Current system documentation
|
|
22
|
+
- Vercel SDK installed
|
|
23
|
+
- Feature flag infrastructure
|
|
24
|
+
- Rollback strategy tested
|
|
25
|
+
|
|
26
|
+
## Migration Types
|
|
27
|
+
|
|
28
|
+
| Type | Complexity | Duration | Risk |
|
|
29
|
+
|------|-----------|----------|------|
|
|
30
|
+
| Fresh install | Low | Days | Low |
|
|
31
|
+
| From competitor | Medium | Weeks | Medium |
|
|
32
|
+
| Major version | Medium | Weeks | Medium |
|
|
33
|
+
| Full replatform | High | Months | High |
|
|
34
|
+
|
|
35
|
+
## Pre-Migration Assessment
|
|
36
|
+
|
|
37
|
+
### Step 1: Current State Analysis
|
|
38
|
+
```bash
|
|
39
|
+
# Document current implementation
|
|
40
|
+
find . -name "*.ts" -o -name "*.py" | xargs grep -l "vercel" > vercel-files.txt
|
|
41
|
+
|
|
42
|
+
# Count integration points
|
|
43
|
+
wc -l vercel-files.txt
|
|
44
|
+
|
|
45
|
+
# Identify dependencies
|
|
46
|
+
npm list | grep vercel
|
|
47
|
+
pip freeze | grep vercel
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Step 2: Data Inventory
|
|
51
|
+
```typescript
|
|
52
|
+
interface MigrationInventory {
|
|
53
|
+
dataTypes: string[];
|
|
54
|
+
recordCounts: Record<string, number>;
|
|
55
|
+
dependencies: string[];
|
|
56
|
+
integrationPoints: string[];
|
|
57
|
+
customizations: string[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function assessVercelMigration(): Promise<MigrationInventory> {
|
|
61
|
+
return {
|
|
62
|
+
dataTypes: await getDataTypes(),
|
|
63
|
+
recordCounts: await getRecordCounts(),
|
|
64
|
+
dependencies: await analyzeDependencies(),
|
|
65
|
+
integrationPoints: await findIntegrationPoints(),
|
|
66
|
+
customizations: await documentCustomizations(),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Migration Strategy: Strangler Fig Pattern
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Phase 1: Parallel Run
|
|
75
|
+
┌─────────────┐ ┌─────────────┐
|
|
76
|
+
│ Old │ │ New │
|
|
77
|
+
│ System │ ──▶ │ Vercel │
|
|
78
|
+
│ (100%) │ │ (0%) │
|
|
79
|
+
└─────────────┘ └─────────────┘
|
|
80
|
+
|
|
81
|
+
Phase 2: Gradual Shift
|
|
82
|
+
┌─────────────┐ ┌─────────────┐
|
|
83
|
+
│ Old │ │ New │
|
|
84
|
+
│ (50%) │ ──▶ │ (50%) │
|
|
85
|
+
└─────────────┘ └─────────────┘
|
|
86
|
+
|
|
87
|
+
Phase 3: Complete
|
|
88
|
+
┌─────────────┐ ┌─────────────┐
|
|
89
|
+
│ Old │ │ New │
|
|
90
|
+
│ (0%) │ ──▶ │ (100%) │
|
|
91
|
+
└─────────────┘ └─────────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Implementation Plan
|
|
95
|
+
|
|
96
|
+
### Phase 1: Setup (Week 1-2)
|
|
97
|
+
```bash
|
|
98
|
+
# Install Vercel SDK
|
|
99
|
+
npm install vercel
|
|
100
|
+
|
|
101
|
+
# Configure credentials
|
|
102
|
+
cp .env.example .env.vercel
|
|
103
|
+
# Edit with new credentials
|
|
104
|
+
|
|
105
|
+
# Verify connectivity
|
|
106
|
+
node -e "require('vercel').ping()"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Phase 2: Adapter Layer (Week 3-4)
|
|
110
|
+
```typescript
|
|
111
|
+
// src/adapters/vercel.ts
|
|
112
|
+
interface ServiceAdapter {
|
|
113
|
+
create(data: CreateInput): Promise<Resource>;
|
|
114
|
+
read(id: string): Promise<Resource>;
|
|
115
|
+
update(id: string, data: UpdateInput): Promise<Resource>;
|
|
116
|
+
delete(id: string): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
class VercelAdapter implements ServiceAdapter {
|
|
120
|
+
async create(data: CreateInput): Promise<Resource> {
|
|
121
|
+
const vercelData = this.transform(data);
|
|
122
|
+
return vercelClient.create(vercelData);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private transform(data: CreateInput): VercelInput {
|
|
126
|
+
// Map from old format to Vercel format
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Phase 3: Data Migration (Week 5-6)
|
|
132
|
+
```typescript
|
|
133
|
+
async function migrateVercelData(): Promise<MigrationResult> {
|
|
134
|
+
const batchSize = 100;
|
|
135
|
+
let processed = 0;
|
|
136
|
+
let errors: MigrationError[] = [];
|
|
137
|
+
|
|
138
|
+
for await (const batch of oldSystem.iterateBatches(batchSize)) {
|
|
139
|
+
try {
|
|
140
|
+
const transformed = batch.map(transform);
|
|
141
|
+
await vercelClient.batchCreate(transformed);
|
|
142
|
+
processed += batch.length;
|
|
143
|
+
} catch (error) {
|
|
144
|
+
errors.push({ batch, error });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Progress update
|
|
148
|
+
console.log(`Migrated ${processed} records`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return { processed, errors };
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Phase 4: Traffic Shift (Week 7-8)
|
|
156
|
+
```typescript
|
|
157
|
+
// Feature flag controlled traffic split
|
|
158
|
+
function getServiceAdapter(): ServiceAdapter {
|
|
159
|
+
const vercelPercentage = getFeatureFlag('vercel_migration_percentage');
|
|
160
|
+
|
|
161
|
+
if (Math.random() * 100 < vercelPercentage) {
|
|
162
|
+
return new VercelAdapter();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return new LegacyAdapter();
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Rollback Plan
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Immediate rollback
|
|
173
|
+
kubectl set env deployment/app VERCEL_ENABLED=false
|
|
174
|
+
kubectl rollout restart deployment/app
|
|
175
|
+
|
|
176
|
+
# Data rollback (if needed)
|
|
177
|
+
./scripts/restore-from-backup.sh --date YYYY-MM-DD
|
|
178
|
+
|
|
179
|
+
# Verify rollback
|
|
180
|
+
curl https://app.yourcompany.com/health | jq '.services.vercel'
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Post-Migration Validation
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
async function validateVercelMigration(): Promise<ValidationReport> {
|
|
187
|
+
const checks = [
|
|
188
|
+
{ name: 'Data count match', fn: checkDataCounts },
|
|
189
|
+
{ name: 'API functionality', fn: checkApiFunctionality },
|
|
190
|
+
{ name: 'Performance baseline', fn: checkPerformance },
|
|
191
|
+
{ name: 'Error rates', fn: checkErrorRates },
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const results = await Promise.all(
|
|
195
|
+
checks.map(async c => ({ name: c.name, result: await c.fn() }))
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
return { checks: results, passed: results.every(r => r.result.success) };
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Instructions
|
|
203
|
+
|
|
204
|
+
### Step 1: Assess Current State
|
|
205
|
+
Document existing implementation and data inventory.
|
|
206
|
+
|
|
207
|
+
### Step 2: Build Adapter Layer
|
|
208
|
+
Create abstraction layer for gradual migration.
|
|
209
|
+
|
|
210
|
+
### Step 3: Migrate Data
|
|
211
|
+
Run batch data migration with error handling.
|
|
212
|
+
|
|
213
|
+
### Step 4: Shift Traffic
|
|
214
|
+
Gradually route traffic to new Vercel integration.
|
|
215
|
+
|
|
216
|
+
## Output
|
|
217
|
+
- Migration assessment complete
|
|
218
|
+
- Adapter layer implemented
|
|
219
|
+
- Data migrated successfully
|
|
220
|
+
- Traffic fully shifted to Vercel
|
|
221
|
+
|
|
222
|
+
## Error Handling
|
|
223
|
+
| Issue | Cause | Solution |
|
|
224
|
+
|-------|-------|----------|
|
|
225
|
+
| Data mismatch | Transform errors | Validate transform logic |
|
|
226
|
+
| Performance drop | No caching | Add caching layer |
|
|
227
|
+
| Rollback triggered | Errors spiked | Reduce traffic percentage |
|
|
228
|
+
| Validation failed | Missing data | Check batch processing |
|
|
229
|
+
|
|
230
|
+
## Examples
|
|
231
|
+
|
|
232
|
+
### Quick Migration Status
|
|
233
|
+
```typescript
|
|
234
|
+
const status = await validateVercelMigration();
|
|
235
|
+
console.log(`Migration ${status.passed ? 'PASSED' : 'FAILED'}`);
|
|
236
|
+
status.checks.forEach(c => console.log(` ${c.name}: ${c.result.success}`));
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Resources
|
|
240
|
+
- [Strangler Fig Pattern](https://martinfowler.com/bliki/StranglerFigApplication.html)
|
|
241
|
+
- [Vercel Migration Guide](https://vercel.com/docs/migration)
|
|
242
|
+
|
|
243
|
+
## Flagship+ Skills
|
|
244
|
+
For advanced troubleshooting, see `vercel-advanced-troubleshooting`.
|