Skip to content

Migrate backend from Supabase to Neon and R2 - #20

Merged
nedcut merged 1 commit into
mainfrom
codex/neon-r2-migration
Jul 20, 2026
Merged

Migrate backend from Supabase to Neon and R2#20
nedcut merged 1 commit into
mainfrom
codex/neon-r2-migration

Conversation

@nedcut

@nedcut nedcut commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What changed

  • replaced the Supabase browser runtime with Neon Auth and the Neon Data API
  • recreated the application schema, functions, grants, and RLS policies in Neon
  • replaced Supabase Storage with authorized R2 presigned uploads and a public read-only Cloudflare Worker
  • migrated and verified all database rows and 656 media objects
  • replaced Supabase Realtime with visibility-aware polling
  • added migration, verification, rollback, and deployment documentation

Why

Supabase project pausing was making the application unavailable. Neon and Cloudflare R2 provide the required Postgres, authentication, API, and object-storage capabilities without that availability failure mode.

Production verification

  • Vercel production build and deployment succeeded after removing Supabase environment variables
  • Neon Auth, anonymous tokens, and all Neon Data API reads returned 200
  • R2 media rendered through the Cloudflare Worker with 200 responses
  • no Supabase production requests were observed
  • R2 copy verified exactly: 656 objects, 386,648,282 bytes

Local validation

  • npm run lint
  • npm run typecheck
  • npx tsc -p cloudflare/media-worker/tsconfig.json
  • npm run test — 241 tests passed
  • npm run build
  • git diff --check

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lofoten-map Ready Ready Preview, Comment Jul 20, 2026 4:56pm

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@nedcut, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0488b79d-a702-4f89-8c6d-bf9e2f65c5c6

📥 Commits

Reviewing files that changed from the base of the PR and between e090810 and 2fd0eed.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (50)
  • .env.example
  • .gitignore
  • .neon
  • README.md
  • app/api/storage/delete/route.ts
  • app/api/storage/presign/route.ts
  • app/layout.tsx
  • app/page.tsx
  • cloudflare/media-worker/src/index.ts
  • cloudflare/media-worker/tsconfig.json
  • cloudflare/media-worker/worker-configuration.d.ts
  • cloudflare/media-worker/wrangler.jsonc
  • docs/TODO.md
  • docs/WORKLOG.md
  • e2e/trip.spec.ts
  • eslint.config.mjs
  • lib/access.test.ts
  • lib/access.ts
  • lib/backend.test.ts
  • lib/backend.ts
  • lib/hooks/useMembership.ts
  • lib/hooks/useProfile.ts
  • lib/hooks/useTripAuth.ts
  • lib/hooks/useTripData.ts
  • lib/hooks/useTripMutations.ts
  • lib/invite-only-access.test.ts
  • lib/local-trip-store.ts
  • lib/object-store-server.ts
  • lib/object-store.test.ts
  • lib/object-store.ts
  • lib/photo-upload.test.ts
  • lib/photo-upload.ts
  • lib/realtime-patch.test.ts
  • lib/realtime-patch.ts
  • lib/supabase.test.ts
  • lib/supabase.ts
  • neon/README.md
  • neon/migration/01_prepare_staging.sql
  • neon/migration/02_apply_staging.sql
  • neon/migration/03_verify.sql
  • neon/migration/04_cleanup_staging.sql
  • neon/migration/export_from_supabase.sh
  • neon/migration/load_into_neon.sh
  • neon/schema.sql
  • package.json
  • playwright.config.ts
  • scripts/dedupe-photos.mjs
  • scripts/migrate-media-to-r2.mjs
  • scripts/purge-orphan-objects.mjs
  • tsconfig.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/neon-r2-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nedcut
nedcut marked this pull request as ready for review July 20, 2026 16:58
Copilot AI review requested due to automatic review settings July 20, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@nedcut
nedcut merged commit fc4da8e into main Jul 20, 2026
4 checks passed
@nedcut
nedcut deleted the codex/neon-r2-migration branch July 20, 2026 16:59
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.

2 participants