Download plan: bring everything from Lovable into D:\work\pitch25
Outcome: a complete, verifiable local copy of the Pitch 25 project - source code, database schema and data, users, storage, brand assets, screen captures and the build history - organized under lovable-export\ so the AWS rebuild never has to reach back into Lovable. Estimated hands-on time: about half a day, most of it waiting on exports and your two approvals.
Principles
Target folder layout
What Lovable exposes, and how each thing comes out
| Asset | Where it lives in Lovable | Export route | Notes |
|---|---|---|---|
| Source code (167 files incl. 20 migrations, edge function, .env, bun.lock) | Editor (Code view); Settings > Git | Settings > Git > Download codebase (ZIP) and/or GitHub two-way sync (creates a new private repo; importing an existing repo is not supported) | Export the editor state (latest), not the published bundle. Foundry needs the GitHub clone URL. |
| Database schema | supabase/migrations in the code; live DB in Lovable Cloud | Migrations come with the code; live snapshot via the Cloud SQL editor (information_schema, pg_policies, pg_proc, pg_trigger, pg_enum) | Diff live vs migrations to catch direct edits made inside Lovable Cloud. |
| Data (37 tables) | Lovable Cloud Postgres, protected by RLS | tools/export-lovable-data.mjs: supabase-js + publishable key + admin sign-in, 1,000-row pages per table to JSON; counts before/after; SQL editor for any table admins cannot fully read | No service-role key needed. Last resort: a temporary admin-only export edge function added through Lovable (costs credits, edits the project). |
| Auth users | Supabase Auth (auth.users) via Lovable Cloud > Users | User list (id, email, created, last sign-in, metadata) via the Users panel or SQL editor; joined with user_roles / user_location_roles / employees | Password hashes cannot be exported. Carry-over options are decision D4. |
| Storage | Bucket certifications (private) | List storage.objects; download via signed URLs from the admin session | Expected empty (no upload UI shipped). Verify. |
| Edge function admin-create-user | supabase/functions in the code | Comes with the code; Lovable Cloud secrets (if any) are listed in Cloud > Secrets | No third-party secrets exist yet (no Stripe / Toast keys). |
| Design (tokens, fonts, images, logo) | src/index.css, tailwind.config.ts, src/assets, Google Fonts | Comes with the code; tokens documented; fonts downloaded for self-hosting; optional read-only crawl of pitch25.com for original brand sources | Captured tokens already on the Comps & design page. |
| Screens | Preview / published app | Browser screenshots: 14 public captures done; signed-in screens after you log in once | Reference for parity testing after the rebuild. |
| Build history (chat, plans, decisions) | Lovable chat + View history | Transcript captured (113 messages); version titles list | Per-edit diffs are not exportable; the code export is the final state. |
| Published site | puck-and-pint.lovable.app | Optional wget mirror | Low value (SPA shell); skipped unless wanted. |
Phases and tasks
Risks and how they are handled
RLS hides rows from the export
Some employee / timesheet tables are scoped to location managers; the admin account should still pass the is_admin() policies, but every table is reconciled against the SQL-editor row count and any shortfall is pulled through the SQL editor instead.
Live schema differs from the migrations
Lovable applied a few fixes directly ("Changed data", availability RLS fix). The live snapshot is diffed against the migrations and any drift becomes an extra migration file before Foundry runs.
Unpublished work
The editor is ahead of the published site. Both the ZIP and the GitHub sync export the editor state, so nothing is lost; the published bundle is ignored.
Credentials
The exported .env holds only the publishable key and project URL (safe in a private repo, never in a public one). The admin password is typed by you at runtime and not stored.