@intentsolutionsio/supabase-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/supabase-advanced-troubleshooting/SKILL.md +261 -0
- package/skills/supabase-architecture-variants/SKILL.md +284 -0
- package/skills/supabase-auth-storage-realtime-core/SKILL.md +73 -0
- package/skills/supabase-ci-integration/SKILL.md +124 -0
- package/skills/supabase-common-errors/SKILL.md +109 -0
- package/skills/supabase-cost-tuning/SKILL.md +201 -0
- package/skills/supabase-data-handling/SKILL.md +220 -0
- package/skills/supabase-debug-bundle/SKILL.md +111 -0
- package/skills/supabase-deploy-integration/SKILL.md +209 -0
- package/skills/supabase-enterprise-rbac/SKILL.md +222 -0
- package/skills/supabase-hello-world/SKILL.md +96 -0
- package/skills/supabase-incident-runbook/SKILL.md +203 -0
- package/skills/supabase-install-auth/SKILL.md +90 -0
- package/skills/supabase-known-pitfalls/SKILL.md +334 -0
- package/skills/supabase-load-scale/SKILL.md +274 -0
- package/skills/supabase-local-dev-loop/SKILL.md +117 -0
- package/skills/supabase-migration-deep-dive/SKILL.md +244 -0
- package/skills/supabase-multi-env-setup/SKILL.md +222 -0
- package/skills/supabase-observability/SKILL.md +250 -0
- package/skills/supabase-performance-tuning/SKILL.md +214 -0
- package/skills/supabase-policy-guardrails/SKILL.md +257 -0
- package/skills/supabase-prod-checklist/SKILL.md +119 -0
- package/skills/supabase-rate-limits/SKILL.md +149 -0
- package/skills/supabase-reference-architecture/SKILL.md +238 -0
- package/skills/supabase-reliability-patterns/SKILL.md +290 -0
- package/skills/supabase-schema-from-requirements/SKILL.md +71 -0
- package/skills/supabase-sdk-patterns/SKILL.md +147 -0
- package/skills/supabase-security-basics/SKILL.md +140 -0
- package/skills/supabase-upgrade-migration/SKILL.md +112 -0
- package/skills/supabase-webhooks-events/SKILL.md +199 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-auth-storage-realtime-core
|
|
3
|
+
description: |
|
|
4
|
+
Execute Supabase secondary workflow: Auth + Storage + Realtime.
|
|
5
|
+
Use when implementing secondary use case,
|
|
6
|
+
or complementing primary workflow.
|
|
7
|
+
Trigger with phrases like "supabase auth storage realtime",
|
|
8
|
+
"implement full stack features with supabase".
|
|
9
|
+
allowed-tools: Read, Write, Edit, Bash(npm:*), Grep
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Supabase Auth + Storage + Realtime
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Implement the core Supabase trifecta: authentication, file storage,
|
|
19
|
+
and real-time subscriptions in a single cohesive setup.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
- Completed `supabase-install-auth` setup
|
|
24
|
+
- Familiarity with `supabase-schema-from-requirements`
|
|
25
|
+
- Valid API credentials configured
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
### Step 1: Setup
|
|
30
|
+
```typescript
|
|
31
|
+
// Step 1 implementation
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 2: Process
|
|
35
|
+
```typescript
|
|
36
|
+
// Step 2 implementation
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 3: Complete
|
|
40
|
+
```typescript
|
|
41
|
+
// Step 3 implementation
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Output
|
|
45
|
+
- Completed Auth + Storage + Realtime execution
|
|
46
|
+
- Results from Supabase API
|
|
47
|
+
- Success confirmation or error details
|
|
48
|
+
|
|
49
|
+
## Error Handling
|
|
50
|
+
| Aspect | Schema from Requirements | Auth + Storage + Realtime |
|
|
51
|
+
|--------|------------|------------|
|
|
52
|
+
| Use Case | Starting a new project with defined data requirements | Secondary |
|
|
53
|
+
| Complexity | Medium | Lower |
|
|
54
|
+
| Performance | Standard | Optimized |
|
|
55
|
+
|
|
56
|
+
## Examples
|
|
57
|
+
|
|
58
|
+
### Complete Workflow
|
|
59
|
+
```typescript
|
|
60
|
+
// Complete workflow example
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Error Recovery
|
|
64
|
+
```typescript
|
|
65
|
+
// Error handling code
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resources
|
|
69
|
+
- [Supabase Documentation](https://supabase.com/docs)
|
|
70
|
+
- [Supabase API Reference](https://supabase.com/docs/api)
|
|
71
|
+
|
|
72
|
+
## Next Steps
|
|
73
|
+
For common errors, see `supabase-common-errors`.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-ci-integration
|
|
3
|
+
description: |
|
|
4
|
+
Configure Supabase CI/CD integration with GitHub Actions and testing.
|
|
5
|
+
Use when setting up automated testing, configuring CI pipelines,
|
|
6
|
+
or integrating Supabase tests into your build process.
|
|
7
|
+
Trigger with phrases like "supabase CI", "supabase GitHub Actions",
|
|
8
|
+
"supabase automated tests", "CI supabase".
|
|
9
|
+
allowed-tools: Read, Write, Edit, Bash(gh:*)
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Supabase CI Integration
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Set up CI/CD pipelines for Supabase integrations with automated testing.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- GitHub repository with Actions enabled
|
|
22
|
+
- Supabase test API key
|
|
23
|
+
- npm/pnpm project configured
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
### Step 1: Create GitHub Actions Workflow
|
|
28
|
+
Create `.github/workflows/supabase-integration.yml`:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
name: Supabase Integration Tests
|
|
32
|
+
|
|
33
|
+
on:
|
|
34
|
+
push:
|
|
35
|
+
branches: [main]
|
|
36
|
+
pull_request:
|
|
37
|
+
branches: [main]
|
|
38
|
+
|
|
39
|
+
env:
|
|
40
|
+
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
|
|
41
|
+
|
|
42
|
+
jobs:
|
|
43
|
+
test:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
env:
|
|
46
|
+
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: actions/setup-node@v4
|
|
50
|
+
with:
|
|
51
|
+
node-version: '20'
|
|
52
|
+
cache: 'npm'
|
|
53
|
+
- run: npm ci
|
|
54
|
+
- run: npm test -- --coverage
|
|
55
|
+
- run: npm run test:integration
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 2: Configure Secrets
|
|
59
|
+
```bash
|
|
60
|
+
gh secret set SUPABASE_API_KEY --body "sk_test_***"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3: Add Integration Tests
|
|
64
|
+
```typescript
|
|
65
|
+
describe('Supabase Integration', () => {
|
|
66
|
+
it.skipIf(!process.env.SUPABASE_API_KEY)('should connect', async () => {
|
|
67
|
+
const client = getSupabaseClient();
|
|
68
|
+
const result = await client.healthCheck();
|
|
69
|
+
expect(result.status).toBe('ok');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Output
|
|
75
|
+
- Automated test pipeline
|
|
76
|
+
- PR checks configured
|
|
77
|
+
- Coverage reports uploaded
|
|
78
|
+
- Release workflow ready
|
|
79
|
+
|
|
80
|
+
## Error Handling
|
|
81
|
+
| Issue | Cause | Solution |
|
|
82
|
+
|-------|-------|----------|
|
|
83
|
+
| Secret not found | Missing configuration | Add secret via `gh secret set` |
|
|
84
|
+
| Tests timeout | Network issues | Increase timeout or mock |
|
|
85
|
+
| Auth failures | Invalid key | Check secret value |
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
### Release Workflow
|
|
90
|
+
```yaml
|
|
91
|
+
on:
|
|
92
|
+
push:
|
|
93
|
+
tags: ['v*']
|
|
94
|
+
|
|
95
|
+
jobs:
|
|
96
|
+
release:
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
env:
|
|
99
|
+
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY_PROD }}
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/checkout@v4
|
|
102
|
+
- uses: actions/setup-node@v4
|
|
103
|
+
with:
|
|
104
|
+
node-version: '20'
|
|
105
|
+
- run: npm ci
|
|
106
|
+
- name: Verify Supabase production readiness
|
|
107
|
+
run: npm run test:integration
|
|
108
|
+
- run: npm run build
|
|
109
|
+
- run: npm publish
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Branch Protection
|
|
113
|
+
```yaml
|
|
114
|
+
required_status_checks:
|
|
115
|
+
- "test"
|
|
116
|
+
- "supabase-integration"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Resources
|
|
120
|
+
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
|
121
|
+
- [Supabase CI Guide](https://supabase.com/docs/ci)
|
|
122
|
+
|
|
123
|
+
## Next Steps
|
|
124
|
+
For deployment patterns, see `supabase-deploy-integration`.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-common-errors
|
|
3
|
+
description: |
|
|
4
|
+
Diagnose and fix Supabase common errors and exceptions.
|
|
5
|
+
Use when encountering Supabase errors, debugging failed requests,
|
|
6
|
+
or troubleshooting integration issues.
|
|
7
|
+
Trigger with phrases like "supabase error", "fix supabase",
|
|
8
|
+
"supabase not working", "debug supabase".
|
|
9
|
+
allowed-tools: Read, Grep, Bash(curl:*)
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Supabase Common Errors
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Quick reference for the top 10 most common Supabase errors and their solutions.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- Supabase SDK installed
|
|
22
|
+
- API credentials configured
|
|
23
|
+
- Access to error logs
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
### Step 1: Identify the Error
|
|
28
|
+
Check error message and code in your logs or console.
|
|
29
|
+
|
|
30
|
+
### Step 2: Find Matching Error Below
|
|
31
|
+
Match your error to one of the documented cases.
|
|
32
|
+
|
|
33
|
+
### Step 3: Apply Solution
|
|
34
|
+
Follow the solution steps for your specific error.
|
|
35
|
+
|
|
36
|
+
## Output
|
|
37
|
+
- Identified error cause
|
|
38
|
+
- Applied fix
|
|
39
|
+
- Verified resolution
|
|
40
|
+
|
|
41
|
+
## Error Handling
|
|
42
|
+
|
|
43
|
+
### Invalid JWT
|
|
44
|
+
**Error Message:**
|
|
45
|
+
```
|
|
46
|
+
Invalid JWT: expired or malformed
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Cause:** JWT token has expired or is incorrectly formatted
|
|
50
|
+
|
|
51
|
+
**Solution:**
|
|
52
|
+
```bash
|
|
53
|
+
Check token expiry with supabase.auth.getSession() and call refreshSession() if needed
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### RLS Policy Violation
|
|
59
|
+
**Error Message:**
|
|
60
|
+
```
|
|
61
|
+
new row violates row-level security policy for table
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Cause:** Row Level Security (RLS) policy is blocking the operation
|
|
65
|
+
|
|
66
|
+
**Solution:**
|
|
67
|
+
Check RLS policies in dashboard or via pg_policies table. Ensure user has required role.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Connection Pool Exhausted
|
|
72
|
+
**Error Message:**
|
|
73
|
+
```
|
|
74
|
+
too many clients already
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Cause:** Connection pool limit reached due to too many concurrent connections
|
|
78
|
+
|
|
79
|
+
**Solution:**
|
|
80
|
+
```typescript
|
|
81
|
+
Use connection pooling mode in Supabase dashboard. Switch to Session mode or pgBouncer.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Examples
|
|
85
|
+
|
|
86
|
+
### Quick Diagnostic Commands
|
|
87
|
+
```bash
|
|
88
|
+
# Check Supabase status
|
|
89
|
+
curl -s https://status.supabase.com
|
|
90
|
+
|
|
91
|
+
# Verify API connectivity
|
|
92
|
+
curl -I https://api.supabase.com
|
|
93
|
+
|
|
94
|
+
# Check local configuration
|
|
95
|
+
env | grep SUPABASE
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Escalation Path
|
|
99
|
+
1. Collect evidence with `supabase-debug-bundle`
|
|
100
|
+
2. Check Supabase status page
|
|
101
|
+
3. Contact support with request ID
|
|
102
|
+
|
|
103
|
+
## Resources
|
|
104
|
+
- [Supabase Status Page](https://status.supabase.com)
|
|
105
|
+
- [Supabase Support](https://supabase.com/docs/support)
|
|
106
|
+
- [Supabase Error Codes](https://supabase.com/docs/errors)
|
|
107
|
+
|
|
108
|
+
## Next Steps
|
|
109
|
+
For comprehensive debugging, see `supabase-debug-bundle`.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-cost-tuning
|
|
3
|
+
description: |
|
|
4
|
+
Optimize Supabase costs through tier selection, sampling, and usage monitoring.
|
|
5
|
+
Use when analyzing Supabase billing, reducing API costs,
|
|
6
|
+
or implementing usage monitoring and budget alerts.
|
|
7
|
+
Trigger with phrases like "supabase cost", "supabase billing",
|
|
8
|
+
"reduce supabase costs", "supabase pricing", "supabase expensive", "supabase budget".
|
|
9
|
+
allowed-tools: Read, Grep
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
license: MIT
|
|
12
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Supabase Cost Tuning
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Optimize Supabase costs through smart tier selection, sampling, and usage monitoring.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- Access to Supabase billing dashboard
|
|
22
|
+
- Understanding of current usage patterns
|
|
23
|
+
- Database for usage tracking (optional)
|
|
24
|
+
- Alerting system configured (optional)
|
|
25
|
+
|
|
26
|
+
## Pricing Tiers
|
|
27
|
+
|
|
28
|
+
| Tier | Monthly Cost | Included | Overage |
|
|
29
|
+
|------|-------------|----------|---------|
|
|
30
|
+
| Free | $0 | 500MB database, 1GB storage, 50K MAUs | N/A |
|
|
31
|
+
| Pro | $25 | 8GB database, 100GB storage, 100K MAUs | $0.001/request |
|
|
32
|
+
| Enterprise | Custom | Unlimited | Volume discounts |
|
|
33
|
+
|
|
34
|
+
## Cost Estimation
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
interface UsageEstimate {
|
|
38
|
+
requestsPerMonth: number;
|
|
39
|
+
tier: string;
|
|
40
|
+
estimatedCost: number;
|
|
41
|
+
recommendation?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function estimateSupabaseCost(requestsPerMonth: number): UsageEstimate {
|
|
45
|
+
if (requestsPerMonth <= 1000) {
|
|
46
|
+
return { requestsPerMonth, tier: 'Free', estimatedCost: 0 };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (requestsPerMonth <= 100000) {
|
|
50
|
+
return { requestsPerMonth, tier: 'Pro', estimatedCost: 25 };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const proOverage = (requestsPerMonth - 100000) * 0.001;
|
|
54
|
+
const proCost = 25 + 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
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage Monitoring
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
class SupabaseUsageMonitor {
|
|
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 Supabase budget limit');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
estimatedCost(): number {
|
|
89
|
+
return estimateSupabaseCost(this.requestCount).estimatedCost;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private sendAlert(message: string) {
|
|
93
|
+
// Send to Slack, email, PagerDuty, etc.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Cost Reduction Strategies
|
|
99
|
+
|
|
100
|
+
### Step 1: Request Sampling
|
|
101
|
+
```typescript
|
|
102
|
+
function shouldSample(samplingRate = 0.1): boolean {
|
|
103
|
+
return Math.random() < samplingRate;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Use for non-critical telemetry
|
|
107
|
+
if (shouldSample(0.1)) { // 10% sample
|
|
108
|
+
await supabaseClient.trackEvent(event);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 2: Batching Requests
|
|
113
|
+
```typescript
|
|
114
|
+
// Instead of N individual calls
|
|
115
|
+
await Promise.all(ids.map(id => supabaseClient.get(id)));
|
|
116
|
+
|
|
117
|
+
// Use batch endpoint (1 call)
|
|
118
|
+
await supabaseClient.batchGet(ids);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Step 3: Caching (from P16)
|
|
122
|
+
- Cache frequently accessed data
|
|
123
|
+
- Use cache invalidation webhooks
|
|
124
|
+
- Set appropriate TTLs
|
|
125
|
+
|
|
126
|
+
### Step 4: Compression
|
|
127
|
+
```typescript
|
|
128
|
+
const client = new SupabaseClient({
|
|
129
|
+
compression: true, // Enable gzip
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Budget Alerts
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Set up billing alerts in Supabase dashboard
|
|
137
|
+
# Or use API if available:
|
|
138
|
+
# Check Supabase documentation for billing APIs
|
|
139
|
+
```
|
|
140
|
+
|
|
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 supabase_api_logs
|
|
151
|
+
WHERE created_at >= NOW() - INTERVAL '30 days'
|
|
152
|
+
GROUP BY 1
|
|
153
|
+
ORDER BY 1;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Instructions
|
|
157
|
+
|
|
158
|
+
### Step 1: Analyze Current Usage
|
|
159
|
+
Review Supabase dashboard for usage patterns and costs.
|
|
160
|
+
|
|
161
|
+
### Step 2: Select Optimal Tier
|
|
162
|
+
Use the cost estimation function to find the right tier.
|
|
163
|
+
|
|
164
|
+
### Step 3: Implement Monitoring
|
|
165
|
+
Add usage tracking to catch budget overruns early.
|
|
166
|
+
|
|
167
|
+
### Step 4: Apply Optimizations
|
|
168
|
+
Enable batching, caching, and sampling where appropriate.
|
|
169
|
+
|
|
170
|
+
## Output
|
|
171
|
+
- Optimized tier selection
|
|
172
|
+
- Usage monitoring implemented
|
|
173
|
+
- Budget alerts configured
|
|
174
|
+
- Cost reduction strategies applied
|
|
175
|
+
|
|
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 |
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
### Quick Cost Check
|
|
187
|
+
```typescript
|
|
188
|
+
// Estimate monthly cost for your usage
|
|
189
|
+
const estimate = estimateSupabaseCost(yourMonthlyRequests);
|
|
190
|
+
console.log(`Tier: ${estimate.tier}, Cost: $${estimate.estimatedCost}`);
|
|
191
|
+
if (estimate.recommendation) {
|
|
192
|
+
console.log(`💡 ${estimate.recommendation}`);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Resources
|
|
197
|
+
- [Supabase Pricing](https://supabase.com/pricing)
|
|
198
|
+
- [Supabase Billing Dashboard](https://dashboard.supabase.com/billing)
|
|
199
|
+
|
|
200
|
+
## Next Steps
|
|
201
|
+
For architecture patterns, see `supabase-reference-architecture`.
|