Repository navigation
SV2: the Supabase project from Terraform, the schema through db-migrate - #3
Merged
Merged
Conversation
infra/terraform/supabase is supabase-starter's root, renamed: one project per environment, waited on until it is healthy, its Auth pointed at the app's Worker (Site URL, redirect allow-list, email confirmation off until the project has SMTP of its own), and published to orun secrets after the apply: the project ref and database credentials (db-migrate's), WIRING_SUPABASE (the URL and anon key the app's build renders) and — new here, because upstream's server uses it for the contact form, Stripe customers and account deletion — the service-role key as SUPABASE_SERVICE_ROLE_KEY, which only that environment's deploy lane reads and hands the Worker as a secret. `terraform validate` passes. packages/db (@saas/db, the name the db-migrate composition builds) carries saas-starter's runner over the Management API and upstream's two supabase/migrations files, byte for byte, as 010_initial and 020_add_unsubscribed_to_profiles. infra/db-migrate applies them per environment, waiting (enforced on main) for the project's apply; apps/web now waits for both, so a merge plans supabase → db-migrate → web. tests/db runs the manifest, the checksums against upstream's files and the runner against PGlite with Supabase's roles, auth.users, auth.uid() and Storage stood in: every migration applied once and a second apply applying nothing; the three tables under row-level security; the trigger giving each new user a profile from their sign-up metadata; a user reading and writing only their own profile; the anon key and every API role seeing nothing of the two server-only tables; the avatars bucket and its policies. 10 tests. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds each environment's Supabase project (Terraform), the schema (upstream's two migrations, applied by db-migrate) and the tests for both.
infra/terraform/supabase: supabase-starter's root, renamed.WIRING_SUPABASE(the URL and anon key), which the app's build renders;SUPABASE_SERVICE_ROLE_KEY(new here).terraform validatepasses.packages/db(@saas/db, the name the db-migrate composition builds): saas-starter's runner over the Management API. It carries upstream's twosupabase/migrationsfiles, byte for byte, as010_initialand020_add_unsubscribed_to_profiles.infra/db-migrate: applies them per environment, waiting on main for the project's apply.apps/webnow waits for both, so a merge planssupabase → db-migrate → web, which a localorun planconfirms.tests/db: the manifest and its checksums, checked against upstream's files. The runner runs against PGlite with Supabase's roles,auth.users,auth.uid()and Storage stood in. The 10 tests cover:Locally: install, typecheck, lint, test and build are all green.
Generated by Claude Code