Design spec and implementation plans for the Supabase exit

juanjo wrote three planning documents - a design spec and two phased implementation plans - before writing any migration code. The plans are detailed enough to serve as checklists if you're doing a similar Supabase removal.

infrastructuresecurity

The design spec (2026-05-08-local-postgres-design.md, 201 lines) states the goal - Mike fully offline against a Docker Postgres, no Supabase anywhere, same code path in dev and prod - and makes the architectural choices specific: Auth.js v5 Credentials provider with JWT session strategy, Express reading the same cookie via next-auth/jwt's decode() using a shared AUTH_SECRET, Drizzle as the single schema source of truth. It lists exactly which Supabase tables, triggers, functions, and RLS policies get dropped.

Plan 1 (2026-05-08-local-postgres-foundation.md, 1075 lines) sequences the foundation into numbered tasks with step-by-step commands and expected output. The vertical-slice approach is explicit: migrate exactly one route (/user/*) end-to-end to prove the new stack works, leave everything else broken at runtime until Plan 2. That's a deliberate risk-management choice, and the plan flags the broken-state period honestly.

Plan 2 (2026-05-08-local-postgres-migration.md, 536 lines) is the most directly reusable document. It includes a translation table for every PostgREST call pattern to its Drizzle equivalent - .single(), .upsert(), .contains(), .or(), .rpc() all get explicit mappings. The error-handling section explains why Drizzle's throw-on-error behaviour requires adding try/catch everywhere supabase-js's { data, error } pattern previously handled errors silently. A deferred note calls out that 500 responses currently forward raw err.message, which leaks Postgres constraint names.

None of these files contain runnable code. Their value is methodology: the foundation-first then vertical-slice then mechanical-sweep then uninstall sequencing, and the translation reference for the PostgREST-to-Drizzle mapping problem.

So what Worth reading if you're planning a similar Supabase removal. The Plan 2 PostgREST-to-Drizzle translation table is the most reusable page. Skip if you're looking for code to import directly.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from juanjo/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
82854596 Add spec: replace Supabase with local Postgres + Auth.js + Drizzle Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bd2b9451 Add Plan 1: local-Postgres foundation (Postgres + Drizzle + Auth.js + vertical slice) Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2aecb8dd Add Plan 2: mechanical migration of remaining Supabase call sites Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-180.md from inside the repo you want the changes in.

⬇ Download capture-thread-180.md