Most apps don't need to handle millions of users on day one — but they do need a design that can grow without a full rewrite. These are the building blocks I reach for when an application starts to scale.
Start with a clean monolith
A well-structured monolith with clear modules is easier to build, test and deploy than microservices. Split services out later, only when a part of the system truly needs to scale on its own.
Caching
Caching is usually the cheapest performance win. I use Redis for frequently read, rarely changed data such as user profiles, settings and computed results.
async function getUser(id: string) {
const cached = await redis.get(`user:${id}`);
if (cached) return JSON.parse(cached);
const user = await db.user.findUnique({ where: { id } });
await redis.set(`user:${id}`, JSON.stringify(user), "EX", 300);
return user;
}Queues for slow work
Sending emails, generating reports or processing images shouldn't block an API response. Push that work to a queue (RabbitMQ, BullMQ) and let background workers handle it.
Scaling the database
- Add indexes for your most common queries — measure with EXPLAIN
- Use read replicas when reads far outnumber writes
- Paginate everything; never return unbounded lists
- Consider partitioning only when tables become truly huge



