Skip to content

Local Supabase development (test env instead of prod) - #291

Open
plusmobileapps wants to merge 4 commits into
mainfrom
claude/dazzling-volhard-ffdb53
Open

Local Supabase development (test env instead of prod)#291
plusmobileapps wants to merge 4 commits into
mainfrom
claude/dazzling-volhard-ffdb53

Conversation

@plusmobileapps

@plusmobileapps plusmobileapps commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

What

Enables developing ChefMate against a local Supabase stack (Docker) instead of testing against the production project, and documents the workflow. The client already had a TESTING environment baked in — this adds the backend config and the bits needed to point TESTING at a local stack.

Changes

chore(supabase) — CLI config

  • supabase init output committed: supabase/config.toml (project_id = "chef-mate", anonymous sign-ins enabled, email confirmations off, seed wired) + supabase/.gitignore.
  • supabase/seed.sql (local-only, never pushed): recreates the recipe-photos / avatars buckets + RLS policies and seeds two confirmed test users (alice@chefmate.test, bob@chefmate.test, pw password123) for the Developer Settings "Login as test user" flow.

chore(supabase) — squashed migrations

  • The prod schema was built largely by hand, so the base tables (recipes, profiles, grocery, meal_plans) never had migration files, and three migrations shared the version 20260610. Replaying the incrementals against a fresh DB can't work (ordering + duplicate-version collision). Moved the 9 incrementals to supabase/archived_migrations/ (history-only, never applied/pushed); supabase/migrations/ is left empty for a squashed baseline a dev generates once via supabase db dump.

feat(android) — emulator connectivity

  • Debug-only network_security_config.xml + manifest overlay permitting cleartext HTTP to 10.0.2.2 / localhost. Release builds keep Android's default (cleartext blocked).

docs

  • docs/supabase-local-development.md: prereqs, the one-time supabase db dump baseline, starting the stack, local.properties wiring, per-platform networking, edge functions, troubleshooting, hosted-staging alternative, and a prod history-reconciliation appendix (migration repair).
  • Cross-links from README, buildconfig-setup.md, developer-settings.md.

⚠️ Reviewer note: squashed baseline

Prod's schema was built by hand via the dashboard, so there was never a migration for the base tables. Rather than ship broken incrementals, the guide has each dev snapshot prod once with supabase db dump --linked --schema public -f supabase/migrations/<ts>_baseline.sql (read-only). The original incrementals are preserved under supabase/archived_migrations/ for history.

Testing

Not yet exercised against a live stack — supabase db dump / start / db reset and an Android debug build were not run here (image pull is heavy; the dump needs prod credentials). The seed SQL and debug manifest merge are standard patterns but unverified end-to-end; the first supabase db reset is the real test.

🤖 Generated with Claude Code

plusmobileapps and others added 4 commits June 11, 2026 22:31
Run `supabase init` and commit the local stack config so the existing TESTING
environment can point at a local Supabase backend instead of prod.

- config.toml: project_id "chef-mate", enable anonymous sign-ins (the app
  bootstraps an anon session on start), disable email confirmations, wire
  seed.sql.
- seed.sql (local-only, never pushed): recreate the recipe-photos/avatars
  buckets + RLS policies (mirroring docs/supabase-*-setup.sql) and seed two
  confirmed test users for the Developer Settings "Login as test user" flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a debug-only network security config permitting cleartext HTTP to the local
Supabase stack (10.0.2.2 from the emulator, localhost) so Android debug builds
can reach it during development. Release builds keep Android's default
(cleartext blocked).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document developing against a local Supabase stack instead of prod: prereqs,
the one-time `supabase db pull` baseline (prod's base tables have no migration),
starting the stack, wiring supabase.testing.* in local.properties, per-platform
networking (localhost vs 10.0.2.2), edge functions, troubleshooting, a hosted
staging alternative, and an appendix on reconciling prod's migration history for
future CLI pushes. Cross-link from README, buildconfig-setup, and
developer-settings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The prod schema was built largely by hand, so the base tables (recipes, profiles,
grocery, meal_plans) never had migration files and three migrations shared the
version 20260610 — replaying the incrementals against a fresh DB can't work
(ordering + duplicate-version collision in the history table).

Move the 9 incrementals to supabase/archived_migrations/ (history-only, never
applied or pushed) and leave supabase/migrations/ empty for a squashed baseline.
Developers generate the baseline once with `supabase db dump` (read-only) — see
the updated guide. Update docs to use db dump instead of db pull and reduce prod
reconciliation to a single `migration repair`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant