What Actually Happens When Your MVP Goes Viral (And How to Not Die)
You post your app on Reddit. Or Product Hunt. Or someone with 200k followers tweets about it. For about four hours, everything is fine. Then your hosting dashboard starts looking like a heart rate monitor and your inbox fills up with “is the site down?” messages.
This is the dream scenario that kills more MVPs than bad ideas do. Not because the product wasn’t good enough, but because the infrastructure wasn’t ready for the moment it worked.
The First Thing That Dies: Your Database
Not your server. Not your CDN. Your database.
Web servers are stateless and easy to scale horizontally. Databases are not. When 500 people hit your app simultaneously and each request fires 15 queries, you’ve just asked your database to handle 7,500 queries at once. Most MVPs are built with a single shared database connection, no connection pooling, and no query optimization because none of that mattered when 10 people were using it.
We had a client whose SaaS hit the front page of Hacker News. Within 20 minutes, their Supabase project was throwing “too many connections” errors. Their app was making a separate database call for every row in a list component, so a page with 50 items was doing 51 queries. It worked fine during testing. With 300 concurrent users, it brought everything down.
The fix isn’t complicated once you know what you’re looking for. Add connection pooling (PgBouncer if you’re on Postgres, it’s built into Supabase), audit your queries for N+1 patterns, and add database indexes on any column you’re filtering or sorting by. These aren’t advanced techniques. They’re just things that don’t matter until they suddenly do.
Caching: The Thing Everyone Skips
Most Lovable apps have zero caching. Every request hits the database fresh, every time. That’s fine for an internal tool or a beta with 50 users. It’s a disaster when traffic spikes.
The quick win is edge caching for anything that doesn’t change per user. If you’re on Cloudflare (and you should be), you can cache entire API responses at the edge with a single header. Static pages, public listings, blog content, marketing copy. None of it needs a database round-trip for every visitor.
For dynamic, user-specific data, Redis is the standard answer. Upstash gives you serverless Redis with a generous free tier and it takes maybe an hour to wire into an existing app. Cache the expensive queries. Cache session data. Cache anything that gets read far more often than it gets written.
The instinct is to add caching after things break. Add it before. The cost is low and the payoff is enormous.
Your API Has No Rate Limiting
This one is less about scaling and more about survival. When your app goes viral, you also attract bots, scrapers, and the occasional person who decides to hammer your endpoints just to see what happens.
With no rate limiting, one bad actor can saturate your server while real users get nothing. Cloudflare Workers and most API frameworks have rate limiting middleware you can add in under 30 minutes. Do it. Cap unauthenticated requests to something reasonable, like 60 per minute per IP, and add stricter limits on anything expensive like AI calls or email sends.
If you’re using a third-party API with per-call pricing, rate limiting isn’t optional. We’ve seen founders wake up to $800 in unexpected OpenAI charges because a scraper found an unprotected endpoint and hammered it overnight.
Serverless Cold Starts at Scale
Serverless platforms like Cloudflare Workers, Vercel, or AWS Lambda are popular for MVPs because they’re cheap and easy to deploy. They’re also great for handling traffic spikes because they scale automatically.
The catch is cold starts. When a function hasn’t been invoked recently, the first request takes longer while the runtime spins up. Under normal traffic this is barely noticeable. Under a surge, you can end up with hundreds of concurrent cold starts all fighting for resources at the same time, which creates a queuing effect that makes your app feel slow or unresponsive exactly when it matters most.
The mitigations depend on your platform. On Cloudflare Workers, cold starts are measured in milliseconds and rarely cause problems. On Lambda, consider provisioned concurrency for your critical paths. On Vercel, the paid plans reduce cold start frequency significantly. Know your platform’s behavior before the spike, not after.
What to Actually Do Before You Launch
This isn’t a comprehensive production checklist. It’s the four things that matter most when traffic spikes suddenly:
- Set up monitoring first. Throw Sentry on it. It takes 10 minutes and you need to know the moment something breaks. Add uptime monitoring too. Better Uptime or UptimeRobot, both have free tiers. You want to know your app is down before your users tell you.
- Load test before you launch. Use k6 or Artillery to simulate 200-500 concurrent users hitting your critical paths. You’ll find the bottlenecks in a controlled environment instead of during your Product Hunt launch.
- Check your database query count. Most frameworks have a way to log queries in development. Turn it on and look at your busiest pages. If a single page load is firing more than 10 queries, that’s a problem worth fixing now.
- Set spending alerts on everything. Every cloud service you use should have a budget alert configured. This takes five minutes and can save you thousands.
The Mindset Shift
Building an MVP is about speed. Getting to production at scale is about resilience. These are genuinely different disciplines and most Lovable apps are built entirely in the first mode.
That’s not a criticism. Speed is correct when you’re validating an idea. But there’s a point, usually right before you start acquiring real users, where you need to shift gears. The features can wait. Spend a week on the boring infrastructure work. Set up error tracking, fix your worst queries, add caching to your most-hit endpoints, put rate limits on your API.
The founders who do this are the ones who get to enjoy going viral. The ones who don’t spend that week putting out fires instead of capitalizing on the moment.
If you’re at that inflection point and not sure where to start, we can help you get there. We’ve done this for enough Lovable apps that we have a pretty good sense of what breaks first.