A single-tenant tutoring tool buckling at 5K learners, rebuilt into a multi-tenant LMS that streams video to 50K with three nines of uptime. Same product, 10x the load, zero late-night pager wars.
The original platform was a single-database tutoring app, every new organization meant a fork and a fresh deploy. We collapsed that into one multi-tenant runtime using schema-per-tenant Postgres, so each org gets isolated data with shared infrastructure underneath.
Tenant resolution moved to edge middleware: the hostname picks the schema and stamps org context onto every request, so application code never has to think about which tenant it's serving.
At 50K learners the bottleneck wasn't features, it was the same three reads (session, entitlement, progress) hammering Postgres on every page. We put Redis in front of all of them, dropping p95 auth latency to 15ms and shielding the database during peak class hours.
Video was offloaded entirely to Mux. Signed HLS tokens handle access control and adaptive bitrate handles flaky networks, which is what actually moved completion rates: learners stopped dropping off when the stream stopped buffering.
| Component | Technology | Why |
|---|---|---|
| Tenant isolation | Postgres schema-per-tenant | Hard data boundaries without N databases to operate. |
| Session & cache | Redis | Sub-ms reads for auth, entitlements and progress. |
| Video delivery | Mux + signed HLS | Adaptive streaming and DRM-style tokens without an encoding pipeline. |
| App & rendering | Next.js (SSR + edge) | Fast first paint and tenant routing at the edge. |
| Infra & scale | AWS (ECS, RDS, SQS) | Multi-AZ autoscaling and durable event ingest. |
| Event processing |
Each organization gets its own Postgres schema, enforcing hard data boundaries on shared infrastructure.
Hostname-based middleware resolves the tenant and pins context before any handler executes.
Sessions and entitlements resolve from cache, keeping p95 authentication under 15ms at peak.
Signed-token HLS delivers per-tenant watermarked video with bandwidth-aware quality switching.
View and quiz events flow through SQS and batch into Postgres, absorbing spikes without write amplification.
A background worker recomputes mastery and warms cache so learners resume exactly where they left off.
“We didn't add servers to hit 50K, we stopped asking Postgres the same question 50,000 times.”
The rebuild took a 5K-learner single-tenant app to a 50K-learner multi-tenant platform without growing the ops team. Schema-per-tenant Postgres gave clean isolation, Redis flattened the read storm, and Mux turned video from the biggest liability into the feature that lifted completion 40%. The result is a system that holds 99.9% uptime under classroom-hour spikes and onboards a new organization in minutes instead of a deploy.
| SQS + workers |
| Batched writes that survive traffic spikes. |