Most AI-built apps do not fail at scale because of the hosting platform; they fail because of missing database indexes, unbounded queries, work done synchronously in requests and no rate limits. Scale in stages: fix query patterns at around 1,000 users, add caching and background jobs at 10,000, and introduce read replicas, queues and capacity planning before 100,000.
On this page
An app generated with Lovable, Bolt, Claude Code or Codex can serve its first hundred users on almost any setup. The code works, the demo is convincing and traction arrives. Then the app slows down, the database bill jumps and a single heavy user can take the system down. This article lays out what typically breaks at each growth stage of an AI-built app and what to do about it, in the order that usually pays off.
Why AI-generated code struggles under load
Code generators optimise for "it works" in a demo with a few rows of data. Common patterns include fetching whole tables and filtering in the browser, issuing one query per list item (the N+1 problem), calling external AI APIs synchronously inside a request, storing derived data that is recomputed on every page view and lacking pagination. None of these matter with 50 records. All of them matter with 500,000. The good news: these are well-understood problems with well-understood fixes, and an agent can apply most of them quickly once a human identifies them.
Stage 1: 100 to 1,000 users, fix the query patterns
At this stage the bottleneck is almost always the database. Enable query statistics, for PostgreSQL the pg_stat_statements extension, and sort by total execution time. The top five queries typically account for most of the load. Add indexes for columns used in filters, joins and sort orders, especially foreign keys and user_id columns that Row Level Security policies check on every row. Add pagination to every list endpoint and replace client-side filtering with server-side queries.
Also look at the frontend. Large JavaScript bundles and unoptimised images make the app feel slow regardless of the backend. Our article on performance optimization for AI-generated web apps covers that side in detail.
Stage 2: 1,000 to 10,000 users, move work out of requests
Now the request path itself becomes the issue. Anything that takes longer than a few hundred milliseconds and does not need to happen before the response belongs in a background job: sending emails, generating PDFs, calling language models, processing uploads, syncing with third-party APIs. Use a queue, either a managed one or a PostgreSQL-based job table, and have workers process it. The user gets an immediate response and a status update later.
Introduce caching where data is read far more often than it changes: public pages at the CDN, computed dashboards in a cache with a short expiry, configuration in memory. Add rate limits per user and per IP on authentication, search and any endpoint that calls a paid API. Without rate limits, one script can generate a four-figure AI bill overnight.
Stage 3: 10,000 to 100,000 users, plan capacity
At this size you need data to make decisions. Instrument response times per endpoint, queue length, database connections and error rates, and set alerts on them; see our guide to monitoring and error tracking for AI-built apps. Typical measures at this stage:
- Connection pooling in front of the database, because serverless functions can open more connections than PostgreSQL allows.
- Read replicas for reporting and search so that analytics queries do not compete with user traffic.
- Archiving or partitioning of large, append-only tables such as logs, events and chat messages.
- Load tests against staging with realistic data volumes before marketing campaigns or launches.
- A cost dashboard per feature, since AI inference and egress often grow faster than users.
Most apps never need microservices to reach 100,000 users. A well-indexed PostgreSQL database, a stateless web tier, a queue and a CDN carry a surprising amount of load.
Using agents to do the scaling work
Agentic coding tools are well suited to this kind of work when the human sets the direction. Give Claude Code or Codex the output of your slow query log and ask it to propose indexes with an explanation and a migration. Ask it to find every list endpoint without pagination, or every synchronous call to an external API. Review each change and measure before and after; an index that helps one query can slow down writes. Teams that learn these review habits in a structured setting, such as the neooutput agentic coding workshops, get consistent results instead of agent-driven guesswork.
When scaling turns into rebuilding
Sometimes the honest answer is that the architecture cannot grow further: business logic lives in the browser, the data model has no clear ownership or the builder platform imposes limits you cannot change. In that case, a targeted rebuild of the critical path is cheaper than endless patching. Our article on turning an AI prototype into production-grade software describes how to decide what to keep. When we build and launch digital products ourselves, we plan this transition from the start. If you need support, the OnlineAppCreator custom development team takes over scaling and re-architecture work with AI Code Engineers and, where required, contractual SLAs.
Frequently asked questions
What usually breaks first when an AI-built app grows?
The database. Missing indexes, unpaginated lists and N+1 query patterns cause most early slowdowns, long before the hosting platform becomes a limit.
Do I need microservices to scale?
Rarely. A stateless web tier, a well-indexed PostgreSQL database, a job queue and a CDN can serve far more than 100,000 users for most business apps.
How do I stop AI API costs from exploding with growth?
Move AI calls into background jobs, cache results where possible, set per-user rate limits and quotas and track spend per feature with alerts.
Can Supabase handle 100,000 users?
It can for many workloads, provided you choose an adequate compute tier, use connection pooling, index your RLS columns and keep heavy analytics off the primary database.