npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@michaelthielemann/kestrel-replication-sqlite

v5.8.1

Published

Continuous SQLite replication to blobstore@1 (snapshots + WAL segments), point-in-time restore, retention.

Readme

replication/sqlite

Continuous replication of the SQLite database into blobstore@1, Litestream-style but in-process: a generation starts with a full snapshot, then every replication.sync ships the committed WAL frames written since the last run as a segment. The snapshot is the main database file with the committed WAL frames applied on top, assembled under the module's read transaction, never a VACUUM INTO: segments address pages by number, so the snapshot has to keep the live file's page layout. Frames the snapshot already contains are not shipped again; without a generation there is nowhere to ship frames to, so they wait. Point-in-time restore = snapshot + segments up to the requested time, applied page by page; the rebuilt file is opened and passes PRAGMA quick_check before it is handed over, otherwise the restore fails with TRANSIENT naming the generation. Because the writing connection lives in the same Node process, checkpoints (wal_checkpoint(TRUNCATE)) run between two synchronous steps and can never lose frames. Config: file, prefix, checkpointBytes/checkpointSeconds, snapshotSeconds (24 h), retentionSeconds (48 h; the newest generation is always kept), restoreOnStart (rebuild the file from the replica when missing). List this module before persistence-sqlite. Run replication.sync from a cron trigger (* * * * * → RPO ≤ 60 s). Every step returns a Result. A blobstore Err (Err(TRANSIENT), 503, retryable) passes through unchanged; replication.prepareRestore for a point with no snapshot before it, or an unknown generation, is Err(NOT_FOUND); an unparsable at in the payload is Err(VALIDATION).

| Step | reads | writes | errors | |---|---|---|---| | replication.sync | – | result | TRANSIENT | | replication.snapshot | – | result | TRANSIENT | | replication.listPoints | – | result | TRANSIENT | | replication.readStatus | – | result | TRANSIENT | | replication.prepareRestore | – | result (writes <file>.restore; applied by setup on the next start – the live database cannot be replaced while open) | VALIDATION, NOT_FOUND, TRANSIENT |

backup/blobstore follows the same pattern with its own file names (<file>.restore-pending plus <file>.restore-marker), so both modules can point at the same database without clashing. Not included: multi-process setups, encryption, restore without restart.

Generated from the manifest

@michaelthielemann/kestrel-replication-sqlite – module replication/sqlite: provides no contract; requires blobstore@1.

| Config | Type | Required | Default | |---|---|---|---| | file | string | yes | – | | prefix | string | no | "replica/" | | checkpointBytes | integer | no | 4194304 | | checkpointSeconds | integer | no | 300 | | snapshotSeconds | integer | no | 86400 | | retentionSeconds | integer | no | 172800 | | restoreOnStart | boolean | no | true |

| Step | Summary | Reads | Writes | Input | Output | Errors | |---|---|---|---|---|---|---| | replication.sync | Ship new WAL frames, checkpoint, snapshot and prune when due | – | result | – | { generation?: string, shippedBytes?: number, frames?: number, checkpointed?: boolean, pruned?: number, … } | – | | replication.snapshot | Start a new generation with a full snapshot | – | result | – | { generation?: string, bytes?: number, … } | – | | replication.listPoints | Restore points (snapshots and WAL segments) | – | result | – | object[] | – | | replication.readStatus | Replication status | – | result | – | { generation?: string | null, lineage?: number, shippedFrames?: number, lastSyncAt?: number | null, lastSnapshotAt?: number | null, lastCheckpointAt?: number | null, walBytes?: number, pendingRestore?: string | null, … } | – | | replication.prepareRestore | Rebuild the database at a point in time next to the live file; applied on next start | – | result | { generation?: string, at?: number | string } | { generation: string, at: number, file: string, restartRequired: true, … } | 400 invalid "at" value; 404 no snapshot before the requested point |

Pipelines in examples/minimal using these steps:

  • replicate (cron * * * * *): replication.sync
  • replicationPoints (GET /admin/replication/points): authn.requireUser → authz.require:system.manage → replication.listPoints
  • replicationRestore (POST /admin/replication/restore): authn.requireUser → authz.require:system.manage → replication.prepareRestore
  • replicationSnapshot (POST /admin/replication/snapshot): authn.requireUser → authz.require:system.manage → replication.snapshot
  • replicationStatus (GET /admin/replication/status): authn.requireUser → authz.require:system.manage → replication.readStatus