How I Scaled My NextJS + Supabase App To Handle 10,000 Users

Quick Overview

The developer scaled their Next.js + Supabase app from zero to over 10,000 users and $4,000 in monthly revenue within 30 days by implementing significant performance optimizations, primarily by upgrading the Supabase compute instance to the XL tier and aggressively caching read-heavy queries using Redis and React's server components.

Key Points: The app scaled from zero to 2,706 users initially, quickly reaching over 10,000 users in 30 days. Monthly revenue grew from $0 to $4,000 within the same 30-day period. The primary performance bottleneck was identified in slow PostgreSQL queries related to reading team data, with mean query times reaching 8 seconds on the initial small compute instance. The developer upgraded the Supabase compute instance from the starter $20/month package to the XL tier ($98/month) to handle read traffic. Key optimization involved implementing Redis caching for read operations on team data, effectively bypassing PostgreSQL for cached reads. Further performance improvements were achieved by migrating heavy read operations away from PostgreSQL and onto a dedicated read-only replica instance. The developer also improved application performance by setting up automated background jobs (via Warp Agents) for tasks like updating localizations and fetching error states.

Context: The video details the technical journey of scaling a startup application named Yorby, which functions as a social media marketing platform, from a very small user base to over 10,000 users and $4,000 in monthly revenue in just 30 days. The creator focuses heavily on the performance bottlenecks encountered, primarily relating to database latency with Supabase's PostgreSQL instance, and the specific optimization strategies implemented to handle the rapid growth.

Detailed Analysis

The creator achieved massive growth, scaling their Next.js/Supabase app, Yorby, to over 10,000 users and $4,000 in monthly revenue in 30 days. Initially, the app was running on the smallest Supabase plan ($20/month), which proved incapable of handling the load, leading to slow query times (up to 8 seconds mean time for certain queries accessing the 'teams' table). The first major step was upgrading the Supabase compute instance to the XL tier ($98/month) to provide more resources, which helped alleviate immediate pressure but didn't solve the core issue of inefficient queries. The creator then used Supabase's Query Performance monitoring tab to identify the most expensive queries, realizing that slow reads from the 'teams' table were the main problem. The key optimization involved implementing Redis caching via a custom function. This function checks Redis first, returning data immediately if cached (a Redis hit), thus eliminating unnecessary PostgreSQL queries for cached team data. This strategy was crucial because the application is heavily read-based, especially for team information. Furthermore, the creator notes that they are actively moving read operations off the main PostgreSQL instance and onto a read-only replica to further improve performance and reduce load on the primary database. Finally, the creator mentions using Warp Agents for automation, such as running scheduled jobs for localization updates and PR checks in the background, to keep the main application running smoothly.

Raw markdown version of this recap