The Constraint That Forced Clarity
ProTeach Home Learning had a hard deadline: launch before the spring homeschool season. That meant roughly six working days from the first git init to a live, paying product. No time for bikeshedding architecture, no time for half-done features. Every decision had to be right the first time.
Constraints are a gift. When you can't iterate on architecture, you think harder up front. When you can't afford bugs, you write tests. When you have one week, you cut scope ruthlessly and ship the 20% that delivers 80% of the value.
Architecture First, Code Second
Before writing a single line of application code, I spent half a day on the data model. Firestore collections, auth flows, Stripe webhook states, AI session management — all mapped in a single architecture doc. This saved me from the most expensive mistake in software: discovering you need to restructure your database at scale.
The stack: Next.js 15 App Router for the frontend (RSC + client components where needed), Firebase Auth with Google/Apple/Microsoft OAuth,Firestore as the primary database, Stripe for weekly subscriptions, Google Gemini 2.0 Flash for AI (server-side only),Resend for transactional email, and Cloudinary for media.
The 17-Game Engine
The core product differentiator was an interactive game engine: 17 games across every subject and grade level (K–12), all built from scratch in TypeScript. No third-party game engines. No shortcuts. Each game has a complete state machine, adaptive difficulty, real-time scoring, and Firestore persistence.
The game engine alone is 24,085 lines of TypeScript — nearly 18% of the codebase. Building it in 3 days (days 2–4) was only possible because of heavy component reuse and a rigorous shared type system. Every game shares the same GameSession,Progress, and Achievement interfaces.
AI-Native, Not AI-Bolted-On
The AI engine (14,739 lines) powers lesson generation, progress analysis, and personalized learning plans. It runs entirely server-side — API keys never touch the client bundle. Responses stream to the UI via Server-Sent Events, giving users instant feedback even on complex 30-second generation tasks.
The most important architectural decision: multi-LLM routing. Gemini Flash for speed (lesson summaries, quick analysis), with fallback to longer context models for deep curriculum planning. A failure in one model doesn't cascade to the user.
The Numbers
By day 6, the codebase had grown to:
- 138,236 lines of TypeScript/TSX
- 202 components across 34 app pages
- 53 API routes
- 17 production games
- 470+ git commits
Estimated replacement cost: $950K–$1.5M based on detailed component costing at senior engineering rates. That's 6 days vs. the 18 months a normal agency would quote.
What Made It Possible
Three things made this possible: deep focus (no meetings, no context switching), a consistent architecture pattern (same component structure throughout), and AI-assisted development used correctly — for boilerplate and repetitive patterns, not for architecture or business logic.
The lesson: velocity is a skill, not a circumstance. It compounds with every project. The more production systems you've shipped, the faster you can ship the next one.