Supabase Postgres replaced with Aurora Serverless v2 via RDS Data API

dropthejase replaces Supabase with Aurora Serverless v2 across 41 commits, covering every backend route, the CDK stack, trigger Lambdas, and the frontend. The Data API brings specific ergonomic costs - type hints, numbered-param UUID casts, a retry-on-pause wrapper - that the fork has paid down across dozens of follow-up fixes. Adopting the same approach means inheriting the same long tail.

infrastructure

The CDK shape is straightforward: a DatabaseStack adds an Aurora Serverless v2 PostgreSQL 16 cluster (bumped to 17.9 later in 1b2f80d) with enableDataApi: true, isolated VPC subnets, and no VPC NAT gateways. The Lambda execution role gets rds-data:ExecuteStatement and related actions on the cluster ARN, plus secretsmanager:GetSecretValue for the cluster's auto-generated secret. A db.ts wrapper (d90454b) handles parameter building and result parsing uniformly across routes.

Route migration proceeds file by file across about fifteen commits. The pattern is the same in each: swap the Supabase client for execute() / queryOne() / query() calls, rewrite the SQL to named parameters with :paramName syntax, and handle the Aurora Data API's quirk of returning jsonb columns as raw strings (requiring JSON.parse on read). The shared_with and columns_config columns hit this issue in multiple places and required separate fix commits.

Two specific fixes are non-optional if you take this route. The auto-UUID-typeHint wrapper (2daea68) inspects parameter names and automatically applies typeHint: 'UUID' for anything named id, *Id, or *_id. Without it, Aurora throws uuid = text type errors that don't appear in development but fail in production. The auto-pause retry (f49ac20) wraps db.ts with exponential backoff for the BadRequestException: Communications link failure that Aurora Serverless throws on cold start when serverlessV2MinCapacity: 0. Both fixes arrived after the main migration - the initial commits didn't have them.

The projectChat.ts route and chat_messages table are deleted (b035d67, c195e91) because AgentCore's S3 conversation state replaces relational message storage. Importing this migration without that companion means you'll have dead schema and dead routes.

So what Worth a look if you're evaluating Aurora Serverless v2 with the RDS Data API as your database layer. The `db.ts` wrapper, the UUID typeHint fix, and the auto-pause retry are the three pieces you'd want to copy regardless of how much else you take. The migration commit list is also useful as a checklist of every surface area in the codebase that touches the database. Skip if you're staying on Supabase or using a different Postgres connection path - the Data API ergonomics are genuinely awkward compared to a direct connection.

View this fork on GitHub →

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

Commits in this thread

41 commits from dropthejase/louis, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
4592c835 Remove dead API key, credits, and model preference code Jason Lee 2026-05-08 ↗ GitHub
commit body
All LLM calls go through Bedrock IAM - no user API keys, no credits,
no tabular model stored per user. Removes UserApiKeys type, claude/gemini
key columns from userSettings, credits/tier/tabularModel fields from
UserProfileContext, and the ApiKeyMissingModal/modelAvailability shims
that were never reachable. TRChatPanel now holds model as local state.
ffc6152e docs: mark dead code cleanup items done in ORIGINAL-FUNCTIONALITY.md Jason Lee 2026-05-08 ↗ GitHub
89eded60 docs: update outstanding gaps - mark env vars, userSettings, UserProfileContext, tabular model done Jason Lee 2026-05-08 ↗ GitHub
ae54357d docs: update README for Aurora migration, Finch prerequisite, remove Supabase setup steps Jason Lee 2026-05-08 ↗ GitHub
44b12882 fix(scripts): enforce Finch, block if not installed Jason Lee 2026-05-08 ↗ GitHub
8de3aea2 feat(infra): add DatabaseStack with Aurora Serverless v2 Jason Lee 2026-05-08 ↗ GitHub
7588c924 feat(infra): wire DatabaseStack, remove Supabase from ApiStack Jason Lee 2026-05-08 ↗ GitHub
068cbca6 fix(infra): add VPC to DatabaseStack, remove stage conditionals and dead Supabase secret Jason Lee 2026-05-08 ↗ GitHub
f365807b feat(infra): migrate trigger Lambdas from Supabase to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
a3bef4d9 feat(scripts): add init-db.sh for Aurora schema initialisation Jason Lee 2026-05-08 ↗ GitHub
d90454be feat(backend): add RDS Data API db.ts wrapper Jason Lee 2026-05-08 ↗ GitHub
7c3cde2d feat(backend): delete Supabase client and HMAC download tokens, simplify secrets Jason Lee 2026-05-08 ↗ GitHub
c11febdd feat(backend): migrate access.ts to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
f5a68e5d feat(backend): migrate userSettings and documentVersions to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
7093f284 feat(backend): migrate user routes to RDS Data API, add GET/PUT /user/profile Jason Lee 2026-05-08 ↗ GitHub
c298a7a3 feat(backend): migrate downloads route, drop HMAC tokens, use S3 presigned URLs Jason Lee 2026-05-08 ↗ GitHub
6464a453 feat(backend): migrate projects routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
9b878c91 fix(backend): set owner email from JWT when requester is the owner in /people endpoint Jason Lee 2026-05-08 ↗ GitHub
be0685b9 feat(backend): migrate chat routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
ad50674c feat(backend): migrate projectChat routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
9eade3e7 feat(backend): migrate documents routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
bdcf4e98 feat(backend): migrate workflows routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
0927ef0d feat(backend): migrate tabular routes to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
7c6cb941 feat(db): add email column, structure_tree default, tabular_cells unique constraint Jason Lee 2026-05-08 ↗ GitHub
d7eb146a fix(backend): set userEmail to undefined not empty string when email claim absent Jason Lee 2026-05-08 ↗ GitHub
f0c8d8c9 fix(backend): store email in user_profiles, fix /people owner display, normalise shared_with emails Jason Lee 2026-05-08 ↗ GitHub
9919c64d fix(backend): use ON CONFLICT upserts for tabular_cells, remove select-then-insert pattern Jason Lee 2026-05-08 ↗ GitHub
7cbd1fa5 fix(backend): add shared_by_name email fallback in workflows Jason Lee 2026-05-08 ↗ GitHub
062b9405 feat(frontend): remove Supabase, rewrite UserProfileContext to use REST API Jason Lee 2026-05-08 ↗ GitHub
31b740d6 feat(backend): migrate chatTools.ts to RDS Data API Jason Lee 2026-05-08 ↗ GitHub
dca58634 docs: update README and migration notes to reflect Aurora migration complete Jason Lee 2026-05-08 ↗ GitHub
b035d679 Remove dead code: projectChat.ts and streaming route replaced by AgentCore Jason Lee 2026-05-08 ↗ GitHub
commit body
Deleted backend/src/routes/projectChat.ts entirely (POST /projects/:projectId/chat
streaming handler - frontend calls AgentCore directly). Removed its import and
app.use line from app.ts.

Removed the POST /chat/ streaming handler from chat.ts and its exclusive imports
(chatTools functions and checkCredits). Note: chatTools.ts is retained because
tabular.ts still actively uses runLLMStream, TABULAR_TOOLS, ChatMessage, and
TabularCellStore from it.
2daea687 fix(db): auto-apply typeHint UUID for id/*Id/*_id params in Aurora Data API wrapper Jason Lee 2026-05-11 ↗ GitHub
1b2f80df feat: migrate backend Lambda to ZIP, bump Aurora to Postgres 17.9 Jason Lee 2026-05-11 ↗ GitHub
c26a0b89 fix(schema): restore Aurora-compatible migration lost in backend→infra move Jason Lee 2026-05-11 ↗ GitHub
16fca3db fix(api): add ::uuid cast to all numbered SQL params to fix uuid = text errors Jason Lee 2026-05-12 ↗ GitHub
ab615de3 fix(api): add ::uuid cast to numbered params in documentVersions.ts Jason Lee 2026-05-12 ↗ GitHub
f49ac202 fix(agents): add Aurora auto-pause retry with backoff to agent db.ts Jason Lee 2026-05-13 ↗ GitHub
6c104ea9 fix(api,agents): ::uuid cast on project INSERT VALUES, fix replicate_document project_id + copies payload Jason Lee 2026-05-13 ↗ GitHub
e594c7ec fix(api): add ::jsonb cast to tabular chat user message INSERT Jason Lee 2026-05-14 ↗ GitHub
c195e91c chore(db): drop dead tables, remove chat_messages query Jason Lee 2026-05-15 ↗ GitHub
commit body
Dropped chat_messages and tabular_review_chat_messages from Aurora
(both empty; history lives in S3 snapshots). Removed dead
hydrateEditStatuses() function and chat_messages SELECT from
GET /chat/:chatId. Issue 26 documented in TEMP_TASKS for future
edit status hydration on S3 history load.

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

⬇ Download capture-thread-338.md