How Factory Scaled Next.js to Tens of Millions of Requests

Peter Bubenik Β· Vercel Β· Β· Source
Image for How Factory scaled its cloud backend to tens of millions of daily requests on Vercel

Concept 1: Next.js as a Full-Stack Backend (Not Just a Frontend Framework)

What most people think:

Next.js = a tool for building user interfaces

What Factory demonstrates:

Next.js can power an entire backend infrastructure, including:

ComponentPurpose
API RoutesHandle customer-facing requests
MiddlewareManage authentication and routing
Webhook HandlersProcess external events
Log Drain PipelinesFeed data to analytics systems

Why this matters:

  • One codebase handles everything
  • No need to spin up separate backend services
  • New routes can be added instantly without new vendor decisions

πŸ’‘ Key Takeaway: A single Next.js app can scale to tens of millions of daily requests when deployed on the right platform


Concept 2: Serverless Cold Starts and How "Fluid Compute" Solves Them

The Problem First:

Traditional serverless functions have a cold start penalty

User Request β†’ Function is "sleeping" β†’ Wake up (delay) β†’ Process β†’ Respond
                                           ↑
                                    This delay hurts latency

The Solution:

Fluid Compute keeps functions warm between requests

User Request β†’ Function already warm β†’ Process immediately β†’ Respond
                                              ↑
                                        No wake-up delay

Real-World Result for Factory:

  • p95 response time = 350ms or below
  • Latency-sensitive workloads remain reliable at scale

πŸ’‘ Key Takeaway: Cold starts are a hidden tax on serverless performance. Keeping functions warm eliminates this tax


Concept 3: Empowering Non-Technical Teams Through Autonomous Deployment

The Old Workflow (The Bottleneck):

Non-technical team needs a tool
        ↓
Submit request to engineering
        ↓
Engineers context-switch from product work
        ↓
Build and deploy the tool
        ↓
Days/weeks lost

The New Workflow (Factory's Model):

Non-technical team needs a tool
        ↓
Use AI Droids via Desktop App or CLI
        ↓
Droids call Vercel's APIs programmatically
        ↓
Tool is built and deployed autonomously
        ↓
Engineers only review high-stakes decisions

What this produces:

  • βœ… Dozens of deployments per day
  • βœ… Internal analytics dashboards
  • βœ… Customer-specific demos built in minutes
  • βœ… Custom one-off utilities

πŸ’‘ Key Takeaway: When deployment is programmable via APIs, non-technical teams become self-sufficient, freeing engineers to focus on core product work


Concept 4: Security at the Network Layer (WAF + Observability)

The Threat That Emerged:

Opening self-serve signups introduced a new attack surface:

Self-serve signup enabled
        ↓
Bots discovered the open door
        ↓
Fraudulent account creation
        ↓
Bad IP floods hitting the API

The Two-Layer Defense:

Layer 1 β€” Observability (See the threat)

Traffic hits API
    ↓
Observability tools surface:
  - Unusual traffic patterns
  - Problematic IP addresses
  - Anomalous request volumes

Layer 2 β€” WAF Enforcement (Stop the threat)

Identified threat
    ↓
Web Application Firewall applies:
  - Route-level blocking rules
  - Rate limiting
  - DDoS protection (always running)

The Outcome:

"Tens of millions of requests daily and I'm not losing sleep over what's hitting the API"

πŸ’‘ Key Takeaway: Security should operate at the network layer automatically β€” not require constant manual intervention from your engineering team


Concept 5: The "Eat Your Own Dog Food" Product Loop

What Factory Does:

They use their own product to build their product

Build internal automation using Droids
        ↓
Stress-test it on real infrastructure
        ↓
Validate it works at scale
        ↓
Ship it as a product feature
        ↑_________________________|
              Repeat

Why This Is Powerful:

BenefitExplanation
Real-world testingInternal use = genuine stress test
Faster iterationDogfooding reveals problems early
CredibilityThey trust their own product enough to run on it
Compounding valueEvery internal tool is a future product feature

πŸ’‘ Key Takeaway: Using your own product internally creates a feedback loop that simultaneously improves the product AND reduces internal overhead


Summary: The Five Concepts at a Glance

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  1. Next.js as full-stack backend β†’ One codebase scales  β”‚
β”‚  2. Fluid Compute β†’ Eliminates cold start latency        β”‚
β”‚  3. Programmable deployment β†’ Non-technical autonomy     β”‚
β”‚  4. WAF + Observability β†’ Automatic security layer       β”‚
β”‚  5. Dogfooding loop β†’ Product improves itself            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The overarching theme connecting all five concepts:

Stay lean by making infrastructure invisible β€” so engineers can focus entirely on building the product that matters

More to study