@intentsolutionsio/supabase-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 (133) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +73 -47
  3. package/package.json +4 -4
  4. package/skills/supabase-advanced-troubleshooting/SKILL.md +404 -200
  5. package/skills/supabase-advanced-troubleshooting/references/errors.md +11 -0
  6. package/skills/supabase-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
  7. package/skills/supabase-advanced-troubleshooting/references/examples.md +11 -0
  8. package/skills/supabase-advanced-troubleshooting/references/rls-edge-functions-realtime.md +363 -0
  9. package/skills/supabase-advanced-troubleshooting/references/systematic-isolation.md +56 -0
  10. package/skills/supabase-advanced-troubleshooting/references/timing-analysis.md +35 -0
  11. package/skills/supabase-architecture-variants/SKILL.md +395 -216
  12. package/skills/supabase-architecture-variants/references/errors.md +11 -0
  13. package/skills/supabase-architecture-variants/references/examples.md +12 -0
  14. package/skills/supabase-architecture-variants/references/serverless-and-multi-tenant.md +251 -0
  15. package/skills/supabase-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
  16. package/skills/supabase-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
  17. package/skills/supabase-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
  18. package/skills/supabase-auth-storage-realtime-core/SKILL.md +471 -37
  19. package/skills/supabase-ci-integration/SKILL.md +315 -67
  20. package/skills/supabase-ci-integration/references/errors.md +10 -0
  21. package/skills/supabase-ci-integration/references/examples.md +36 -0
  22. package/skills/supabase-ci-integration/references/implementation.md +54 -0
  23. package/skills/supabase-common-errors/SKILL.md +320 -62
  24. package/skills/supabase-common-errors/references/errors.md +53 -0
  25. package/skills/supabase-common-errors/references/examples.md +23 -0
  26. package/skills/supabase-cost-tuning/SKILL.md +365 -131
  27. package/skills/supabase-cost-tuning/references/cost-estimation.md +34 -0
  28. package/skills/supabase-cost-tuning/references/cost-reduction-strategies.md +40 -0
  29. package/skills/supabase-cost-tuning/references/errors.md +11 -0
  30. package/skills/supabase-cost-tuning/references/examples.md +15 -0
  31. package/skills/supabase-data-handling/SKILL.md +378 -145
  32. package/skills/supabase-data-handling/references/errors.md +11 -0
  33. package/skills/supabase-data-handling/references/examples.md +27 -0
  34. package/skills/supabase-data-handling/references/implementation.md +223 -0
  35. package/skills/supabase-data-handling/references/retention-and-backup.md +221 -0
  36. package/skills/supabase-debug-bundle/SKILL.md +267 -73
  37. package/skills/supabase-debug-bundle/references/errors.md +12 -0
  38. package/skills/supabase-debug-bundle/references/examples.md +24 -0
  39. package/skills/supabase-debug-bundle/references/implementation.md +54 -0
  40. package/skills/supabase-deploy-integration/SKILL.md +258 -147
  41. package/skills/supabase-deploy-integration/references/errors.md +11 -0
  42. package/skills/supabase-deploy-integration/references/examples.md +21 -0
  43. package/skills/supabase-deploy-integration/references/google-cloud-run.md +36 -0
  44. package/skills/supabase-deploy-integration/references/vercel-deployment.md +35 -0
  45. package/skills/supabase-enterprise-rbac/SKILL.md +327 -160
  46. package/skills/supabase-enterprise-rbac/references/api-scoping-and-enforcement.md +255 -0
  47. package/skills/supabase-enterprise-rbac/references/errors.md +11 -0
  48. package/skills/supabase-enterprise-rbac/references/examples.md +12 -0
  49. package/skills/supabase-enterprise-rbac/references/role-implementation.md +33 -0
  50. package/skills/supabase-enterprise-rbac/references/sso-integration.md +35 -0
  51. package/skills/supabase-hello-world/SKILL.md +160 -54
  52. package/skills/supabase-incident-runbook/SKILL.md +453 -131
  53. package/skills/supabase-incident-runbook/references/errors.md +11 -0
  54. package/skills/supabase-incident-runbook/references/examples.md +10 -0
  55. package/skills/supabase-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
  56. package/skills/supabase-install-auth/SKILL.md +186 -50
  57. package/skills/supabase-install-auth/references/examples.md +102 -0
  58. package/skills/supabase-known-pitfalls/SKILL.md +411 -241
  59. package/skills/supabase-known-pitfalls/references/errors.md +11 -0
  60. package/skills/supabase-known-pitfalls/references/examples.md +12 -0
  61. package/skills/supabase-load-scale/SKILL.md +346 -217
  62. package/skills/supabase-load-scale/references/capacity-planning.md +47 -0
  63. package/skills/supabase-load-scale/references/errors.md +11 -0
  64. package/skills/supabase-load-scale/references/examples.md +26 -0
  65. package/skills/supabase-load-scale/references/load-testing-with-k6.md +59 -0
  66. package/skills/supabase-load-scale/references/scaling-patterns.md +65 -0
  67. package/skills/supabase-load-scale/references/table-partitioning.md +263 -0
  68. package/skills/supabase-local-dev-loop/SKILL.md +272 -73
  69. package/skills/supabase-local-dev-loop/references/errors.md +11 -0
  70. package/skills/supabase-local-dev-loop/references/examples.md +21 -0
  71. package/skills/supabase-local-dev-loop/references/implementation.md +60 -0
  72. package/skills/supabase-migration-deep-dive/SKILL.md +338 -177
  73. package/skills/supabase-migration-deep-dive/references/backfill-versioning-rollback.md +258 -0
  74. package/skills/supabase-migration-deep-dive/references/errors.md +11 -0
  75. package/skills/supabase-migration-deep-dive/references/examples.md +12 -0
  76. package/skills/supabase-migration-deep-dive/references/implementation-plan.md +80 -0
  77. package/skills/supabase-migration-deep-dive/references/pre-migration-assessment.md +39 -0
  78. package/skills/supabase-multi-env-setup/SKILL.md +393 -152
  79. package/skills/supabase-multi-env-setup/references/configuration-structure.md +59 -0
  80. package/skills/supabase-multi-env-setup/references/errors.md +11 -0
  81. package/skills/supabase-multi-env-setup/references/examples.md +11 -0
  82. package/skills/supabase-observability/SKILL.md +318 -196
  83. package/skills/supabase-observability/references/alert-configuration.md +40 -0
  84. package/skills/supabase-observability/references/errors.md +11 -0
  85. package/skills/supabase-observability/references/examples.md +13 -0
  86. package/skills/supabase-observability/references/metrics-collection.md +65 -0
  87. package/skills/supabase-performance-tuning/SKILL.md +304 -160
  88. package/skills/supabase-performance-tuning/references/caching-strategy.md +49 -0
  89. package/skills/supabase-performance-tuning/references/errors.md +11 -0
  90. package/skills/supabase-performance-tuning/references/examples.md +13 -0
  91. package/skills/supabase-policy-guardrails/SKILL.md +248 -221
  92. package/skills/supabase-policy-guardrails/references/ci-cost-security.md +484 -0
  93. package/skills/supabase-policy-guardrails/references/errors.md +11 -0
  94. package/skills/supabase-policy-guardrails/references/eslint-rules.md +46 -0
  95. package/skills/supabase-policy-guardrails/references/examples.md +10 -0
  96. package/skills/supabase-prod-checklist/SKILL.md +474 -84
  97. package/skills/supabase-prod-checklist/references/errors.md +63 -0
  98. package/skills/supabase-prod-checklist/references/examples.md +153 -0
  99. package/skills/supabase-prod-checklist/references/implementation.md +113 -0
  100. package/skills/supabase-rate-limits/SKILL.md +311 -98
  101. package/skills/supabase-rate-limits/references/errors.md +11 -0
  102. package/skills/supabase-rate-limits/references/examples.md +46 -0
  103. package/skills/supabase-rate-limits/references/implementation.md +66 -0
  104. package/skills/supabase-reference-architecture/SKILL.md +249 -182
  105. package/skills/supabase-reference-architecture/references/errors.md +29 -0
  106. package/skills/supabase-reference-architecture/references/examples.md +116 -0
  107. package/skills/supabase-reference-architecture/references/key-components.md +244 -0
  108. package/skills/supabase-reference-architecture/references/project-structure.md +109 -0
  109. package/skills/supabase-reliability-patterns/SKILL.md +229 -234
  110. package/skills/supabase-reliability-patterns/references/circuit-breaker.md +36 -0
  111. package/skills/supabase-reliability-patterns/references/dead-letter-queue.md +48 -0
  112. package/skills/supabase-reliability-patterns/references/errors.md +11 -0
  113. package/skills/supabase-reliability-patterns/references/examples.md +11 -0
  114. package/skills/supabase-reliability-patterns/references/idempotency-keys.md +36 -0
  115. package/skills/supabase-reliability-patterns/references/offline-degradation-health-dualwrite.md +489 -0
  116. package/skills/supabase-schema-from-requirements/SKILL.md +373 -34
  117. package/skills/supabase-sdk-patterns/SKILL.md +388 -99
  118. package/skills/supabase-sdk-patterns/references/errors.md +11 -0
  119. package/skills/supabase-sdk-patterns/references/examples.md +45 -0
  120. package/skills/supabase-sdk-patterns/references/implementation.md +67 -0
  121. package/skills/supabase-security-basics/SKILL.md +282 -102
  122. package/skills/supabase-security-basics/references/errors.md +10 -0
  123. package/skills/supabase-security-basics/references/examples.md +70 -0
  124. package/skills/supabase-security-basics/references/implementation.md +39 -0
  125. package/skills/supabase-upgrade-migration/SKILL.md +248 -66
  126. package/skills/supabase-upgrade-migration/references/errors.md +10 -0
  127. package/skills/supabase-upgrade-migration/references/examples.md +51 -0
  128. package/skills/supabase-upgrade-migration/references/implementation.md +29 -0
  129. package/skills/supabase-webhooks-events/SKILL.md +412 -138
  130. package/skills/supabase-webhooks-events/references/errors.md +55 -0
  131. package/skills/supabase-webhooks-events/references/event-handler-pattern.md +106 -0
  132. package/skills/supabase-webhooks-events/references/examples.md +133 -0
  133. package/skills/supabase-webhooks-events/references/signature-verification.md +165 -0
@@ -1,124 +1,372 @@
1
1
  ---
2
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.
3
+ description: 'Configure Supabase CI/CD pipelines with GitHub Actions: link projects,
4
+
5
+ push migrations, deploy Edge Functions, generate types, and run tests
6
+
7
+ against local Supabase instances.
8
+
9
+ Use when setting up CI pipelines for Supabase, automating database
10
+
11
+ migrations, deploying Edge Functions in CI, or running integration tests.
12
+
7
13
  Trigger with phrases like "supabase CI", "supabase GitHub Actions",
8
- "supabase automated tests", "CI supabase".
9
- allowed-tools: Read, Write, Edit, Bash(gh:*)
14
+
15
+ "supabase deploy pipeline", "CI supabase migrations", "supabase preview branches".
16
+
17
+ '
18
+ allowed-tools: Read, Write, Edit, Bash(npx:*), Bash(gh:*), Grep
10
19
  version: 1.0.0
11
20
  license: MIT
12
21
  author: Jeremy Longshore <jeremy@intentsolutions.io>
22
+ tags:
23
+ - saas
24
+ - supabase
25
+ - ci-cd
26
+ - github-actions
27
+ - devops
28
+ compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
13
29
  ---
14
-
15
30
  # Supabase CI Integration
16
31
 
17
32
  ## Overview
18
- Set up CI/CD pipelines for Supabase integrations with automated testing.
33
+
34
+ Build GitHub Actions workflows that automate the full Supabase lifecycle: link projects in CI, push migrations on merge, deploy Edge Functions, generate TypeScript types, run tests against a local Supabase instance, and create preview branches for pull requests. Every database change gets validated before it reaches production.
19
35
 
20
36
  ## Prerequisites
37
+
21
38
  - GitHub repository with Actions enabled
22
- - Supabase test API key
23
- - npm/pnpm project configured
39
+ - Supabase project created at [supabase.com/dashboard](https://supabase.com/dashboard)
40
+ - Supabase CLI initialized locally (`npx supabase init`)
41
+ - Node.js 18+ in your project
42
+ - `@supabase/supabase-js` installed:
43
+
44
+ ```bash
45
+ npm install @supabase/supabase-js
46
+ ```
24
47
 
25
48
  ## Instructions
26
49
 
27
- ### Step 1: Create GitHub Actions Workflow
28
- Create `.github/workflows/supabase-integration.yml`:
50
+ ### Step 1: Configure GitHub Secrets and Link in CI
51
+
52
+ Store credentials as GitHub repository secrets. The CI pipeline uses these to authenticate with your Supabase project without exposing tokens in code.
53
+
54
+ ```bash
55
+ # Set secrets via GitHub CLI
56
+ gh secret set SUPABASE_ACCESS_TOKEN --body "<your-access-token>"
57
+ gh secret set SUPABASE_DB_PASSWORD --body "<your-database-password>"
58
+ gh secret set SUPABASE_PROJECT_REF --body "<your-project-ref>"
59
+ ```
60
+
61
+ Generate your access token at [supabase.com/dashboard/account/tokens](https://supabase.com/dashboard/account/tokens). Find your project ref in Project Settings > General.
62
+
63
+ Link the project in any CI job that needs remote access:
29
64
 
30
65
  ```yaml
31
- name: Supabase Integration Tests
66
+ - name: Install Supabase CLI
67
+ uses: supabase/setup-cli@v1
68
+ with:
69
+ version: latest
70
+
71
+ - name: Link Supabase project
72
+ run: npx supabase link --project-ref ${{ secrets.SUPABASE_PROJECT_REF }}
73
+ env:
74
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
75
+ ```
76
+
77
+ ### Step 2: CI Workflow — Test, Validate Migrations, and Generate Types
78
+
79
+ This workflow starts a local Supabase instance, applies migrations, generates types, and runs your test suite on every pull request. It catches schema drift, broken migrations, and test failures before merge.
80
+
81
+ ```yaml
82
+ # .github/workflows/supabase-ci.yml
83
+ name: Supabase CI
32
84
 
33
85
  on:
34
- push:
35
- branches: [main]
36
86
  pull_request:
37
87
  branches: [main]
38
-
39
- env:
40
- SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
88
+ push:
89
+ branches: [main]
41
90
 
42
91
  jobs:
43
92
  test:
44
93
  runs-on: ubuntu-latest
45
- env:
46
- SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
47
94
  steps:
48
95
  - uses: actions/checkout@v4
96
+
49
97
  - uses: actions/setup-node@v4
50
98
  with:
51
- node-version: '20'
52
- cache: 'npm'
53
- - run: npm ci
54
- - run: npm test -- --coverage
55
- - run: npm run test:integration
99
+ node-version: 20
100
+
101
+ - name: Install dependencies
102
+ run: npm ci
103
+
104
+ - name: Install Supabase CLI
105
+ uses: supabase/setup-cli@v1
106
+ with:
107
+ version: latest
108
+
109
+ # Start local Supabase (disable unused services for speed)
110
+ - name: Start local Supabase
111
+ run: npx supabase start -x realtime,storage-api,imgproxy,inbucket
112
+
113
+ # Apply all migrations and seed data from scratch
114
+ - name: Validate migrations
115
+ run: npx supabase db reset
116
+
117
+ # Generate types and detect drift from committed version
118
+ - name: Generate and verify TypeScript types
119
+ run: |
120
+ npx supabase gen types typescript --local > src/types/database.types.ts
121
+ git diff --exit-code src/types/database.types.ts || {
122
+ echo "::error::TypeScript types are out of sync with database schema"
123
+ echo "Run: npx supabase gen types typescript --local > src/types/database.types.ts"
124
+ exit 1
125
+ }
126
+
127
+ # Run pgTAP database tests
128
+ - name: Run database tests
129
+ run: npx supabase test db
130
+
131
+ # Run application tests against local Supabase
132
+ - name: Run application tests
133
+ run: npm test
134
+ env:
135
+ SUPABASE_URL: http://127.0.0.1:54321
136
+ SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
137
+ SUPABASE_SERVICE_ROLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
138
+
139
+ - name: Type check
140
+ run: npx tsc --noEmit
141
+
142
+ - name: Stop Supabase
143
+ if: always()
144
+ run: npx supabase stop
56
145
  ```
57
146
 
58
- ### Step 2: Configure Secrets
59
- ```bash
60
- gh secret set SUPABASE_API_KEY --body "sk_test_***"
147
+ The `SUPABASE_ANON_KEY` and `SUPABASE_SERVICE_ROLE_KEY` above are the default local development keys — safe to commit. They only work against your local Supabase instance.
148
+
149
+ ### Step 3: Deploy Migrations and Edge Functions on Merge
150
+
151
+ This workflow runs only when migration files or Edge Function source changes are pushed to `main`. It links the remote project and pushes changes to production.
152
+
153
+ ```yaml
154
+ # .github/workflows/supabase-deploy.yml
155
+ name: Deploy to Supabase
156
+
157
+ on:
158
+ push:
159
+ branches: [main]
160
+ paths:
161
+ - 'supabase/migrations/**'
162
+ - 'supabase/functions/**'
163
+
164
+ jobs:
165
+ deploy:
166
+ runs-on: ubuntu-latest
167
+ steps:
168
+ - uses: actions/checkout@v4
169
+
170
+ - uses: actions/setup-node@v4
171
+ with:
172
+ node-version: 20
173
+
174
+ - name: Install Supabase CLI
175
+ uses: supabase/setup-cli@v1
176
+ with:
177
+ version: latest
178
+
179
+ - name: Link project
180
+ run: npx supabase link --project-ref ${{ secrets.SUPABASE_PROJECT_REF }}
181
+ env:
182
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
183
+
184
+ # Push pending migrations to production
185
+ - name: Push database migrations
186
+ run: npx supabase db push
187
+ env:
188
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
189
+ SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
190
+
191
+ # Deploy all Edge Functions
192
+ - name: Deploy Edge Functions
193
+ run: npx supabase functions deploy
194
+ env:
195
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
196
+
197
+ # Regenerate types from production schema
198
+ - name: Generate production types
199
+ run: |
200
+ npx supabase gen types typescript --linked > src/types/database.types.ts
201
+ echo "Types generated from production schema"
202
+ env:
203
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
204
+ SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
61
205
  ```
62
206
 
63
- ### Step 3: Add Integration Tests
207
+ ## Preview Branches
208
+
209
+ Create isolated Supabase environments for each pull request. Each preview branch gets its own database with migrations applied, so reviewers can test against real infrastructure.
210
+
211
+ ```yaml
212
+ # Add to your PR workflow
213
+ preview:
214
+ runs-on: ubuntu-latest
215
+ if: github.event_name == 'pull_request'
216
+ steps:
217
+ - uses: actions/checkout@v4
218
+
219
+ - name: Install Supabase CLI
220
+ uses: supabase/setup-cli@v1
221
+ with:
222
+ version: latest
223
+
224
+ - name: Link project
225
+ run: npx supabase link --project-ref ${{ secrets.SUPABASE_PROJECT_REF }}
226
+ env:
227
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
228
+
229
+ - name: Create preview branch
230
+ run: npx supabase branches create "preview-${{ github.event.number }}"
231
+ env:
232
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
233
+ ```
234
+
235
+ Preview branches require a Supabase Pro plan or higher. Each branch incurs compute costs while running.
236
+
237
+ ## Database Test Example
238
+
239
+ Write pgTAP tests in `supabase/tests/` to validate RLS policies and schema constraints in CI:
240
+
241
+ ```sql
242
+ -- supabase/tests/rls_validation.test.sql
243
+ begin;
244
+ select plan(3);
245
+
246
+ -- All public tables must have RLS enabled
247
+ select is(
248
+ (select count(*)::int from pg_tables
249
+ where schemaname = 'public' and rowsecurity = false),
250
+ 0,
251
+ 'All public tables have RLS enabled'
252
+ );
253
+
254
+ -- Verify anon role cannot read protected data
255
+ set role anon;
256
+ select is_empty(
257
+ 'select * from public.profiles',
258
+ 'anon role cannot read profiles without auth'
259
+ );
260
+ reset role;
261
+
262
+ -- Verify authenticated users can only see their own rows
263
+ set role authenticated;
264
+ select isnt_empty(
265
+ $$select * from pg_policies where tablename = 'profiles' and cmd = 'SELECT'$$,
266
+ 'profiles table has a SELECT policy for authenticated users'
267
+ );
268
+ reset role;
269
+
270
+ select * from finish();
271
+ rollback;
272
+ ```
273
+
274
+ Run locally with `npx supabase test db` before pushing.
275
+
276
+ ## Application Test Pattern
277
+
278
+ Use `createClient` from `@supabase/supabase-js` in tests, pointing at the local instance:
279
+
64
280
  ```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
- });
281
+ // tests/setup.ts
282
+ import { createClient } from '@supabase/supabase-js';
283
+ import type { Database } from '../src/types/database.types';
284
+
285
+ export const supabase = createClient<Database>(
286
+ process.env.SUPABASE_URL ?? 'http://127.0.0.1:54321',
287
+ process.env.SUPABASE_ANON_KEY ?? 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
288
+ );
289
+
290
+ // tests/profiles.test.ts
291
+ import { supabase } from './setup';
292
+
293
+ test('can insert and read a profile', async () => {
294
+ const { data, error } = await supabase
295
+ .from('profiles')
296
+ .insert({ id: 'test-user', display_name: 'Test' })
297
+ .select()
298
+ .single();
299
+
300
+ expect(error).toBeNull();
301
+ expect(data?.display_name).toBe('Test');
71
302
  });
72
303
  ```
73
304
 
74
305
  ## Output
75
- - Automated test pipeline
76
- - PR checks configured
77
- - Coverage reports uploaded
78
- - Release workflow ready
306
+
307
+ After implementing these workflows:
308
+
309
+ - Pull requests run tests against a fresh local Supabase instance with all migrations applied
310
+ - TypeScript type drift is detected automatically — stale types block the PR
311
+ - Database migrations deploy to production only on merge to main
312
+ - Edge Functions deploy alongside migration changes
313
+ - pgTAP tests validate RLS policies and schema constraints in CI
314
+ - Preview branches provide isolated environments for PR review (Pro plan)
315
+ - GitHub secrets keep `SUPABASE_ACCESS_TOKEN` and `SUPABASE_DB_PASSWORD` out of code
79
316
 
80
317
  ## Error Handling
81
- | Issue | Cause | Solution |
318
+
319
+ | Error | Cause | Solution |
82
320
  |-------|-------|----------|
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 |
321
+ | `supabase start` fails in CI | Docker not available | Use `ubuntu-latest` runner (includes Docker by default) |
322
+ | `supabase db push` returns "permission denied" | Invalid or expired access token | Regenerate token at supabase.com/dashboard/account/tokens |
323
+ | `supabase link` fails | Wrong project ref | Check project ref in Settings > General, must match `SUPABASE_PROJECT_REF` secret |
324
+ | Type drift detected in PR | Schema changed without regenerating types | Run `npx supabase gen types typescript --local > src/types/database.types.ts` |
325
+ | `supabase functions deploy` fails | Missing Deno types or syntax errors | Run `npx supabase functions serve` locally first to catch issues |
326
+ | pgTAP tests fail | Missing RLS policies or schema constraints | Add policies before merging — `npx supabase test db` runs locally |
327
+ | Preview branch creation fails | Free plan limitation | Preview branches require Supabase Pro plan |
328
+ | Migration conflict on push | Divergent migration history | Run `npx supabase db pull` to reconcile remote vs local migrations |
86
329
 
87
330
  ## Examples
88
331
 
89
- ### Release Workflow
90
- ```yaml
91
- on:
92
- push:
93
- tags: ['v*']
332
+ **Minimal CI for a new project** — just migration validation and type checking:
94
333
 
334
+ ```yaml
335
+ name: Supabase CI
336
+ on: [pull_request]
95
337
  jobs:
96
- release:
338
+ validate:
97
339
  runs-on: ubuntu-latest
98
- env:
99
- SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY_PROD }}
100
340
  steps:
101
341
  - 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
342
+ - uses: supabase/setup-cli@v1
343
+ with: { version: latest }
344
+ - run: npx supabase start -x realtime,storage-api,imgproxy,inbucket,edge-runtime
345
+ - run: npx supabase db reset
346
+ - run: npx supabase gen types typescript --local > /tmp/types.ts && diff src/types/database.types.ts /tmp/types.ts
347
+ - if: always()
348
+ run: npx supabase stop
110
349
  ```
111
350
 
112
- ### Branch Protection
113
- ```yaml
114
- required_status_checks:
115
- - "test"
116
- - "supabase-integration"
351
+ **Edge Function deploy with verification:**
352
+
353
+ ```bash
354
+ # Deploy a specific function and verify it's live
355
+ npx supabase functions deploy my-function --project-ref $PROJECT_REF
356
+ curl -s "https://$PROJECT_REF.supabase.co/functions/v1/my-function" \
357
+ -H "Authorization: Bearer $SUPABASE_ANON_KEY" | jq .
117
358
  ```
118
359
 
119
360
  ## Resources
120
- - [GitHub Actions Documentation](https://docs.github.com/en/actions)
121
- - [Supabase CI Guide](https://supabase.com/docs/ci)
361
+
362
+ - [Supabase CLI in CI/CD](https://supabase.com/docs/guides/local-development/cli/getting-started) — official setup guide
363
+ - Database Testing with pgTAP — writing and running database tests
364
+ - [Managing Environments](https://supabase.com/docs/guides/deployment/managing-environments) — staging, production, preview branches
365
+ - [Edge Functions Deployment](https://supabase.com/docs/guides/functions/deploy) — deploying Deno functions
366
+ - [Type Generation](https://supabase.com/docs/guides/api/rest/generating-types) — keeping TypeScript types in sync
367
+ - [Branching & Preview](https://supabase.com/docs/guides/deployment/branching) — per-PR database environments
368
+ - [@supabase/supabase-js Reference](https://supabase.com/docs/reference/javascript/introduction) — client SDK documentation
122
369
 
123
370
  ## Next Steps
124
- For deployment patterns, see `supabase-deploy-integration`.
371
+
372
+ For deploying Supabase-backed applications to hosting platforms, see `supabase-deploy-integration`. For configuring RLS policies, see `supabase-rls-policies`.
@@ -0,0 +1,10 @@
1
+ # Error Handling Reference
2
+
3
+ | Issue | Cause | Solution |
4
+ |-------|-------|----------|
5
+ | Secret not found | Missing configuration | Add secret via `gh secret set` |
6
+ | Tests timeout | Network issues | Increase timeout or mock |
7
+ | Auth failures | Invalid key | Check secret value |
8
+
9
+ ---
10
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,36 @@
1
+ ## Examples
2
+
3
+ ### Release Workflow
4
+
5
+ ```yaml
6
+ on:
7
+ push:
8
+ tags: ['v*']
9
+
10
+ jobs:
11
+ release:
12
+ runs-on: ubuntu-latest
13
+ env:
14
+ SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY_PROD }}
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '20'
20
+ - run: npm ci
21
+ - name: Verify Supabase production readiness
22
+ run: npm run test:integration
23
+ - run: npm run build
24
+ - run: npm publish
25
+ ```
26
+
27
+ ### Branch Protection
28
+
29
+ ```yaml
30
+ required_status_checks:
31
+ - "test"
32
+ - "supabase-integration"
33
+ ```
34
+
35
+ ---
36
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,54 @@
1
+ ## Implementation Guide
2
+
3
+ ### Step 1: Create GitHub Actions Workflow
4
+
5
+ Create `.github/workflows/supabase-integration.yml`:
6
+
7
+ ```yaml
8
+ name: Supabase Integration Tests
9
+
10
+ on:
11
+ push:
12
+ branches: [main]
13
+ pull_request:
14
+ branches: [main]
15
+
16
+ env:
17
+ SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ env:
23
+ SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: '20'
29
+ cache: 'npm'
30
+ - run: npm ci
31
+ - run: npm test -- --coverage
32
+ - run: npm run test:integration
33
+ ```
34
+
35
+ ### Step 2: Configure Secrets
36
+
37
+ ```bash
38
+ gh secret set SUPABASE_API_KEY --body "sk_test_***"
39
+ ```
40
+
41
+ ### Step 3: Add Integration Tests
42
+
43
+ ```typescript
44
+ describe('Supabase Integration', () => {
45
+ it.skipIf(!process.env.SUPABASE_API_KEY)('should connect', async () => {
46
+ const client = getSupabaseClient();
47
+ const result = await client.healthCheck();
48
+ expect(result.status).toBe('ok');
49
+ });
50
+ });
51
+ ```
52
+
53
+ ---
54
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*