
Every side project that survives long enough becomes a tiny museum of every tech stack you ever loved. Here is how I rebuilt SocialDancer from scratch onto an MCP-first Cloudflare Edge stack with Gemini Neon, cut the codebase by ~90%, and kept every real user and shipped iPhone app working without a single password reset.
The 20-Second Version
I replaced a mature 403-file / 70k-line Django monolith with a clean-sheet 30-file TypeScript application on Cloudflare Workers, EU SQLite (D1), R2, and Vectorize in roughly one focused day using Gemini Neon. Existing accounts, calendar subscriptions, semantic vectors, and the already-shipped iOS App Store client kept running with zero cutover errors and zero forced password resets, while median edge compute dropped to ~4 ms and hosting fell to a flat $5/month.
403 -> 30 files
~4 ms Worker CPU
Sub-cent AI chat turns
iOS v1.1 unbroken
How a Dance Map Quietly Turned Into a 70,000-Line Monolith
SocialDancer started with a simple itch: finding social dances (Fox, Bugg, Salsa, West Coast Swing, and more) without digging through twenty scattered Facebook groups every Friday.
Like most real software that people actually use, it grew in layers. It began on classic cPanel shared hosting, a world I knew well from earlier work. When the project needed scheduled event crawlers, AI semantic search, and background processing, I containerized it with Docker and moved it onto a single cloud VM. Then came OAuth, 11 languages, iCal feeds, an MCP server for AI assistants, and a native SwiftUI iOS app.
By the end of Chapter 2, the core business domain was still wonderfully simple (events, venues, styles, calendars, users), yet every new idea meant wading through years of templates, framework glue, and a single VM trying to serve web traffic, crawlers, and vector math all at the same time.
The Big Idea: Protect Contracts and Data, Not Code
In the AI era, rewriting code is cheap. Breaking user passwords, shipped mobile apps, or real data is expensive. Protect the external contracts, and let the internals get radically simpler.
Instead of translating Django line-by-line or inventing microservices, we started from one strict rule: every existing client had to keep working unchanged, while everything behind the curtain shrank to one crisp domain layer.
Notice what is missing from that diagram: no separate API gateway wrapping an internal REST service, no container orchestration, and no heavy server-side session machinery for chat. Browsing the map, checking your calendar, and bookmarking dances cost zero LLM tokens. AI only wakes up when you actually ask the Dance Agent a question, speak into the mic, or drop in a dance flyer photo.
Before vs. After: Real Numbers
Rather than relying on benchmarks from a blog post, we measured real production traffic and codebase counts before and after cutover.
| Metric | Before (Django VM) | After (Edge TypeScript) |
|---|---|---|
| Production files | 403 files | 30 files (-93%) |
| Application code | ~70k lines (+63k i18n) | ~12.8k lines (~14.5k incl. 11 languages) |
| Edge compute & DB latency | Single-region VM | ~4 ms Worker CPU · ~0.3 ms SQLite read |
| Cold startup | Container boot + migrations | ~50 to 75 ms |
| Contract test feedback loop | 251 files · slow full suite | 5 files · real SQLite in ~0.6 seconds |
| Monthly hosting | ~$12 to $15 / mo | $5 / mo flat (shared across apps) |
| User & data continuity | Thousands of events & vectors | 100% lossless · 0 password resets · 0 errors |
What Almost Tripped Us Up (Real Trade-Offs)
Any migration story that claims “everything worked cleanly on the first try” is leaving out the best parts. Four real engineering calls made the difference between a shiny demo and a calm production system:
1. Avoiding the Stateful-Chat Billing Trap
It is tempting to give every chat user a stateful cloud actor. When we modeled actual account billing, keeping chat stateless on the edge and storing pruned history locally in the browser gave us fast streaming and focused context windows without any surprise duration bills.
2. Keeping Shipped Mobile Clients Happy
The hardest constraint was not the new web UI; it was making sure the iPhone app already sitting on people's phones worked on day one without an App Store release. Verifying real password hashes in WebCrypto and rehearsing on a physical iPhone caught subtle edge cases early.
3. Post-Launch Hardening & Cost Brakes
Shipping fast means you must audit twice as carefully. Right after cutover we ran a focused security and cost pass: edge caching public reads, validating uploaded image contents rather than trusting headers, tightening privacy boundaries, adding observability, and turning on hard monthly spend caps.
4. The Unsexy 10% of AI UX
Users notice polish immediately: stripping emojis before browser text-to-speech, preferring natural neural voices per language, programmatically replacing awkward LLM em dashes mid-stream, and fixing classic iOS Safari focus-zoom and safe-area quirks.
Optional Technical Deep Dives
Keeping the main story light on purpose. Open any box below for the engineering decisions underneath.
How we migrated real users with zero forced password resets
Legacy accounts used standard Django PBKDF2-SHA256 hashes with varied iteration counts. Before writing any UI, we benchmarked WebCrypto verification inside the edge runtime against real hash shapes to confirm acceptable CPU budgets and constant-time comparison. Users signed in after cutover without noticing the backend had switched languages and clouds underneath them.
Why we run real-SQLite contract tests instead of mocks
Mocking database queries is the fastest way to ship broken SQL and subtle privacy bugs. Instead, our contract suite runs Vitest directly against Node's built-in SQLite engine behind a lightweight adapter, exercising real queries for authentication, visibility isolation, calendar invariants, MCP authorization tiers, and streaming text transforms in roughly 600 milliseconds.
Zero-downtime cutover & keeping a cold rollback hold
We never gamble on a one-shot cutover. First came a local proof against a real snapshot; next came an isolated preview stack tested end-to-end; then a verified online database backup and lossless EU import before flipping traffic. The previous VM stayed stopped cold for a 48 to 72 hour rollback window so a single switch could revert if anything looked off.
Security & privacy principles (without handing out a blueprint)
Public edge apps that expose AI endpoints need layered defense: strict request and image validation before model calls, server-enforced authorization on every read and mutation (never trusting client state), EU data residency for user records, edge caching for anonymous discovery traffic, anonymous handling of private personal events, and independent billing circuit breakers.
What It Really Takes to Build This Fast With Gemini Neon
Rebuilding a multi-client production system in a day is not magic, and it is definitely not blind “vibe coding.” Gemini Neon compressed weeks of mechanical implementation, migration scripting, 11-language localization, and test writing into hours, but the speed only held up because of three human habits:
- Write the business rules down first: Clear invariants beat vague prompts every single time.
- Measure real systems, not assumptions: Real snapshots, real latency numbers, and real device testing keep fast iteration honest.
- Keep feedback loops under a second: Sub-second contract tests and 15-second edge deploys let you review, harden, and polish without losing momentum.
That combination, grounded systems architecture paired with AI-native speed, is the kind of engineering I love building and enjoy bringing to an ambitious product team.