@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
@@ -1,201 +1,214 @@
1
1
  ---
2
2
  name: vercel-cost-tuning
3
- description: |
4
- Optimize Vercel costs through tier selection, sampling, and usage monitoring.
5
- Use when analyzing Vercel billing, reducing API costs,
6
- or implementing usage monitoring and budget alerts.
3
+ description: 'Optimize Vercel costs through plan selection, function efficiency, and
4
+ usage monitoring.
5
+
6
+ Use when analyzing Vercel billing, reducing function execution costs,
7
+
8
+ or implementing spend management and budget alerts.
9
+
7
10
  Trigger with phrases like "vercel cost", "vercel billing",
11
+
8
12
  "reduce vercel costs", "vercel pricing", "vercel expensive", "vercel budget".
9
- allowed-tools: Read, Grep
13
+
14
+ '
15
+ allowed-tools: Read, Write, Edit, Bash(vercel:*), Bash(curl:*), Grep
10
16
  version: 1.0.0
11
17
  license: MIT
12
18
  author: Jeremy Longshore <jeremy@intentsolutions.io>
19
+ tags:
20
+ - saas
21
+ - vercel
22
+ - cost-optimization
23
+ - billing
24
+ - monitoring
25
+ compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
13
26
  ---
14
-
15
27
  # Vercel Cost Tuning
16
28
 
17
29
  ## Overview
18
- Optimize Vercel costs through smart tier selection, sampling, and usage monitoring.
30
+
31
+ Optimize Vercel costs by understanding the Fluid Compute pricing model, reducing function execution time, leveraging edge caching to avoid function invocations, and configuring spend management. Covers plan comparison, cost drivers, and monitoring.
19
32
 
20
33
  ## Prerequisites
34
+
21
35
  - Access to Vercel billing dashboard
22
- - Understanding of current usage patterns
23
- - Database for usage tracking (optional)
24
- - Alerting system configured (optional)
36
+ - Understanding of current deployment architecture
37
+ - Access to Vercel Analytics for usage patterns
25
38
 
26
- ## Pricing Tiers
39
+ ## Instructions
27
40
 
28
- | Tier | Monthly Cost | Included | Overage |
29
- |------|-------------|----------|---------|
30
- | Hobby | $0 | 100GB bandwidth, 100GB-hrs functions | N/A |
31
- | Pro | $20 | 1TB bandwidth, 1000GB-hrs functions | $0.001/request |
32
- | Enterprise | Custom | Unlimited | Volume discounts |
41
+ ### Step 1: Understand the Pricing Model
33
42
 
34
- ## Cost Estimation
43
+ Vercel uses **Fluid Compute** pricing (for new projects):
35
44
 
36
- ```typescript
37
- interface UsageEstimate {
38
- requestsPerMonth: number;
39
- tier: string;
40
- estimatedCost: number;
41
- recommendation?: string;
42
- }
45
+ | Resource | Hobby (Free) | Pro ($20/member/mo) | Enterprise |
46
+ |----------|-------------|---------------------|------------|
47
+ | Bandwidth | 100 GB | 1 TB included | Custom |
48
+ | Serverless Execution | 100 GB-hrs | 1000 GB-hrs included | Custom |
49
+ | Edge Function invocations | 500K | 1M included | Custom |
50
+ | Edge Middleware invocations | 1M | 1M included | Custom |
51
+ | Image Optimizations | 1000 | 5000 included | Custom |
52
+ | Builds per day | 6000 | 6000 | Custom |
53
+ | Concurrent builds | 1 | 1 (more available) | Custom |
43
54
 
44
- function estimateVercelCost(requestsPerMonth: number): UsageEstimate {
45
- if (requestsPerMonth <= 1000) {
46
- return { requestsPerMonth, tier: 'Free', estimatedCost: 0 };
47
- }
55
+ **Fluid Compute billing breakdown:**
48
56
 
49
- if (requestsPerMonth <= 100000) {
50
- return { requestsPerMonth, tier: 'Pro', estimatedCost: 20 };
51
- }
57
+ - **Active CPU time**: charged per ms of actual CPU usage
58
+ - **Provisioned memory**: charged per GB-second of allocated memory
59
+ - Benefit: you pay for actual work, not idle waiting (e.g., waiting for a database response)
52
60
 
53
- const proOverage = (requestsPerMonth - 100000) * 0.001;
54
- const proCost = 20 + proOverage;
55
-
56
- return {
57
- requestsPerMonth,
58
- tier: 'Pro (with overage)',
59
- estimatedCost: proCost,
60
- recommendation: proCost > 500
61
- ? 'Consider Enterprise tier for volume discounts'
62
- : undefined,
63
- };
64
- }
61
+ ### Step 2: Identify Cost Drivers
62
+
63
+ ```bash
64
+ # Check usage via API
65
+ curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
66
+ "https://api.vercel.com/v2/usage" | jq .
67
+
68
+ # Top cost drivers on Vercel:
69
+ # 1. Serverless function execution time (CPU + memory)
70
+ # 2. Bandwidth (large responses, unoptimized images)
71
+ # 3. Edge Middleware invocations (runs on EVERY request)
72
+ # 4. Image optimizations (each unique transform costs)
73
+ # 5. Build minutes (frequent deploys or slow builds)
65
74
  ```
66
75
 
67
- ## Usage Monitoring
76
+ ### Step 3: Reduce Function Execution Costs
68
77
 
69
78
  ```typescript
70
- class VercelUsageMonitor {
71
- private requestCount = 0;
72
- private bytesTransferred = 0;
73
- private alertThreshold: number;
74
-
75
- constructor(monthlyBudget: number) {
76
- this.alertThreshold = monthlyBudget * 0.8; // 80% warning
77
- }
78
-
79
- track(request: { bytes: number }) {
80
- this.requestCount++;
81
- this.bytesTransferred += request.bytes;
82
-
83
- if (this.estimatedCost() > this.alertThreshold) {
84
- this.sendAlert('Approaching Vercel budget limit');
85
- }
86
- }
87
-
88
- estimatedCost(): number {
89
- return estimateVercelCost(this.requestCount).estimatedCost;
90
- }
91
-
92
- private sendAlert(message: string) {
93
- // Send to Slack, email, PagerDuty, etc.
79
+ // 1. Right-size function memory — don't over-allocate
80
+ // vercel.json
81
+ {
82
+ "functions": {
83
+ "api/lightweight.ts": { "memory": 128 }, // Simple JSON responses
84
+ "api/standard.ts": { "memory": 512 }, // Database queries
85
+ "api/heavy.ts": { "memory": 1024 } // Image processing
94
86
  }
95
87
  }
96
- ```
97
88
 
98
- ## Cost Reduction Strategies
89
+ // 2. Move read-only endpoints to Edge Functions (cheaper, no cold starts)
90
+ // api/config.ts
91
+ export const config = { runtime: 'edge' };
92
+ export default function handler() {
93
+ return Response.json({ features: ['a', 'b'] });
94
+ }
99
95
 
100
- ### Step 1: Request Sampling
101
- ```typescript
102
- function shouldSample(samplingRate = 0.1): boolean {
103
- return Math.random() < samplingRate;
96
+ // 3. Cache function responses at the edge
97
+ // Eliminates function invocations entirely for cached routes
98
+ export default function handler(req, res) {
99
+ res.setHeader('Cache-Control', 's-maxage=3600, stale-while-revalidate=86400');
100
+ res.json(data);
104
101
  }
102
+ ```
105
103
 
106
- // Use for non-critical telemetry
107
- if (shouldSample(0.1)) { // 10% sample
108
- await vercelClient.trackEvent(event);
104
+ ### Step 4: Reduce Bandwidth Costs
105
+
106
+ ```json
107
+ // vercel.json — compress and cache aggressively
108
+ {
109
+ "headers": [
110
+ {
111
+ "source": "/static/(.*)",
112
+ "headers": [
113
+ { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
114
+ ]
115
+ }
116
+ ],
117
+ "images": {
118
+ "sizes": [640, 750, 1080],
119
+ "formats": ["image/avif", "image/webp"],
120
+ "minimumCacheTTL": 86400
121
+ }
109
122
  }
110
123
  ```
111
124
 
112
- ### Step 2: Batching Requests
113
- ```typescript
114
- // Instead of N individual calls
115
- await Promise.all(ids.map(id => vercelClient.get(id)));
125
+ Key bandwidth reducers:
116
126
 
117
- // Use batch endpoint (1 call)
118
- await vercelClient.batchGet(ids);
119
- ```
127
+ - Use Vercel's image optimization (auto WebP/AVIF conversion)
128
+ - Set aggressive cache headers on static assets
129
+ - Use ISR to serve static HTML instead of SSR
130
+ - Compress API responses (Vercel auto-compresses with Brotli)
120
131
 
121
- ### Step 3: Caching (from P16)
122
- - Cache frequently accessed data
123
- - Use cache invalidation webhooks
124
- - Set appropriate TTLs
132
+ ### Step 5: Optimize Middleware Costs
133
+
134
+ Middleware runs on **every matched request**. Minimize its scope:
125
135
 
126
- ### Step 4: Compression
127
136
  ```typescript
128
- const client = new VercelClient({
129
- compression: true, // Enable gzip
130
- });
137
+ // middleware.ts scope to specific paths only
138
+ export const config = {
139
+ matcher: [
140
+ // Only run middleware on API routes and protected pages
141
+ '/api/:path*',
142
+ '/dashboard/:path*',
143
+ // Skip static files, images, and public assets
144
+ '/((?!_next/static|_next/image|favicon.ico|public).*)',
145
+ ],
146
+ };
147
+
148
+ export function middleware(request) {
149
+ // Keep logic minimal — this runs on every matched request
150
+ // Avoid: database queries, external API calls, heavy computation
151
+ // Good: cookie checks, header modifications, redirects
152
+ }
131
153
  ```
132
154
 
133
- ## Budget Alerts
155
+ ### Step 6: Configure Spend Management
134
156
 
135
- ```bash
136
- # Set up billing alerts in Vercel dashboard
137
- # Or use API if available:
138
- # Check Vercel documentation for billing APIs
139
- ```
157
+ In the Vercel dashboard under **Settings > Billing > Spend Management**:
140
158
 
141
- ## Cost Dashboard Query
142
-
143
- ```sql
144
- -- If tracking usage in your database
145
- SELECT
146
- DATE_TRUNC('day', created_at) as date,
147
- COUNT(*) as requests,
148
- SUM(response_bytes) as bytes,
149
- COUNT(*) * 0.001 as estimated_cost
150
- FROM vercel_api_logs
151
- WHERE created_at >= NOW() - INTERVAL '30 days'
152
- GROUP BY 1
153
- ORDER BY 1;
159
+ ```
160
+ Default budget: $200/month on-demand usage
161
+ Options:
162
+ - Set custom budget limit
163
+ - Enable hard limit (pauses all projects when reached)
164
+ - Configure email alerts at 50%, 75%, 90%, 100%
154
165
  ```
155
166
 
156
- ## Instructions
157
-
158
- ### Step 1: Analyze Current Usage
159
- Review Vercel dashboard for usage patterns and costs.
160
-
161
- ### Step 2: Select Optimal Tier
162
- Use the cost estimation function to find the right tier.
167
+ ```bash
168
+ # Check current usage against budget via API
169
+ curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
170
+ "https://api.vercel.com/v2/usage?teamId=team_xxx" \
171
+ | jq '{period: .period, bandwidth: .bandwidth, execution: .serverlessFunctionExecution}'
172
+ ```
163
173
 
164
- ### Step 3: Implement Monitoring
165
- Add usage tracking to catch budget overruns early.
174
+ ## Cost Optimization Checklist
166
175
 
167
- ### Step 4: Apply Optimizations
168
- Enable batching, caching, and sampling where appropriate.
176
+ | Action | Impact | Effort |
177
+ |--------|--------|--------|
178
+ | Add `s-maxage` cache headers | High — eliminates function invocations | Low |
179
+ | Use Edge Functions for simple endpoints | Medium — cheaper than serverless | Low |
180
+ | Right-size function memory | Medium — reduces GB-hr cost | Low |
181
+ | Scope middleware matcher | Medium — reduces edge invocations | Low |
182
+ | Enable image optimization | Medium — reduces bandwidth | Low |
183
+ | Use ISR instead of SSR | High — serves cached HTML | Medium |
184
+ | Optimize build speed | Low — reduces build minutes | Medium |
185
+ | Set spend management alerts | Safety — prevents surprise bills | Low |
169
186
 
170
187
  ## Output
171
- - Optimized tier selection
172
- - Usage monitoring implemented
173
- - Budget alerts configured
174
- - Cost reduction strategies applied
175
188
 
176
- ## Error Handling
177
- | Issue | Cause | Solution |
178
- |-------|-------|----------|
179
- | Unexpected charges | Untracked usage | Implement monitoring |
180
- | Overage fees | Wrong tier | Upgrade tier |
181
- | Budget exceeded | No alerts | Set up alerts |
182
- | Inefficient usage | No batching | Enable batch requests |
189
+ - Function memory right-sized per endpoint
190
+ - Edge caching reducing function invocations
191
+ - Middleware scoped to minimize invocations
192
+ - Spend management configured with budget alerts
193
+ - Usage monitoring via API
183
194
 
184
- ## Examples
195
+ ## Error Handling
185
196
 
186
- ### Quick Cost Check
187
- ```typescript
188
- // Estimate monthly cost for your usage
189
- const estimate = estimateVercelCost(yourMonthlyRequests);
190
- console.log(`Tier: ${estimate.tier}, Cost: $${estimate.estimatedCost}`);
191
- if (estimate.recommendation) {
192
- console.log(`💡 ${estimate.recommendation}`);
193
- }
194
- ```
197
+ | Error | Cause | Solution |
198
+ |-------|-------|----------|
199
+ | Unexpected bill spike | Uncached high-traffic endpoint | Add `s-maxage` to the response |
200
+ | Projects paused | Hard spending limit reached | Increase limit or optimize usage |
201
+ | Image optimization quota exceeded | Too many unique image transforms | Reduce `sizes` array, increase cache TTL |
202
+ | Build minutes exceeded | Slow builds or too many deploys | Use `ignoreCommand` to skip non-code changes |
195
203
 
196
204
  ## Resources
205
+
197
206
  - [Vercel Pricing](https://vercel.com/pricing)
198
- - [Vercel Billing Dashboard](https://dashboard.vercel.com/billing)
207
+ - [Fluid Compute Pricing](https://vercel.com/docs/functions/usage-and-pricing)
208
+ - [Spend Management](https://vercel.com/docs/pricing#spend-management)
209
+ - [Limits](https://vercel.com/docs/limits)
210
+ - [Usage API](https://vercel.com/docs/rest-api)
199
211
 
200
212
  ## Next Steps
201
- For architecture patterns, see `vercel-reference-architecture`.
213
+
214
+ For reference architecture, see `vercel-reference-architecture`.
@@ -0,0 +1,34 @@
1
+ # Cost Estimation
2
+
3
+ ## Cost Estimation
4
+
5
+ ```typescript
6
+ interface UsageEstimate {
7
+ requestsPerMonth: number;
8
+ tier: string;
9
+ estimatedCost: number;
10
+ recommendation?: string;
11
+ }
12
+
13
+ function estimateVercelCost(requestsPerMonth: number): UsageEstimate {
14
+ if (requestsPerMonth <= 1000) {
15
+ return { requestsPerMonth, tier: 'Free', estimatedCost: 0 };
16
+ }
17
+
18
+ if (requestsPerMonth <= 100000) {
19
+ return { requestsPerMonth, tier: 'Pro', estimatedCost: 20 };
20
+ }
21
+
22
+ const proOverage = (requestsPerMonth - 100000) * 0.001;
23
+ const proCost = 20 + proOverage;
24
+
25
+ return {
26
+ requestsPerMonth,
27
+ tier: 'Pro (with overage)',
28
+ estimatedCost: proCost,
29
+ recommendation: proCost > 500
30
+ ? 'Consider Enterprise tier for volume discounts'
31
+ : undefined,
32
+ };
33
+ }
34
+ ```
@@ -0,0 +1,40 @@
1
+ # Cost Reduction Strategies
2
+
3
+ ## Cost Reduction Strategies
4
+
5
+ ### Step 1: Request Sampling
6
+
7
+ ```typescript
8
+ function shouldSample(samplingRate = 0.1): boolean {
9
+ return Math.random() < samplingRate;
10
+ }
11
+
12
+ // Use for non-critical telemetry
13
+ if (shouldSample(0.1)) { // 10% sample
14
+ await vercelClient.trackEvent(event);
15
+ }
16
+ ```
17
+
18
+ ### Step 2: Batching Requests
19
+
20
+ ```typescript
21
+ // Instead of N individual calls
22
+ await Promise.all(ids.map(id => vercelClient.get(id)));
23
+
24
+ // Use batch endpoint (1 call)
25
+ await vercelClient.batchGet(ids);
26
+ ```
27
+
28
+ ### Step 3: Caching (from P16)
29
+
30
+ - Cache frequently accessed data
31
+ - Use cache invalidation webhooks
32
+ - Set appropriate TTLs
33
+
34
+ ### Step 4: Compression
35
+
36
+ ```typescript
37
+ const client = new VercelClient({
38
+ compression: true, // Enable gzip
39
+ });
40
+ ```
@@ -0,0 +1,11 @@
1
+ # Error Handling Reference
2
+
3
+ | Issue | Cause | Solution |
4
+ |-------|-------|----------|
5
+ | Unexpected charges | Untracked usage | Implement monitoring |
6
+ | Overage fees | Wrong tier | Upgrade tier |
7
+ | Budget exceeded | No alerts | Set up alerts |
8
+ | Inefficient usage | No batching | Enable batch requests |
9
+
10
+ ---
11
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,15 @@
1
+ ## Examples
2
+
3
+ ### Quick Cost Check
4
+
5
+ ```typescript
6
+ // Estimate monthly cost for your usage
7
+ const estimate = estimateVercelCost(yourMonthlyRequests);
8
+ console.log(`Tier: ${estimate.tier}, Cost: $${estimate.estimatedCost}`);
9
+ if (estimate.recommendation) {
10
+ console.log(`💡 ${estimate.recommendation}`);
11
+ }
12
+ ```
13
+
14
+ ---
15
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*