Litestone guide / Advanced
Replication
litestone replicate streams every declared database to S3-compatible storage with Litestream, and litestone restore brings it back, to the latest write or to an instant in the retention window.
model User {
id Int
email String
}
litestone replicate db/schema.lite s3://mybucket/myapp
litestone restore s3://mybucket/myapp 2026-09-27T10:00:00Z
The same settings live in litestone.config.js, and flags override them:
export default {
schema: './db/schema.lite',
replicate: {
url: 's3://mybucket/myapp',
syncInterval: '10s',
retentionPeriod: '720h', // 30 days of snapshots
l0Retention: '1h', // the point-in-time window
},
}
The schema says what exists, so each declared database replicates to its own path under the url.
What else it can do
--db mainreplicates or restores one database- Under
strategy databasethe tenant files and the registry get their own targets, and a new tenant is picked up without a restart restoreis all or nothing, and refuses files already at a destination without--force--atrestores every file to one instant, within thel0Retentionwindow--from-backup <dir>restores from alitestone backup, the only way back forjsonlandtraildatabasesrestore --verify <dir>restores into an empty directory and grades every file against the schema- Every restored file gets Litestream's integrity check
db.$walStatus()reports the WAL's frames since the last full checkpointlitestone migrate apply --backuptakes a backup before it migrates
In depth: Replication § Setup, § Every declared database, § Restoring, § Proving a copy, § Point-in-time restore, § Pre-migration backup