Migrating web app from a single-table key-value store to a normalized relational schema on Supabase Postgres

Job ID: 40256956

Budget: $750 – $1,500 USD

# Migrating a production application from a single-table key-value store to a normalized relational schema on Supabase Postgres. This migration replaces that flat KV layer with ~15–20 purpose-built tables, proper indexing, and Row-Level Security — all without downtime.

# The frontend component layer stays untouched. This is a data layer project: schema design, API endpoints, and the persistence plumbing underneath the UI.

# What You'll Build—The migration runs in four phases:
- Phase 1 — Parallel Infrastructure
Create the new relational tables alongside the existing KV table. Implement a dual-write layer so every write goes to both stores simultaneously. Run a one-time backfill script to hydrate the new tables from existing KV data.
- Phase 2 — Read Cutover
Switch API read paths to the relational tables one route at a time, with a server-side toggle for instant rollback if anything looks wrong.
- Phase 3 — Granular Writes (highest complexity)
Replace the monolithic save endpoint with fine-grained mutation endpoints (create, update, delete per record). Update the frontend data layer — specifically the Zustand store and data-fetching hooks — to use optimistic per-record persistence instead of periodic full-blob syncs. This is where the bulk of the risk lives.
- Phase 4 — Cleanup
Remove dual-write code, enforce RLS policies, and tear down the migrated KV records.

# Scope of the Relational Schema—The new schema decomposes the monolithic workspace blob into discrete tables covering:
- Individual records and hierarchical relationships
- Department/group configurations
- Multi-page layout structures
- Collaboration threads and shared data
- Authentication metadata and device trust
- Usage analytics and feature flags with audit trails
- A sharing system with sign

# You're a Good Fit If You Have
- Strong PostgreSQL schema design experience (normalization, indexing strategies, foreign keys)
- Hands-on familiarity with the Supabase platform — Auth, Storage, Edge Functions, and CLI-based migrations
- Comfort working in a TypeScript/Deno backend
- Experience with React state management, particularly Zustand or similar stores
- A track record of zero-downtime migrations or blue/green data layer transitions
- Effective and efficient execution

# Nice to Have
- Experience migrating from document/KV stores to relational databases
- Familiarity with optimistic UI patterns and per-record persistence strategies

# What I will Provide
- Technical spec for
- Existing codebase access with documented API routes
- Schema design document for the target ~15–20 table structure

# Questions to Professional:
1. Have you migrated a production database from a document or key-value store to a normalized relational schema?
2. Have you implemented a dual-write layer to keep two data stores in sync during a live migration?
3. Have you written and tested Row-Level Security policies in Supabase?
4. Have you refactored a frontend from full-state blob syncs to per-record optimistic mutations?
5. Have you delivered a similar in scope project?