Skip to main content

Documentation

Architecture Overview & Traffic Flow

Architecture overview, scale targets from 100K to 10M users, and request lifecycle.

1. Architecture Overview

Stackhouse is a Rust-based Supabase alternative for enterprise with:

Scale Targets: 100K β†’ 10M

Metric100K Baseline (SMB)10M Enterprise 🏒
Total users100,00010,000,000
Concurrent users10,0001,000,000
Peak RPS (API)1,000100,000
WebSocket connections50,0005,000,000
DB queries/sec5,000500,000
Redis cache size4–8 GB500 GB–2 TB
API pods13300–1,000
PostgreSQL primaries110–20 (shards)
Regions13–5 (active-active)
Monthly cost (GCP)~$1,295~$85,000–$120,000

Architecture Differences by Scale:

  • 100K: Single region, single PostgreSQL primary + replicas, Redis Sentinel
  • 10M Enterprise 🏒: Multi-region active-active, Citus sharding, Kafka event bus, Istio service mesh

Stackhouse core components:

  • HTTP/WS API β€” Axum (Rust)
  • Auth β€” Argon2 + JWT
  • Database β€” PostgreSQL via sqlx (no separate custom storage engine β€” see the current-state note below)
  • Vector Search β€” Qdrant (dedicated vector database)
  • Realtime β€” WebSocket + SSE broadcast (in-process tokio::broadcast, not Redis pub/sub, today)
  • Storage β€” S3-compatible bucket system
  • AI β€” RAG pipeline, embeddings, LLM routing
  • Edge Functions β€” JavaScript runtime (embedded Boa engine); router mounted under /v1/functions in main.rs

Current-state note (2026-08-18)

This page is an infrastructure-scaling design; some of it describes target-state components rather than what exists in the codebase today. Stackhouse's actual data layer is PostgreSQL only β€” there's no separate custom storage engine. Redis, Citus sharding, Kafka, and Istio (below and throughout this section) are scaling targets for larger tiers, not currently wired into the codebase.

High-Level System Diagram

Rendering diagram…

2. Traffic Flow & Request Lifecycle

Rendering diagram…

Total target latency: p50 < 20ms Β· p95 < 100ms Β· p99 < 300ms