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

insieme

v2.1.1

Published

An offline-first collaborative library with authoritative server for real-time data synchronization

Downloads

560

Readme

Insieme

Insieme is an offline-first sync library built around an authoritative server. Clients create local drafts, submit them when transport is available, and converge on a server-ordered committed event stream.

TypeScript declaration files are bundled with the package, and the published entry points are split by environment so browser-safe imports stay distinct from Node-only adapters.

Install

bun add insieme

Entry Points

Use the package entry point that matches your runtime.

| Import path | Use for | Includes | | --- | --- | --- | | insieme | Portable client surface. Alias of insieme/client. | createSyncClient, client transports, client stores, createReducer | | insieme/client | Explicit client-only imports. | Same surface as insieme | | insieme/browser | Browser-explicit imports. | Same surface as insieme/client | | insieme/node | Node-only client + server work. | Everything in insieme/client, plus createSyncServer, WS server helpers, and Node persistence adapters | | insieme/server | Backward-compatible server alias. | Same surface as insieme/node |

Quick rule:

  • Browser app: import from insieme or insieme/client.
  • Node client using SQLite: import from insieme/node.
  • Sync server: import from insieme/node or insieme/server.

Client Quick Start

import {
  createOfflineTransport,
  createInMemoryClientStore,
  createSyncClient,
} from "insieme/client";

const clientStore = createInMemoryClientStore();
const transport = createOfflineTransport();

const client = createSyncClient({
  transport,
  store: clientStore,
  token: "jwt",
  clientId: "C1",
  projectId: "workspace-1",
});

await client.start();

await client.submitEvent({
  partition: "workspace-1",
  type: "counter.increment",
  schemaVersion: 1,
  payload: { amount: 1 },
});

Attach a real transport later without replacing the client instance:

await transport.setOnlineTransport(realWebSocketTransport);

Server Quick Start

import { createInMemorySyncStore, createSyncServer } from "insieme/node";

const serverStore = createInMemorySyncStore();

const server = createSyncServer({
  auth: {
    verifyToken: async () => ({ clientId: "C1", claims: {} }),
  },
  authz: {
    authorizeProject: async () => true,
  },
  validation: {
    validate: async () => {},
  },
  store: serverStore,
  clock: { now: () => Date.now() },
});

Persistence Adapters

Client-side stores:

  • createInMemoryClientStore() from insieme/client for tests and dev.
  • createIndexedDbClientStore() from insieme/client for browser persistence.
  • createLibsqlClientStore(client) from insieme/client for @libsql/client.
  • createAsyncSqliteClientStore({ driver }) from insieme/client for injected async SQLite runtimes such as Tauri-backed adapters.
  • createSqliteClientStore(db) from insieme/node for better-sqlite3 style SQLite APIs.

Server-side sync stores:

  • createInMemorySyncStore() from insieme/node.
  • createLibsqlSyncStore(client) from insieme/node.
  • createSqliteSyncStore(db) from insieme/node.

LibSQL example:

import { createClient } from "@libsql/client";
import { createLibsqlClientStore } from "insieme/client";
import { createLibsqlSyncStore } from "insieme/node";

const clientDb = createClient({ url: "file:./insieme-client.db" });
const serverDb = createClient({ url: "file:./insieme-server.db" });

const clientStore = createLibsqlClientStore(clientDb);
const syncStore = createLibsqlSyncStore(serverDb);

Materialized Views

Built-in client stores support optional partition-scoped materialized views.

import { createLibsqlClientStore, createReducer } from "insieme/client";

const reducer = createReducer({
  schemaHandlers: {
    "counter.increment": ({ state, payload }) => {
      state.count = (state.count ?? 0) + payload.amount;
    },
  },
});

const store = createLibsqlClientStore(db, {
  materializedViews: [
    {
      name: "event-count",
      version: "1",
      initialState: () => ({ count: 0 }),
      reduce: reducer,
    },
  ],
});

const view = await store.loadMaterializedView({
  viewName: "event-count",
  partition: "workspace-1",
});

Materialized views update only when a committed event is newly inserted. Duplicate committed deliveries are ignored by the built-in stores.

Subscribe to a hot materialized view partition:

const unsubscribe = await store.subscribeMaterializedView({
  viewName: "event-count",
  partition: "workspace-1",
  onChange: ({ value, lastCommittedId }) => {
    console.log(value, lastCommittedId);
  },
});

Public API Highlights

  • createSyncClient: project-scoped client runtime (start, submitEvent, syncNow, flushDrafts, stop, close).
  • createSyncServer: authoritative server runtime (attachConnection, shutdown).
  • createOfflineTransport: local-first transport that buffers submits until an online transport is attached.
  • createBrowserWebSocketTransport: browser WebSocket transport adapter.
  • Built-in client stores: stable inspection (listDraftsOrdered, listCommitted, listCommittedAfter, getCursor), view subscriptions (subscribeMaterializedView), and explicit close().
  • attachWsConnection / createWsServerRuntime: Node WebSocket bridge helpers for the server runtime.
  • createReducer: event-type dispatcher for replay and materialized-view reducers.

Docs

Examples

Production-style examples live in examples/real-client-usage.

Ops Helper

Run SQLite integrity checks:

bun run ops:sqlite:integrity -- /path/to/client.db /path/to/server.db