Rask.SQLite.Litestream
0.20.1-alpha.0.209
See the version list below for details.
dotnet add package Rask.SQLite.Litestream --version 0.20.1-alpha.0.209
NuGet\Install-Package Rask.SQLite.Litestream -Version 0.20.1-alpha.0.209
<PackageReference Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.209" />
<PackageVersion Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.209" />
<PackageReference Include="Rask.SQLite.Litestream" />
paket add Rask.SQLite.Litestream --version 0.20.1-alpha.0.209
#r "nuget: Rask.SQLite.Litestream, 0.20.1-alpha.0.209"
#:package Rask.SQLite.Litestream@0.20.1-alpha.0.209
#addin nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.209&prerelease
#tool nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.209&prerelease
Rask.SQLite.Litestream
Managed Litestream backup for SQLite, supervised from inside your app. Restores the database from its replica on startup (when the local file is missing) and continuously streams the write-ahead log to S3 / GCS / Azure Blob / file storage for the life of the process — all driven by a hosted background service, so there is no separate sidecar container to orchestrate.
It also verifies that what has been replicated is restorable — on an opt-in schedule, by restoring the replica back out to a throwaway path and checking a sentinel survived the round trip. "The replicator is running" and "the backup can be restored" are different facts, and only one of them is usually discovered at the moment you need it.
Builds on Rask.SQLite, whose WAL default is exactly
what Litestream requires and whose non-blocking busy-retry writes the verification sentinel, plus
CliWrap to drive the binary.
The
litestreambinary is downloaded at build time and dropped next to your app (SHA-256-verified, cached, tiny package) — nothing to install. Opt out with-p:RaskLitestreamDownload=falseand set your ownExecutablePath.
Install
dotnet add package Rask.SQLite.Litestream
Use
var dbPath = "/data/app.db"; // local disk — see the notes on network filesystems
builder.Services.AddRaskSqliteLitestream(o =>
{
o.DatabasePath = dbPath;
o.ReplicaUrl = "s3://my-bucket/app"; // or gcs://, abs:// (Azure Blob), file:///backups/app
// o.ExecutablePath = "/usr/local/bin/litestream"; // if it isn't on PATH
});
builder.Services.AddDbContextFactory<AppDb>(o => o.UseRaskSqlite($"Data Source={dbPath}"));
var app = builder.Build();
// Restore from the replica BEFORE opening the DB (no-op if the file already exists locally).
await app.Services.RestoreSqliteFromLitestreamAsync();
// ... EnsureCreated / migrate / seed, then app.Run();
Continuous replication then runs automatically as a hosted service until the app stops; on shutdown
it interrupts litestream and lets it flush (see ShutdownGracePeriod).
Notes
Single writer only. Litestream assumes one process writes the database. Run a single instance — do not scale out — or the replica diverges.
Local disk, not a network share. SQLite WAL needs real filesystem locking; keep the database on local/ephemeral disk and let Litestream replicate to durable storage. This is the pattern Litestream was built for (ephemeral container + object-storage backup).
Resilient by design. A backup failure is logged at
Criticalbut never crashes the app.Checkable. A log line tells you when replication broke; nothing tells you it's healthy. Resolve the
LitestreamStatussingleton forIsReplicating,LastStartedAt/LastExitedAt,RestartCount,LastExitCodeandLastError. A clean shutdown clearsIsReplicatingwithout counting a restart, so a climbingRestartCountmeans backups are flapping.Restorable, not just running. Every one of those fields describes the local child process. A replica writing to the wrong prefix, or a bucket whose credentials were rotated to read-only, keeps
IsReplicatingtrue right up until the restore. Turn onVerificationto prove the round trip:o.Verification.Enabled = true; // off by default — see the cost note below o.Verification.Interval = TimeSpan.FromHours(24);Each pass writes a sentinel row, waits for replication to carry it, restores to a temp path and checks it came back, then publishes
LitestreamStatus.Verification:Outcome,LastVerifiedAt,ReplicationLagandLastError. Alert on aLastVerifiedAtthat stops moving — anInconclusivepass just means the sentinel had not shipped yet, which is lag, not a broken backup.This costs money. A verification pass is a real restore and a real download, so it is off by default, defaults to daily when on, and belongs nowhere near a health-check endpoint that anything can poll.
ISqliteBackupVerifieris registered either way if you want to trigger one by hand.Advanced config. Point
ConfigPathat a fulllitestream.ymlfor multiple databases or custom retention / sync intervals.
Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CliWrap (>= 3.10.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Rask.SQLite (>= 0.20.1-alpha.0.209)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rask.SQLite.Litestream:
| Package | Downloads |
|---|---|
|
Rask
The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.1-alpha.0.228 | 34 | 9/4/2026 |
| 0.20.1-alpha.0.227 | 29 | 9/4/2026 |
| 0.20.1-alpha.0.226 | 35 | 9/4/2026 |
| 0.20.1-alpha.0.225 | 36 | 9/4/2026 |
| 0.20.1-alpha.0.224 | 35 | 9/4/2026 |
| 0.20.1-alpha.0.223 | 37 | 9/4/2026 |
| 0.20.1-alpha.0.221 | 36 | 9/4/2026 |
| 0.20.1-alpha.0.220 | 36 | 9/4/2026 |
| 0.20.1-alpha.0.217 | 34 | 9/4/2026 |
| 0.20.1-alpha.0.216 | 39 | 9/4/2026 |
| 0.20.1-alpha.0.215 | 40 | 9/3/2026 |
| 0.20.1-alpha.0.213 | 38 | 9/3/2026 |
| 0.20.1-alpha.0.212 | 36 | 9/3/2026 |
| 0.20.1-alpha.0.211 | 41 | 9/3/2026 |
| 0.20.1-alpha.0.210 | 37 | 9/3/2026 |
| 0.20.1-alpha.0.209 | 40 | 9/2/2026 |
| 0.20.1-alpha.0.208 | 34 | 9/2/2026 |
| 0.20.1-alpha.0.207 | 44 | 9/2/2026 |
| 0.20.1-alpha.0.206 | 43 | 9/2/2026 |
| 0.20.0 | 108 | 8/6/2026 |