@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.
Files changed (124) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +67 -44
  3. package/package.json +4 -4
  4. package/skills/vercel-advanced-troubleshooting/SKILL.md +185 -195
  5. package/skills/vercel-advanced-troubleshooting/references/errors.md +11 -0
  6. package/skills/vercel-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
  7. package/skills/vercel-advanced-troubleshooting/references/examples.md +11 -0
  8. package/skills/vercel-advanced-troubleshooting/references/systematic-isolation.md +56 -0
  9. package/skills/vercel-advanced-troubleshooting/references/timing-analysis.md +35 -0
  10. package/skills/vercel-architecture-variants/SKILL.md +227 -216
  11. package/skills/vercel-architecture-variants/references/errors.md +11 -0
  12. package/skills/vercel-architecture-variants/references/examples.md +12 -0
  13. package/skills/vercel-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
  14. package/skills/vercel-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
  15. package/skills/vercel-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
  16. package/skills/vercel-ci-integration/SKILL.md +183 -73
  17. package/skills/vercel-ci-integration/references/errors.md +10 -0
  18. package/skills/vercel-ci-integration/references/examples.md +36 -0
  19. package/skills/vercel-ci-integration/references/implementation.md +54 -0
  20. package/skills/vercel-common-errors/SKILL.md +164 -60
  21. package/skills/vercel-common-errors/references/errors.md +53 -0
  22. package/skills/vercel-common-errors/references/examples.md +23 -0
  23. package/skills/vercel-cost-tuning/SKILL.md +158 -145
  24. package/skills/vercel-cost-tuning/references/cost-estimation.md +34 -0
  25. package/skills/vercel-cost-tuning/references/cost-reduction-strategies.md +40 -0
  26. package/skills/vercel-cost-tuning/references/errors.md +11 -0
  27. package/skills/vercel-cost-tuning/references/examples.md +15 -0
  28. package/skills/vercel-data-handling/SKILL.md +202 -155
  29. package/skills/vercel-data-handling/references/errors.md +11 -0
  30. package/skills/vercel-data-handling/references/examples.md +27 -0
  31. package/skills/vercel-data-handling/references/implementation.md +223 -0
  32. package/skills/vercel-debug-bundle/SKILL.md +163 -67
  33. package/skills/vercel-debug-bundle/references/errors.md +12 -0
  34. package/skills/vercel-debug-bundle/references/examples.md +24 -0
  35. package/skills/vercel-debug-bundle/references/implementation.md +54 -0
  36. package/skills/vercel-deploy-integration/SKILL.md +163 -156
  37. package/skills/vercel-deploy-integration/references/errors.md +11 -0
  38. package/skills/vercel-deploy-integration/references/examples.md +21 -0
  39. package/skills/vercel-deploy-integration/references/google-cloud-run.md +36 -0
  40. package/skills/vercel-deploy-integration/references/vercel-deployment.md +35 -0
  41. package/skills/vercel-deploy-preview/SKILL.md +164 -39
  42. package/skills/vercel-edge-functions/SKILL.md +185 -37
  43. package/skills/vercel-enterprise-rbac/SKILL.md +185 -170
  44. package/skills/vercel-enterprise-rbac/references/errors.md +11 -0
  45. package/skills/vercel-enterprise-rbac/references/examples.md +12 -0
  46. package/skills/vercel-enterprise-rbac/references/role-implementation.md +33 -0
  47. package/skills/vercel-enterprise-rbac/references/sso-integration.md +35 -0
  48. package/skills/vercel-hello-world/SKILL.md +141 -55
  49. package/skills/vercel-incident-runbook/SKILL.md +186 -138
  50. package/skills/vercel-incident-runbook/references/errors.md +11 -0
  51. package/skills/vercel-incident-runbook/references/examples.md +10 -0
  52. package/skills/vercel-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
  53. package/skills/vercel-install-auth/SKILL.md +130 -53
  54. package/skills/vercel-known-pitfalls/SKILL.md +235 -233
  55. package/skills/vercel-known-pitfalls/references/errors.md +11 -0
  56. package/skills/vercel-known-pitfalls/references/examples.md +12 -0
  57. package/skills/vercel-load-scale/SKILL.md +197 -204
  58. package/skills/vercel-load-scale/references/capacity-planning.md +47 -0
  59. package/skills/vercel-load-scale/references/errors.md +11 -0
  60. package/skills/vercel-load-scale/references/examples.md +26 -0
  61. package/skills/vercel-load-scale/references/load-testing-with-k6.md +59 -0
  62. package/skills/vercel-load-scale/references/scaling-patterns.md +65 -0
  63. package/skills/vercel-local-dev-loop/SKILL.md +159 -71
  64. package/skills/vercel-local-dev-loop/references/errors.md +11 -0
  65. package/skills/vercel-local-dev-loop/references/examples.md +21 -0
  66. package/skills/vercel-local-dev-loop/references/implementation.md +60 -0
  67. package/skills/vercel-migration-deep-dive/SKILL.md +202 -187
  68. package/skills/vercel-migration-deep-dive/references/errors.md +11 -0
  69. package/skills/vercel-migration-deep-dive/references/examples.md +12 -0
  70. package/skills/vercel-migration-deep-dive/references/implementation-plan.md +80 -0
  71. package/skills/vercel-migration-deep-dive/references/pre-migration-assessment.md +39 -0
  72. package/skills/vercel-multi-env-setup/SKILL.md +167 -164
  73. package/skills/vercel-multi-env-setup/references/configuration-structure.md +59 -0
  74. package/skills/vercel-multi-env-setup/references/errors.md +11 -0
  75. package/skills/vercel-multi-env-setup/references/examples.md +11 -0
  76. package/skills/vercel-observability/SKILL.md +205 -195
  77. package/skills/vercel-observability/references/alert-configuration.md +40 -0
  78. package/skills/vercel-observability/references/errors.md +11 -0
  79. package/skills/vercel-observability/references/examples.md +13 -0
  80. package/skills/vercel-observability/references/metrics-collection.md +65 -0
  81. package/skills/vercel-performance-tuning/SKILL.md +212 -156
  82. package/skills/vercel-performance-tuning/references/caching-strategy.md +49 -0
  83. package/skills/vercel-performance-tuning/references/errors.md +11 -0
  84. package/skills/vercel-performance-tuning/references/examples.md +13 -0
  85. package/skills/vercel-policy-guardrails/SKILL.md +276 -193
  86. package/skills/vercel-policy-guardrails/references/errors.md +11 -0
  87. package/skills/vercel-policy-guardrails/references/eslint-rules.md +46 -0
  88. package/skills/vercel-policy-guardrails/references/examples.md +10 -0
  89. package/skills/vercel-prod-checklist/SKILL.md +219 -94
  90. package/skills/vercel-prod-checklist/references/errors.md +11 -0
  91. package/skills/vercel-prod-checklist/references/examples.md +25 -0
  92. package/skills/vercel-prod-checklist/references/implementation.md +60 -0
  93. package/skills/vercel-rate-limits/SKILL.md +187 -100
  94. package/skills/vercel-rate-limits/references/errors.md +11 -0
  95. package/skills/vercel-rate-limits/references/examples.md +46 -0
  96. package/skills/vercel-rate-limits/references/implementation.md +66 -0
  97. package/skills/vercel-reference-architecture/SKILL.md +226 -180
  98. package/skills/vercel-reference-architecture/references/errors.md +11 -0
  99. package/skills/vercel-reference-architecture/references/examples.md +13 -0
  100. package/skills/vercel-reference-architecture/references/key-components.md +65 -0
  101. package/skills/vercel-reference-architecture/references/project-structure.md +40 -0
  102. package/skills/vercel-reliability-patterns/SKILL.md +272 -211
  103. package/skills/vercel-reliability-patterns/references/circuit-breaker.md +36 -0
  104. package/skills/vercel-reliability-patterns/references/dead-letter-queue.md +48 -0
  105. package/skills/vercel-reliability-patterns/references/errors.md +11 -0
  106. package/skills/vercel-reliability-patterns/references/examples.md +11 -0
  107. package/skills/vercel-reliability-patterns/references/idempotency-keys.md +36 -0
  108. package/skills/vercel-sdk-patterns/SKILL.md +264 -92
  109. package/skills/vercel-sdk-patterns/references/errors.md +11 -0
  110. package/skills/vercel-sdk-patterns/references/examples.md +45 -0
  111. package/skills/vercel-sdk-patterns/references/implementation.md +67 -0
  112. package/skills/vercel-security-basics/SKILL.md +186 -96
  113. package/skills/vercel-security-basics/references/errors.md +10 -0
  114. package/skills/vercel-security-basics/references/examples.md +70 -0
  115. package/skills/vercel-security-basics/references/implementation.md +39 -0
  116. package/skills/vercel-upgrade-migration/SKILL.md +167 -67
  117. package/skills/vercel-upgrade-migration/references/errors.md +10 -0
  118. package/skills/vercel-upgrade-migration/references/examples.md +51 -0
  119. package/skills/vercel-upgrade-migration/references/implementation.md +29 -0
  120. package/skills/vercel-webhooks-events/SKILL.md +208 -132
  121. package/skills/vercel-webhooks-events/references/errors.md +11 -0
  122. package/skills/vercel-webhooks-events/references/event-handler-pattern.md +37 -0
  123. package/skills/vercel-webhooks-events/references/examples.md +16 -0
  124. package/skills/vercel-webhooks-events/references/signature-verification.md +33 -0
@@ -0,0 +1,34 @@
1
+ # Evidence Collection Framework
2
+
3
+ ## Evidence Collection Framework
4
+
5
+ ### Comprehensive Debug Bundle
6
+
7
+ ```bash
8
+ #!/bin/bash
9
+ # advanced-vercel-debug.sh
10
+
11
+ BUNDLE="vercel-advanced-debug-$(date +%Y%m%d-%H%M%S)"
12
+ mkdir -p "$BUNDLE"/{logs,metrics,network,config,traces}
13
+
14
+ # 1. Extended logs (1 hour window)
15
+ kubectl logs -l app=vercel-integration --since=1h > "$BUNDLE/logs/pods.log"
16
+ journalctl -u vercel-service --since "1 hour ago" > "$BUNDLE/logs/system.log"
17
+
18
+ # 2. Metrics dump
19
+ curl -s localhost:9090/api/v1/query?query=vercel_requests_total > "$BUNDLE/metrics/requests.json"
20
+ curl -s localhost:9090/api/v1/query?query=vercel_errors_total > "$BUNDLE/metrics/errors.json"
21
+
22
+ # 3. Network capture (30 seconds)
23
+ timeout 30 tcpdump -i any port 443 -w "$BUNDLE/network/capture.pcap" &
24
+
25
+ # 4. Distributed traces
26
+ curl -s localhost:16686/api/traces?service=vercel > "$BUNDLE/traces/jaeger.json"
27
+
28
+ # 5. Configuration state
29
+ kubectl get cm vercel-config -o yaml > "$BUNDLE/config/configmap.yaml"
30
+ kubectl get secret vercel-secrets -o yaml > "$BUNDLE/config/secrets-redacted.yaml"
31
+
32
+ tar -czf "$BUNDLE.tar.gz" "$BUNDLE"
33
+ echo "Advanced debug bundle: $BUNDLE.tar.gz"
34
+ ```
@@ -0,0 +1,11 @@
1
+ ## Examples
2
+
3
+ ### Quick Layer Test
4
+
5
+ ```bash
6
+ # Test each layer in sequence
7
+ curl -v https://api.vercel.com/health 2>&1 | grep -E "(Connected|TLS|HTTP)"
8
+ ```
9
+
10
+ ---
11
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,56 @@
1
+ # Systematic Isolation
2
+
3
+ ## Systematic Isolation
4
+
5
+ ### Layer-by-Layer Testing
6
+
7
+ ```typescript
8
+ // Test each layer independently
9
+ async function diagnoseVercelIssue(): Promise<DiagnosisReport> {
10
+ const results: DiagnosisResult[] = [];
11
+
12
+ // Layer 1: Network connectivity
13
+ results.push(await testNetworkConnectivity());
14
+
15
+ // Layer 2: DNS resolution
16
+ results.push(await testDNSResolution('api.vercel.com'));
17
+
18
+ // Layer 3: TLS handshake
19
+ results.push(await testTLSHandshake('api.vercel.com'));
20
+
21
+ // Layer 4: Authentication
22
+ results.push(await testAuthentication());
23
+
24
+ // Layer 5: API response
25
+ results.push(await testAPIResponse());
26
+
27
+ // Layer 6: Response parsing
28
+ results.push(await testResponseParsing());
29
+
30
+ return { results, firstFailure: results.find(r => !r.success) };
31
+ }
32
+ ```
33
+
34
+ ### Minimal Reproduction
35
+
36
+ ```typescript
37
+ // Strip down to absolute minimum
38
+ async function minimalRepro(): Promise<void> {
39
+ // 1. Fresh client, no customization
40
+ const client = new VercelClient({
41
+ apiKey: process.env.VERCEL_API_KEY!,
42
+ });
43
+
44
+ // 2. Simplest possible call
45
+ try {
46
+ const result = await client.ping();
47
+ console.log('Ping successful:', result);
48
+ } catch (error) {
49
+ console.error('Ping failed:', {
50
+ message: error.message,
51
+ code: error.code,
52
+ stack: error.stack,
53
+ });
54
+ }
55
+ }
56
+ ```
@@ -0,0 +1,35 @@
1
+ # Timing Analysis
2
+
3
+ ## Timing Analysis
4
+
5
+ ```typescript
6
+ class TimingAnalyzer {
7
+ private timings: Map<string, number[]> = new Map();
8
+
9
+ async measure<T>(label: string, fn: () => Promise<T>): Promise<T> {
10
+ const start = performance.now();
11
+ try {
12
+ return await fn();
13
+ } finally {
14
+ const duration = performance.now() - start;
15
+ const existing = this.timings.get(label) || [];
16
+ existing.push(duration);
17
+ this.timings.set(label, existing);
18
+ }
19
+ }
20
+
21
+ report(): TimingReport {
22
+ const report: TimingReport = {};
23
+ for (const [label, times] of this.timings) {
24
+ report[label] = {
25
+ count: times.length,
26
+ min: Math.min(...times),
27
+ max: Math.max(...times),
28
+ avg: times.reduce((a, b) => a + b, 0) / times.length,
29
+ p95: this.percentile(times, 95),
30
+ };
31
+ }
32
+ return report;
33
+ }
34
+ }
35
+ ```
@@ -1,284 +1,295 @@
1
1
  ---
2
2
  name: vercel-architecture-variants
3
- description: |
4
- Choose and implement Vercel validated architecture blueprints for different scales.
5
- Use when designing new Vercel integrations, choosing between monolith/service/microservice
6
- architectures, or planning migration paths for Vercel applications.
3
+ description: 'Choose and implement Vercel architecture blueprints for different scales
4
+ and use cases.
5
+
6
+ Use when designing new Vercel projects, choosing between static, serverless, and
7
+ edge architectures,
8
+
9
+ or planning how to structure a multi-project Vercel deployment.
10
+
7
11
  Trigger with phrases like "vercel architecture", "vercel blueprint",
8
- "how to structure vercel", "vercel project layout", "vercel microservice".
9
- allowed-tools: Read, Grep
12
+
13
+ "how to structure vercel", "vercel monorepo", "vercel multi-project".
14
+
15
+ '
16
+ allowed-tools: Read, Write, Edit, Grep
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
+ - architecture
24
+ - scaling
25
+ - patterns
26
+ compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
13
27
  ---
14
-
15
28
  # Vercel Architecture Variants
16
29
 
17
30
  ## Overview
18
- Three validated architecture blueprints for Vercel integrations.
31
+
32
+ Choose the right Vercel architecture based on team size, traffic patterns, and technical requirements. Covers five validated blueprints from static site to multi-project enterprise deployment, with migration paths between them.
19
33
 
20
34
  ## Prerequisites
21
- - Understanding of team size and DAU requirements
22
- - Knowledge of deployment infrastructure
35
+
36
+ - Understanding of team size and traffic requirements
37
+ - Knowledge of Vercel deployment model (edge, serverless, static)
23
38
  - Clear SLA requirements
24
- - Growth projections available
25
39
 
26
- ## Variant A: Monolith (Simple)
40
+ ## Instructions
41
+
42
+ ### Variant 1: Static Site (JAMstack)
27
43
 
28
- **Best for:** MVPs, small teams, < 10K daily active users
44
+ **Best for:** Marketing sites, docs, blogs, landing pages
45
+ **Team size:** 1-3 developers
46
+ **Traffic:** Any (fully CDN-served)
29
47
 
30
48
  ```
31
- my-app/
49
+ project/
50
+ ├── public/ # Static assets
32
51
  ├── src/
33
- │ ├── vercel/
34
- ├── client.ts # Singleton client
35
- │ │ ├── types.ts # Types
36
- │ │ └── middleware.ts # Express middleware
37
- │ ├── routes/
38
- │ │ └── api/
39
- │ │ └── vercel.ts # API routes
40
- │ └── index.ts
41
- ├── tests/
42
- │ └── vercel.test.ts
52
+ │ ├── pages/ # Static pages (SSG)
53
+ └── components/ # React components
54
+ ├── vercel.json # Headers, redirects
43
55
  └── package.json
44
56
  ```
45
57
 
46
- ### Key Characteristics
47
- - Single deployment unit
48
- - Synchronous Vercel calls in request path
49
- - In-memory caching
50
- - Simple error handling
51
-
52
- ### Code Pattern
53
- ```typescript
54
- // Direct integration in route handler
55
- app.post('/api/create', async (req, res) => {
56
- try {
57
- const result = await vercelClient.create(req.body);
58
- res.json(result);
59
- } catch (error) {
60
- res.status(500).json({ error: error.message });
61
- }
62
- });
58
+ ```json
59
+ // vercel.json
60
+ {
61
+ "headers": [
62
+ {
63
+ "source": "/(.*)",
64
+ "headers": [
65
+ { "key": "Cache-Control", "value": "public, max-age=3600, stale-while-revalidate=86400" }
66
+ ]
67
+ }
68
+ ]
69
+ }
63
70
  ```
64
71
 
65
- ---
72
+ **Key decisions:**
73
+
74
+ - No serverless functions needed
75
+ - All pages pre-rendered at build time
76
+ - ISR for pages that update periodically
77
+ - Cost: minimal (mostly bandwidth)
66
78
 
67
- ## Variant B: Service Layer (Moderate)
79
+ ### Variant 2: Full-Stack Next.js (Most Common)
68
80
 
69
- **Best for:** Growing startups, 10K-100K DAU, multiple integrations
81
+ **Best for:** SaaS applications, dashboards, e-commerce
82
+ **Team size:** 2-10 developers
83
+ **Traffic:** Low to high
70
84
 
71
85
  ```
72
- my-app/
86
+ project/
73
87
  ├── src/
74
- │ ├── services/
75
- │ │ ├── vercel/
76
- │ │ ├── client.ts # Client wrapper
77
- │ │ │ ├── service.ts # Business logic
78
- │ │ ├── repository.ts # Data access
79
- │ │ └── types.ts
80
- └── index.ts # Service exports
81
- ├── controllers/
82
- │ │ └── vercel.ts
83
- │ ├── routes/
84
- │ ├── middleware/
85
- │ ├── queue/
86
- │ │ └── vercel-processor.ts # Async processing
87
- │ └── index.ts
88
- ├── config/
89
- │ └── vercel/
88
+ │ ├── app/
89
+ │ │ ├── api/ # Serverless API routes
90
+ │ │ ├── (marketing)/ # Static public pages
91
+ │ │ └── dashboard/ # Dynamic authenticated pages
92
+ │ ├── lib/ # Shared utilities
93
+ ├── components/ # UI components
94
+ │ └── middleware.ts # Edge auth + routing
95
+ ├── prisma/ # Database schema
96
+ ├── vercel.json
90
97
  └── package.json
91
98
  ```
92
99
 
93
- ### Key Characteristics
94
- - Separation of concerns
95
- - Background job processing
96
- - Redis caching
97
- - Circuit breaker pattern
98
- - Structured error handling
99
-
100
- ### Code Pattern
101
- ```typescript
102
- // Service layer abstraction
103
- class VercelService {
104
- constructor(
105
- private client: VercelClient,
106
- private cache: CacheService,
107
- private queue: QueueService
108
- ) {}
109
-
110
- async createResource(data: CreateInput): Promise<Resource> {
111
- // Business logic before API call
112
- const validated = this.validate(data);
113
-
114
- // Check cache
115
- const cached = await this.cache.get(cacheKey);
116
- if (cached) return cached;
117
-
118
- // API call with retry
119
- const result = await this.withRetry(() =>
120
- this.client.create(validated)
121
- );
122
-
123
- // Cache result
124
- await this.cache.set(cacheKey, result, 300);
125
-
126
- // Async follow-up
127
- await this.queue.enqueue('vercel.post-create', result);
128
-
129
- return result;
100
+ ```json
101
+ // vercel.json
102
+ {
103
+ "regions": ["iad1"],
104
+ "functions": {
105
+ "src/app/api/**/*.ts": {
106
+ "maxDuration": 30,
107
+ "memory": 1024
108
+ }
130
109
  }
131
110
  }
132
111
  ```
133
112
 
134
- ---
113
+ **Key decisions:**
135
114
 
136
- ## Variant C: Microservice (Complex)
115
+ - Mixed rendering: SSG for marketing, SSR for dashboard
116
+ - API routes in `app/api/` for backend logic
117
+ - Edge Middleware for auth (runs before every request)
118
+ - Database in same region as functions
137
119
 
138
- **Best for:** Enterprise, 100K+ DAU, strict SLAs
120
+ ### Variant 3: API-Only Backend
121
+
122
+ **Best for:** Mobile app backends, microservices, webhook processors
123
+ **Team size:** 1-5 developers
124
+ **Traffic:** API-driven
139
125
 
140
126
  ```
141
- vercel-service/ # Dedicated microservice
142
- ├── src/
143
- │ ├── api/
144
- │ │ ├── grpc/
145
- │ │ └── vercel.proto
146
- │ └── rest/
147
- │ │ └── routes.ts
148
- ├── domain/
149
- │ │ ├── entities/
150
- │ │ ├── events/
151
- │ │ └── services/
152
- │ ├── infrastructure/
153
- │ │ ├── vercel/
154
- │ │ │ ├── client.ts
155
- │ │ │ ├── mapper.ts
156
- │ │ │ └── circuit-breaker.ts
157
- │ │ ├── cache/
158
- │ │ ├── queue/
159
- │ │ └── database/
160
- │ └── index.ts
161
- ├── config/
162
- ├── k8s/
163
- │ ├── deployment.yaml
164
- │ ├── service.yaml
165
- │ └── hpa.yaml
127
+ project/
128
+ ├── api/ # Serverless functions (one per route)
129
+ │ ├── users/
130
+ │ │ ├── index.ts # GET/POST /api/users
131
+ │ │ └── [id].ts # GET/PUT/DELETE /api/users/:id
132
+ ├── webhooks/
133
+ │ │ └── stripe.ts # POST /api/webhooks/stripe
134
+ └── health.ts # GET /api/health
135
+ ├── lib/ # Shared utilities
136
+ ├── vercel.json
166
137
  └── package.json
138
+ ```
167
139
 
168
- other-services/
169
- ├── order-service/ # Calls vercel-service
170
- ├── payment-service/
171
- └── notification-service/
140
+ ```json
141
+ // vercel.json
142
+ {
143
+ "regions": ["iad1", "cdg1"],
144
+ "rewrites": [
145
+ { "source": "/v1/(.*)", "destination": "/api/$1" }
146
+ ],
147
+ "headers": [
148
+ {
149
+ "source": "/api/(.*)",
150
+ "headers": [
151
+ { "key": "Access-Control-Allow-Origin", "value": "https://myapp.com" },
152
+ { "key": "Access-Control-Allow-Methods", "value": "GET,POST,PUT,DELETE" }
153
+ ]
154
+ }
155
+ ]
156
+ }
172
157
  ```
173
158
 
174
- ### Key Characteristics
175
- - Dedicated Vercel microservice
176
- - gRPC for internal communication
177
- - Event-driven architecture
178
- - Database per service
179
- - Kubernetes autoscaling
180
- - Distributed tracing
181
- - Circuit breaker per service
182
-
183
- ### Code Pattern
184
- ```typescript
185
- // Event-driven with domain isolation
186
- class VercelAggregate {
187
- private events: DomainEvent[] = [];
188
-
189
- process(command: VercelCommand): void {
190
- // Domain logic
191
- const result = this.execute(command);
192
-
193
- // Emit domain event
194
- this.events.push(new VercelProcessedEvent(result));
195
- }
159
+ **Key decisions:**
196
160
 
197
- getUncommittedEvents(): DomainEvent[] {
198
- return [...this.events];
199
- }
200
- }
161
+ - No frontend — pure API
162
+ - CORS headers for cross-origin access
163
+ - Version routing via rewrites (`/v1/*` → `/api/*`)
164
+ - Multi-region for global API latency
201
165
 
202
- // Event handler
203
- @EventHandler(VercelProcessedEvent)
204
- class VercelEventHandler {
205
- async handle(event: VercelProcessedEvent): Promise<void> {
206
- // Saga orchestration
207
- await this.sagaOrchestrator.continue(event);
208
- }
166
+ ### Variant 4: Monorepo with Turborepo
167
+
168
+ **Best for:** Multiple related apps, shared component libraries
169
+ **Team size:** 5-20 developers
170
+ **Traffic:** Varies per app
171
+
172
+ ```
173
+ monorepo/
174
+ ├── apps/
175
+ │ ├── web/ # Main website (Vercel project 1)
176
+ │ │ ├── src/
177
+ │ │ ├── vercel.json
178
+ │ │ └── package.json
179
+ │ ├── docs/ # Documentation site (Vercel project 2)
180
+ │ │ ├── src/
181
+ │ │ ├── vercel.json
182
+ │ │ └── package.json
183
+ │ └── admin/ # Admin dashboard (Vercel project 3)
184
+ │ ├── src/
185
+ │ ├── vercel.json
186
+ │ └── package.json
187
+ ├── packages/
188
+ │ ├── ui/ # Shared component library
189
+ │ ├── config/ # Shared ESLint, TS config
190
+ │ └── utils/ # Shared utilities
191
+ ├── turbo.json
192
+ ├── pnpm-workspace.yaml
193
+ └── package.json
194
+ ```
195
+
196
+ Vercel auto-detects monorepos and builds only the affected app:
197
+
198
+ ```json
199
+ // apps/web/vercel.json
200
+ {
201
+ "ignoreCommand": "npx turbo-ignore"
209
202
  }
210
203
  ```
211
204
 
212
- ---
205
+ Each app in `apps/` is a separate Vercel project with its own domain, env vars, and deployment settings.
213
206
 
214
- ## Decision Matrix
207
+ ### Variant 5: Multi-Zone Micro-Frontends (Enterprise)
215
208
 
216
- | Factor | Monolith | Service Layer | Microservice |
217
- |--------|----------|---------------|--------------|
218
- | Team Size | 1-5 | 5-20 | 20+ |
219
- | DAU | < 10K | 10K-100K | 100K+ |
220
- | Deployment Frequency | Weekly | Daily | Continuous |
221
- | Failure Isolation | None | Partial | Full |
222
- | Operational Complexity | Low | Medium | High |
223
- | Time to Market | Fastest | Moderate | Slowest |
209
+ **Best for:** Large organizations with independent teams
210
+ **Team size:** 20+ developers across multiple teams
211
+ **Traffic:** High
224
212
 
225
- ## Migration Path
213
+ ```
214
+ Each zone is an independent Vercel project:
215
+
216
+ Zone 1: marketing.company.com → Marketing team's Next.js app
217
+ Zone 2: app.company.com → Product team's Next.js app
218
+ Zone 3: docs.company.com → Docs team's Next.js app
219
+ Zone 4: api.company.com → Platform team's API-only project
226
220
 
221
+ Main project uses multi-zones (next.config.js):
227
222
  ```
228
- Monolith → Service Layer:
229
- 1. Extract Vercel code to service/
230
- 2. Add caching layer
231
- 3. Add background processing
232
-
233
- Service Layer → Microservice:
234
- 1. Create dedicated vercel-service repo
235
- 2. Define gRPC contract
236
- 3. Add event bus
237
- 4. Deploy to Kubernetes
238
- 5. Migrate traffic gradually
223
+
224
+ ```javascript
225
+ // Main app: next.config.js
226
+ module.exports = {
227
+ async rewrites() {
228
+ return [
229
+ {
230
+ source: '/docs/:path*',
231
+ destination: 'https://docs.company.com/docs/:path*',
232
+ },
233
+ {
234
+ source: '/blog/:path*',
235
+ destination: 'https://marketing.company.com/blog/:path*',
236
+ },
237
+ ];
238
+ },
239
+ };
239
240
  ```
240
241
 
241
- ## Instructions
242
+ **Key decisions:**
243
+
244
+ - Independent deploy cycles per team
245
+ - Shared auth via Edge Middleware or external IdP
246
+ - Consistent design system via shared npm packages
247
+ - Each zone has its own env vars and scaling
242
248
 
243
- ### Step 1: Assess Requirements
244
- Use the decision matrix to identify appropriate variant.
249
+ ## Architecture Decision Matrix
245
250
 
246
- ### Step 2: Choose Architecture
247
- Select Monolith, Service Layer, or Microservice based on needs.
251
+ | Factor | Static | Full-Stack | API-Only | Monorepo | Multi-Zone |
252
+ |--------|--------|-----------|----------|----------|------------|
253
+ | Team size | 1-3 | 2-10 | 1-5 | 5-20 | 20+ |
254
+ | Deploy independence | N/A | Single | Single | Per-app | Per-team |
255
+ | Frontend | Yes | Yes | No | Yes | Yes |
256
+ | Database | No | Yes | Yes | Per-app | Per-zone |
257
+ | Complexity | Low | Medium | Low | Medium | High |
258
+ | Cost | Low | Medium | Low | Medium | High |
248
259
 
249
- ### Step 3: Implement Structure
250
- Set up project layout following the chosen blueprint.
260
+ ## Migration Path
251
261
 
252
- ### Step 4: Plan Migration Path
253
- Document upgrade path for future scaling.
262
+ ```
263
+ Static Site Full-Stack Next.js → Monorepo → Multi-Zone
264
+ ↑ ↑ ↑ ↑
265
+ Start here Add API routes Add shared Split teams
266
+ Add auth packages Independent
267
+ Add database deployments
268
+ ```
254
269
 
255
270
  ## Output
256
- - Architecture variant selected
257
- - Project structure implemented
258
- - Migration path documented
259
- - Appropriate patterns applied
271
+
272
+ - Architecture variant selected based on team size and requirements
273
+ - Project structure implemented following the chosen blueprint
274
+ - Vercel configuration optimized for the architecture
275
+ - Migration path documented for future scaling
260
276
 
261
277
  ## Error Handling
262
- | Issue | Cause | Solution |
278
+
279
+ | Error | Cause | Solution |
263
280
  |-------|-------|----------|
264
- | Over-engineering | Wrong variant choice | Start simpler |
265
- | Performance issues | Wrong layer | Add caching/async |
266
- | Team friction | Complex architecture | Simplify or train |
267
- | Deployment complexity | Microservice overhead | Consider service layer |
268
-
269
- ## Examples
270
-
271
- ### Quick Variant Check
272
- ```bash
273
- # Count team size and DAU to select variant
274
- echo "Team: $(git log --format='%ae' | sort -u | wc -l) developers"
275
- echo "DAU: Check analytics dashboard"
276
- ```
281
+ | Monorepo builds all apps | Missing `ignoreCommand` | Add `npx turbo-ignore` |
282
+ | Multi-zone routing conflict | Overlapping paths | Ensure rewrites don't conflict |
283
+ | Shared package not found | pnpm workspace misconfigured | Check `pnpm-workspace.yaml` includes |
284
+ | API-only 404 on root | No `public/index.html` | Add a minimal index or redirect |
277
285
 
278
286
  ## Resources
279
- - [Monolith First](https://martinfowler.com/bliki/MonolithFirst.html)
280
- - [Microservices Guide](https://martinfowler.com/microservices/)
281
- - [Vercel Architecture Guide](https://vercel.com/docs/architecture)
287
+
288
+ - [Vercel Monorepos](https://vercel.com/docs/monorepos)
289
+ - [Turborepo on Vercel](https://vercel.com/docs/monorepos/turborepo)
290
+ - [Next.js Multi-Zones](https://nextjs.org/docs/app/building-your-application/deploying/multi-zones)
291
+ - [Vercel Project Structure](https://vercel.com/docs/project-configuration)
282
292
 
283
293
  ## Next Steps
284
- For common anti-patterns, see `vercel-known-pitfalls`.
294
+
295
+ For known pitfalls and anti-patterns, see `vercel-known-pitfalls`.
@@ -0,0 +1,11 @@
1
+ # Error Handling Reference
2
+
3
+ | Issue | Cause | Solution |
4
+ |-------|-------|----------|
5
+ | Over-engineering | Wrong variant choice | Start simpler |
6
+ | Performance issues | Wrong layer | Add caching/async |
7
+ | Team friction | Complex architecture | Simplify or train |
8
+ | Deployment complexity | Microservice overhead | Consider service layer |
9
+
10
+ ---
11
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,12 @@
1
+ ## Examples
2
+
3
+ ### Quick Variant Check
4
+
5
+ ```bash
6
+ # Count team size and DAU to select variant
7
+ echo "Team: $(git log --format='%ae' | sort -u | wc -l) developers"
8
+ echo "DAU: Check analytics dashboard"
9
+ ```
10
+
11
+ ---
12
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*