It worked for five users and fell over at five hundred
Slow pages, double bookings and timeouts show up when real traffic arrives. These are the usual causes in AI-built apps and the checks that find them early.
3 min readvibe coding issues, performance, database, scaling
You tested with a few friends and it was snappy. You launched, a post took off, and suddenly pages take ten seconds, bookings overlap, and some people see errors that you cannot reproduce.
Nothing changed in the code. The number of people changed.
What it looks like in your app
- Lists and dashboards that were quick now take seconds, and get slower every week.
- Two customers book the same slot, or buy the last item at the same moment.
- Errors that come and go, often at busy times.
- A hosting bill that grows faster than your users.
Why vibe-coded apps end up here
AI tools write code that works for the example in front of them. Three patterns hurt as data grows.
Too many small questions. To show a list of 50 orders with customer names, the code asks the database for the orders, then asks again, separately, for each customer. That is 51 trips instead of 1. With five users nobody notices. With a few hundred it is the whole delay. It is known as the N+1 problem, and a consultant who rescues these apps describes an app that stopped working at around 500 users because of it.
No indexes. A database finds rows quickly if you tell it which columns you search by, using an index. Without one it reads every row every time. A table of a few hundred rows hides this, and a table of a few hundred thousand does not.
No protection from two things at once. Booking code usually reads "is the slot free?" and then writes "book it." If two people do this at the same instant, both read "free," and both write. This is a race condition, and it only appears when real people overlap. It needs a database lock, a unique rule, or a single combined step.
There is also a quieter cost: everything being loaded at once. A page that fetches the whole table to show ten rows works until the table is big.
Check it in five minutes
- Add 5,000 fake rows to a test copy of your database, and open the slowest screens. If they crawl, you have found it.
- In your browser's Network tab, count how many requests one page makes. Dozens of nearly identical ones suggest N+1.
- Open two browser windows and try to book or buy the same single item at the same moment. Do both succeed?
- Look at your database provider's slow query list, which most offer.
How to fix it
- Fetch related data in one query rather than in a loop.
- Add indexes on the columns you filter and sort by, such as
user_idorcreated_at. - Show lists in pages of 20 to 50, not everything.
- Put a unique rule on anything that must not be doubled, for example one booking per slot, so the database refuses the second one.
- Cache what does not change often.
A prompt: "Review this page's database queries for N+1 patterns and missing indexes, and propose fixes. Make slot booking safe against two simultaneous requests."
Test before the crowd does
You do not need a huge test. A few thousand rows and two browser windows find most of it. If you want an experienced eye on the queries before launch day, send us a link.