The node.js interface is based on better-sqlite3


First follow the instructions to compile and install LiteSync from the source code or use the pre-compiled binaries for your platform. You can start with the free version.

Then you can install the wrapper with this command:

npm install better-sqlite3-litesync

Example code
const options = { verbose: console.log };
const uri = 'file:test.db?node=secondary&connect=tcp://';
const db = require('better-sqlite3-litesync')(uri, options);

db.on('ready', function() {

  const row = db.prepare('SELECT * FROM users').all();


db.on('sync', function() {

  console.log('the database received updates');


You can also check the status with:

let res = db.prepare('PRAGMA sync_status').get();
let status = JSON.parse(res.sync_status);


The installation can fail if there is no pre-built wrapper binary for your platform. In this case your computer needs to have the proper build tools.

On Windows

Run this command:

npm install --global --production windows-build-tools

Then try to install the wrapper again.