Most early-stage software projects adopt infrastructure architectures designed for hyperscale user loads they may never experience. You pay for a distributed system before you have distributed users. That premature distribution introduces substantial financial overhead, security surface area, and operational cognitive drag.
For early-stage products, SaaS MVPs, and internal tools, a single virtual server running a unified framework with embedded SQLite is not only viable—it is often dramatically faster, cheaper, and more reliable than a distributed Kubernetes cluster.
The False Promise of Premature Microservices
Teams routinely choose multi-region AWS EKS clusters, distributed Redis caches, Kafka brokers, and managed database clusters for applications serving fewer than 10,000 active users.
The consequences are predictable:
- Idle Cloud Spend: An idle Kubernetes control plane, load balancers, NAT gateways, and managed DB instances quickly rack up $300–$800/month before your first dollar of revenue.
- Network Latency & Cold Starts: Shuffling data over internal VPC networks between microservices introduces cross-service serialization overhead and subtle latency spikes.
- Operational Distraction: Engineers spend more time debugging IAM permissions, Terraform manifests, and container ingress networking than shipping features users want.
When evaluating web performance and memory trade-offs, choosing simpler runtime architectures over distributed bloat consistently delivers higher uptime and faster page loads. The hardware already does the work. Your job is to stop getting in its way.
The Modern Single-Box Architecture
Thanks to high-performance NVMe storage, multicore VPS hardware, and modern framework advancements (such as Rails 8 Solid Queue and Solid Cache), an entire production-grade SaaS can run cleanly on a single $10–$20/month VPS instance (e.g., Hetzner, DigitalOcean):
flowchart TD
Internet([Incoming Traffic]) --> Proxy["Kamal Proxy / Reverse Proxy<br/>(Automatic Let's Encrypt TLS)"]
Proxy --> WebApp["Monolithic Web Application<br/>(Rails / Django / Go / Node)"]
subgraph Storage ["Embedded Local NVMe Storage"]
direction TB
DB[("Primary Database<br/>SQLite (WAL Mode)")]
Cache[("Solid Cache / Session Store")]
Queue[("Solid Queue / Background Jobs")]
end
WebApp <--> Storage
DB -.->|"Continuous Streaming Replication"| Litestream["Litestream Backup Engine"]
Litestream -.->|"Encrypted Snapshots"| S3[("Object Storage: AWS S3 / Cloudflare R2")]
1. SQLite in Production (WAL Mode)
SQLite is a zero-configuration, in-process database engine. Because data resides in the same memory and disk space as the application, query latency drops to sub-millisecond levels—bypassing TCP socket overhead entirely. In Write-Ahead Logging (WAL) mode, SQLite supports multiple concurrent readers alongside a writer, easily handling 5,000 to 20,000 requests per minute on a standard 4GB VPS.
You are not making a poverty compromise. You are removing a network hop from every query you write.
2. Zero-Loss Disaster Recovery with Litestream
The historical argument against single-box SQLite was disaster recovery: what if the server dies?
Modern architectures resolve this with Litestream. Litestream runs as a lightweight background daemon, continuously streaming SQLite WAL changes to an S3-compatible object store (such as AWS S3, Cloudflare R2, or Backblaze B2) with sub-second replication latency. If your VPS fails, restoring to a fresh server takes under 60 seconds.
3. Containerized Deployments via Kamal
Instead of complex orchestration tools, modern teams deploy single-box stacks using Kamal. Kamal deploys containerized applications with zero-downtime rolling reboots over standard SSH, handling asset bridging, container health checks, and TLS termination automatically. One command. One server. No control plane to babysit.
Operational Comparison: Single-Box vs. Multi-Tier Cloud
| Architectural Dimension | Modern Single-Box (Kamal + SQLite) | Multi-Service Cloud (EKS + RDS + Redis) |
|---|---|---|
| Monthly Infrastructure Baseline | $10 – $25 / month (Single VPS + S3 backup) | $350 – $900+ / month (K8s control, RDS, VPC NAT) |
| Query Latency (P95) | < 1ms (Direct NVMe memory mapped read) | 3ms – 15ms (Cross-network TCP roundtrips) |
| Operational Maintenance | One server; zero network topology to debug | High (VPC routing, IAM roles, cluster upgrades) |
| Deployment Complexity | Single command (kamal deploy) |
Multi-stage Terraform + Helm + CI pipelines |
| Failure Recovery | Automatic streaming restore from S3 | Multi-AZ automated failover |
When Does a Single Box Stop Being Enough?
Single-box has real limits. Knowing them beats discovering them during an incident. You have outgrown one server when any of these thresholds trip:
- Write concurrency: SQLite takes one writer at a time. When you sustain more than ~1 write transaction per millisecond for minutes at a time—or see repeated
SQLITE_BUSYtimeouts under load—move the write path to PostgreSQL. Reads alone rarely force the issue; writes do. - Memory ceiling: A single box shares RAM between the app, the database, the cache, and background workers. When your working set needs more than roughly 70–80% of available RAM at peak and vertical scaling stops being cheap, split the database onto its own machine first. That single split buys you the most headroom for the least disruption.
- Team size: One or two engineers can hold a whole box in their heads. Past about five engineers shipping in parallel, you start needing environments, isolation, and ownership boundaries. Process—not traffic—becomes the forcing function.
- Compliance and audit: If customers or regulators demand SOC 2 evidence, point-in-time audit trails beyond what you retain, or managed-database guarantees, contract terms often decide for you. Read the requirement before arguing architecture.
- Multi-region: If a significant share of users sit far from your single region and latency targets say so, you need presence closer to them. At that point you are deliberately building a distributed system—and should staff it like one.
None of these is a moral failure. They are signals with numbers attached. Measure, then move. When the answer is real distribution, designing a distributed system starts from the SLO rather than the diagram.
Before you act on the list, it helps to have the questions in order: the seven questions to ask before you split anything. And what the split actually costs is the ledger to read next.
Want to see what that shape looks like once money moves through it? Ecommerce Architecture at 100 Users runs this exact single-box stack in production — one server, one process, SQLite, Stripe Checkout — and names what breaks first when 100 users becomes 100k.
A Concrete Starter Repo Layout for the Monolith
Start the repository so backups and deploys are obvious from day one. This layout works for Rails, Django, or Go with minor renames:
myapp/
├── app/ # or internal/ (Go) — models, controllers, views
├── jobs/ # background jobs (Solid Queue / Celery / river)
├── db/
│ ├── schema.sql # canonical schema
│ ├── migrations/ # forward migrations only
│ └── seed.rb # local dev seed data
├── config/
│ ├── kamal/
│ │ ├── deploy.yml # server, registry, proxy, healthcheck
│ │ └── secrets.yml # env refs — never raw secrets
│ └── database.yml # points at ./storage/production.sqlite3
├── storage/
│ ├── production.sqlite3
│ └── .keep # WAL + SHM files live here too
├── scripts/
│ ├── backup.sh # wraps litestream restore/verify
│ ├── restore.sh # bring-up on a fresh box
│ └── smoke-test.sh # post-deploy checks
├── ops/
│ ├── litestream.yml # replica config for S3/R2/B2
│ └── runbook.md # disaster recovery steps, kept in-repo
├── Dockerfile
├── .github/workflows/ci.yml
└── README.md # setup, deploy, restore — in that order
Two rules keep this honest: the SQLite file lives inside storage/ and never in git, and ops/runbook.md lives next to the config it describes. A runbook you have to hunt for is a runbook nobody runs. This is the same discipline behind building code slowly and deliberately: fewer moving parts, documented well, maintained on purpose. If the modules inside that one box start fighting each other, modular monolith versus microservices is the next decision to make, not a rewrite.
Backup and Disaster Recovery Runbook
Backups you have never restored are hopes, not backups. Run this procedure quarterly, not just on setup day.
- Install Litestream on the production box (
brew install litestreamor download the release binary) and confirm it can see your database:litestream info storage/production.sqlite3. - Configure the replica in
ops/litestream.ymlwith your S3-compatible endpoint, bucket, region, and credentials pulled from environment variables—not checked into git. - Start replication:
litestream replicate -config ops/litestream.yml storage/production.sqlite3 production. Verify the daemon stays up and the generation appears inlitestream generations. - Alert on silence: Emit a heartbeat (cron job hitting a health endpoint, or your monitor checking object-store write recency). A silent Litestream process is indistinguishable from a dead one.
- Restore to a fresh box: provision identical hardware, pull the repo, then run
litestream restore -o storage/production.sqlite3 productionfromscripts/restore.sh. Target under 60 seconds of database downtime. - Verify, then cut traffic: run
scripts/smoke-test.sh—a real login, a real write, a real read—before pointing DNS or Kamal at the new server. - Log the drill: date, duration, data-loss window (should be seconds), and anything that broke. Update
ops/runbook.mdin the same commit.
A restore you have timed once is knowledge. A restore you drill quarterly is a capability.
The Migration Path: Peeling Off Postgres Without a Rewrite
The whole point of starting simple is that leaving is mechanical, not heroic. As covered in modern software engineering fundamentals, mature teams pick boring technology on purpose. When a threshold from the criteria section trips, walk this checklist:
- Add Postgres alongside SQLite. Provision a managed instance or a second box. Do not touch production traffic yet.
- Point migrations at Postgres. Your ORM (ActiveRecord, SQLAlchemy, Prisma, GORM) already emits dialect-aware SQL for the common paths. Run the full migration suite against a copy of production data and fix the raw-SQL corners—
strftime,AUTOINCREMENT,json_extract. - Dual-write behind a flag, or cut over in a maintenance window. For most early-stage apps with a small dataset, a scheduled window plus a one-shot export/import script beats weeks of dual-write complexity.
- Swap the connection string. Update
config/database.yml(or equivalent), deploy with Kamal, watch error rates for one release cycle. - Keep Litestream until the new database's own backup story is verified—then delete Litestream config in a separate commit so rollback stays clean.
- Leave the queue and cache in-process. Solid Queue on the same box keeps working next to Postgres. Split those only when job volume or isolation demands it.
You never rewrite the application. You change where the bytes live. Phases, not reinventions:
- Phase 1 (MVP to $20k MRR): Single VPS running web app, background worker, and SQLite with Litestream replication to S3.
- Phase 2 (Increased Concurrency): Scale the VPS vertically (e.g., 8 cores, 32GB RAM). Vertical scaling is instantaneous and requires zero architectural rewrites.
- Phase 3 (High Write Concurrency): Migrate SQLite to a dedicated PostgreSQL or MySQL instance—a connection string change, per the checklist above.
- Phase 4 (Real distribution needs): Split cache, queue, and read replicas only when a measured bottleneck names them.
The Challenge: Spin Up the Boring Stack This Weekend
You do not need another architecture diagram to study. You need one deploy.
This weekend: spin up a $10 VPS, run your framework with SQLite in WAL mode, put Kamal in front with automatic TLS, wire Litestream to an S3 bucket, and restore from that bucket into a throwaway directory so you have proven the runbook once. That is a full production architecture in an afternoon.
Ship the boring stack. Keep the fancy architecture for when your numbers ask for it.
Related Reading
The RAM Apocalypse is Coming for Web Developers (And It Might Save Us From Ourselves)
Your Chrome DevTools are open.
How to Design a Distributed System: Six Decisions in Order
You design a distributed system by making six decisions in order — where state lives, how many copies exist, how those
System Design: A Practical Guide for Software Engineers
Search system design and you get a diagram: a load balancer, a cache, a queue, a database, and a glossary.