WorkoutIndia started as a fitness tracking app. When a partnership with a major Indian health insurer sent 50,000 users to the platform in week 6, our architecture was put to the ultimate test.
The Unexpected Spike
Day 1 post-partnership announcement: 8,000 new signups in 6 hours. Our Supabase free tier was immediately overwhelmed. Here's what we did in real-time.
Emergency Response: Hour-by-Hour
Hour 1: Upgraded Supabase to Pro tier. Enabled connection pooling via pgBouncer. This alone reduced database connection errors by 90%.
Hour 3: Identified that the "home feed" query was doing a full table scan. Added a composite index:
CREATE INDEX CONCURRENTLY user_activities_user_date_idx
ON user_activities(user_id, created_at DESC);Query time dropped from 2,400ms to 18ms.
Hour 6: Enabled Next.js ISR for the leaderboard pages. What were server-rendered pages on every request became statically cached pages regenerated every 60 seconds.
The Week 2 Optimization Sprint
After surviving the spike, we conducted a full performance audit:
- N+1 Queries: Replaced 12 separate DB calls in the profile page with a single join query.
- Image Optimization: Migrated user avatar storage from Supabase free tier to Cloudflare R2 with a CDN. Page load time improved by 1.2 seconds.
- Redis Caching: Added upstash Redis for leaderboard data. Reduced DB load by 60%.
The Architecture at 50K Users
- Frontend: Next.js on Vercel Edge Network
- Database: Supabase Pro with pgBouncer (15 direct connections → 500 pooled)
- Cache: Upstash Redis for leaderboards and session data
- Storage: Cloudflare R2 for user media
Monthly infrastructure cost at 50K users: ~$320/month
Key takeaway: Supabase's connection pooler and PostgreSQL indexes solved 80% of scaling problems. Over-engineering upfront is almost never worth it.

