Use Case #6: Mock to Production Database
How Claude replaced all mock data with a real Supabase backend, complete with RLS policies, seed data, and Edge Functions.
William Welsh
Author
Use Case #6: Mock to Production Database
We had a beautiful frontend. Every component polished. Every interaction smooth.
One problem: it was all fake. Mock data everywhere. MOCK_PATIENTS, MOCK_CLAIMS, MOCK_APPOINTMENTS. Demo-ready, production-useless.
The Challenge
This was a medical practice management app. Moving to production meant: real patient records (with HIPAA considerations), insurance claim processing, appointment scheduling, AI-powered SOAP notes, and treatment cost estimation.
All of that was mocked. Every. Single. Feature.
The Session
"Replace all mock data with real Supabase backend. Create tables, RLS policies, seed data, and wire up the services."
What Claude Built
Database Schema (20+ tables) - Core tables: patients, providers, appointments, encounters. Clinical tables: soap_notes, diagnoses, procedures, medications. Insurance tables: claims, claim_items, insurance_plans, authorizations. Scheduling: appointment_slots, availability_rules, waitlist.
Row Level Security - Every table got proper RLS. Patients only visible to their provider. Claims require authentication. Proper security throughout.
Seed Data - Realistic test data: 50 patients with varied demographics, 200 historical appointments, insurance plans from major carriers, procedure codes with accurate pricing.
Edge Functions - AI-powered features needed serverless functions: generate-soap-note (AI clinical documentation), estimate-treatment (cost prediction), scrub-claim (pre-submission claim validation).
Service Layer - Every mock was replaced with real API calls using Supabase client.
The TypeScript Marathon
After the backend was ready, the build failed. 15+ files with type errors. The mock data used different conventions: PascalCase vs camelCase, numeric IDs vs UUIDs, inline objects vs references.
Claude fixed every mismatch. Renamed properties, updated type definitions, created mapper functions where needed.
Time Comparison
| Task | Estimate | Actual |
|---|---|---|
| Schema design | 8 hours | 45 min |
| RLS policies | 4 hours | 20 min |
| Seed data | 2 hours | 15 min |
| Edge functions | 6 hours | 35 min |
| Service layer | 8 hours | 40 min |
| Type fixes | 4 hours | 30 min |
| Total | 32 hours | 3 hours |
Try It Yourself
Copy this to convert your mock data to a real database:
I need to replace mock data with a real database backend. Let me describe the current state:
**Current Setup:**
1. What framework is your frontend? (React / Next.js / Vue / other)
2. Where are mock files located? (path pattern like "src/mocks/*" or "I'll find them")
3. What database do you want? (Supabase / PostgreSQL / MySQL / other)
**Requirements:**
4. Do you need Row Level Security? (yes / no / not sure)
5. Should I generate seed data for testing? (yes / no)
6. Any serverless functions needed? (describe or "none")
I will:
- Find all mock data in your codebase
- Design appropriate database schema
- Create tables with proper relationships
- Add RLS policies if using Supabase
- Generate realistic seed data
- Replace mock imports with real API calls
- Fix any type mismatches
- Test the full data flow
Ready? Answer above or point me to your mock files.
The EDF-Pro app backend migration, January 2, 2026.
William Welsh
Building AI-powered systems and sharing what I learn along the way. Founder at Tech Integration Labs.
Related Articles
View all →Use Case #14: RLS Policy Debugging
The query was correct. The data existed. But Supabase returned nothing. Claude traced it to a recursive RLS policy that created an infinite loop.
Use Case #15: Multi-Agent Schema Discovery
The database had 200+ tables. No documentation. No ERD. Claude spawned 5 parallel agents to map relationships, infer purposes, and generate complete documentation.
Use Case #21: Cloudinary Escape
Cloudinary bills were killing us. Claude migrated 50,000 images to Supabase Storage, rewrote all URLs, and maintained backward compatibility for cached references.