Registry / database / sqlite-nas-sync

sqlite-nas-sync

JSON →
library0.9.0jsnpmunverified

SQLite database synchronization across multiple clients via NAS using changelog-based conflict resolution. Version 0.9.0, actively maintained. Each client operates on a local SQLite database and synchronizes changes through a shared NAS directory. Key differentiators: automatic table discovery using schema introspection (no manual table list), SQLite trigger-based changelog for incremental sync, Last Write Wins conflict resolution using a timestamp column, support for per-table configuration (timestamp column name, delete protection), heartbeat mechanism to extend changelog retention, and an event system for monitoring sync progress. Requires Node.js >=16 and peer dependency better-sqlite3 >=11.0.0. ESM-only with built-in TypeScript types.

databasestorage
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package is ESM-only; require() will fail. Use dynamic import() or ensure your project is ESM (type: module in package.json).

import { setupSync } from 'sqlite-nas-sync'

discoverTables is a named export, not default. Named imports are available from v0.9.0.

import { discoverTables } from 'sqlite-nas-sync'

SyncConfig is a TypeScript type; use import type to avoid runtime errors. Available as a type export in v0.9.0.

import type { SyncConfig } from 'sqlite-nas-sync'

Initializes a sync instance, performs a manual sync, starts periodic sync, and stops after 60 seconds.

import { setupSync } from 'sqlite-nas-sync'; const sync = setupSync({ dbPath: './data/local.sqlite', nasPath: '/mnt/nas/shared-db/', clientId: 'client-abc123', }); await sync.syncNow().then(result => { console.log(`Inserted: ${result.inserted}, Updated: ${result.updated}`); }); sync.start(); setTimeout(() => sync.stop(), 60000);
Debug
Known footguns
gotchaSynchronization requires a NAS that supports atomic file copy operations. Non-atomic network filesystems may cause corruption.
breakingIn v0.9.0, table discovery was redesigned: tables missing a TEXT primary key named 'id' and a timestamp column named 'updatedAt' are now excluded. Previously, any table with a primary key was included.
deprecatedThe 'autoDetect' option was removed in v0.9.0. Table detection is now automatic and cannot be disabled.
gotchaPeriodic sync interval (intervalMs) default is 30 seconds. Shorter intervals may cause high I/O load on NAS and SQLite WAL file growth.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources