SQLite Is All You Need: Building a Social Network on a Single File
SQLite Is All You Need
I built a social network called Chirp using only SQLite to prove its production viability. With 50,000 users and a million posts in one file, our Node API handled 315 million requests daily on a laptop. By enabling WAL mode and STRICT tables, we achieved massive throughput without a database server, showing that most teams do not need Postgres containers.
"The Postgres container you spun up out of habit was never needed."
HN discussion
- One practitioner warns that using SQLite on distributed cloud file systems causes crippling race conditions, forcing a painful live migration to MySQL during scaling.
- Critics highlight that the article's advice to back up live databases using simple file copies is dangerous and can result in corrupt backups if a race condition occurs during a write transaction.
- While SQLite is praised for its simplicity and cost-effectiveness, users note it becomes unsuitable for multi-process write-heavy workloads due to its file-level locking, which causes abysmal performance compared to client/server databases.
- Defenders argue that SQLite remains viable for massive scale (multi-million MAU) when orchestrated through durable objects, offering significant cost savings over traditional PostgreSQL clusters.
- Skeptics suggest that if a project might ever require multiple concurrent processes or high availability, starting with PostgreSQL avoids the complexity of later migrations and offers battle-tested replication.