juanjo finishes ripping Supabase out of Mike's backend

After proving the pattern on a single slice, juanjo ported every remaining database call in the backend to a self-hosted setup.

infrastructure

This is the bulk phase of a larger move: getting Mike to a state where a developer can run the whole thing on their laptop without signing up for any third-party accounts. The original codebase leaned on Supabase, a hosted service that bundles a Postgres database with user authentication. juanjo's fork replaces that with a local Postgres instance and Drizzle, a lightweight library that lets the code talk to the database directly.

The interesting part is the scope. Every backend module that previously reached out to Supabase - projects, documents, chat, workflows, downloads, the tabular data views - now goes through the new pathway. Two follow-up fixes landed quickly after the main push, which is honest signal that a translation this broad will leak a few subtle bugs no matter how careful the team is.

So what Worth watching if you care about whether legal-AI tools can be self-hosted end-to-end without a vendor dependency for the data layer.

View this fork on GitHub →

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

Commits in this thread

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

SHA Subject Author Date
68d18876 feat(backend): replace Supabase auth.admin.listUsers with Drizzle helper Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cfc84fbf chore(backend): remove dead Supabase admin client from workflows.ts Juan Vidal 2026-05-08 ↗ GitHub
36c889ce feat(backend): migrate lib/access.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
a41622ab feat(backend): migrate lib/userSettings.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
3a5c8b6d feat(backend): migrate lib/documentVersions.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
d352d15c feat(backend): migrate lib/chatTools.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
ff63879b feat(backend): migrate downloads.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d2f30d55 feat(backend): migrate projectChat.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
318e5594 feat(backend): migrate chat.ts to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ed0cc463 fix(projectChat): guard outer catch against post-headers-sent SSE crash Juan Vidal 2026-05-08 ↗ GitHub
5e802ac6 feat(backend): migrate projects route to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
commit body
Replace all supabase-js calls in backend/src/routes/projects.ts with
Drizzle ORM equivalents, add projectToWire/docToWire/folderToWire helpers
for snake_case wire shape preservation, and wrap every async handler in
try/catch. Drop the redundant _db shim arg from all checkProjectAccess
call sites. The listAllUsers() usage from P2-1 is preserved intact.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3e8d1813 feat(backend): migrate documents route to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
commit body
Replace all 30 supabase-js calls in documents.ts with Drizzle ORM queries.
Drop _db shim args from lib calls; preserve snake_case wire shapes via
inline mappers; wrap all handlers in try/catch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b691f92c feat(backend): migrate workflows route to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
commit body
Replace all 18 supabase-js calls in workflows.ts with Drizzle ORM queries.
Add workflowToWire mapper for snake_case wire shape; drop _db shim args;
preserve listAllUsers() from P2-1; wrap all handlers in try/catch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7cf1e82e fix(backend): workflow list ordering + tighten Drizzle update types Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
022434f9 feat(backend): migrate tabular route to Drizzle Juan Vidal 2026-05-08 ↗ GitHub
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bdb80c46 fix(tabular): correct snake_case→camelCase mismatch in buildTabularContext Juan Vidal 2026-05-08 ↗ GitHub

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-185.md from inside the repo you want the changes in.

⬇ Download capture-thread-185.md