# Litestream Litestream is a streaming replication tool for [[SQLite]] that turns the embedded engine into a credible production database. Created by Ben Johnson, it watches a SQLite database's [[Write-Ahead Logging (WAL)|WAL]] and continuously replicates changes to object storage (Amazon S3, Backblaze B2, SFTP, NFS, Google Cloud Storage, Azure Blob Storage, ABS, file). The application keeps using SQLite normally; Litestream runs as a sidecar process and ships durable snapshots and incremental WAL segments behind the scenes. ## Why It Matters SQLite is famously dismissed for "not being a real database" because it lacks built-in replication, point-in-time recovery, and high availability. Litestream removes that objection without changing the engine. You write to SQLite at in-process speeds, and your data still ends up safely in the cloud with sub-second loss windows. ## Core Capabilities - **Continuous replication** of WAL frames to one or more replicas - **Point-in-time restore** from any moment in the retention window - **Multi-replica** support (replicate to multiple destinations simultaneously) - **Encryption at rest** via age-based encryption - **Compaction** of WAL segments into snapshots, bounding storage cost - **Single binary**, no daemon orchestration overhead ## How It Works Litestream piggybacks on SQLite's WAL mode. Instead of intercepting writes at the application layer, it: 1. Holds a long-lived read transaction so SQLite cannot truncate the WAL behind it 2. Reads new WAL frames as they're written 3. Streams them to replicas as small append-only segments 4. Periodically rolls a fresh snapshot to bound restore time This design means zero application changes; any SQLite app gets durability "for free." ## Use Cases - Single-node web apps that want managed-database durability without paying for one - Edge and embedded deployments where SQLite is the only sensible choice - Backup-of-record for desktop or CLI apps storing user data locally - Local-first applications wanting cloud-side durability without merge complexity ## Limitations - Does NOT provide read replicas or horizontal scaling (use LiteFS for that, also by Ben Johnson) - Replication is asynchronous; a crash can lose seconds of writes - One writer only; SQLite's single-writer model is unchanged ## References - Official site: https://litestream.io/ - GitHub: https://github.com/benbjohnson/litestream ## Related - [[SQLite]] - [[Write-Ahead Logging (WAL)]] - [[Database]]