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

anchordb-sync-server

v1.3.2

Published

Framework-agnostic server implementation of the Anchor sync protocol, with Express, NestJS and Next.js adapters.

Readme

anchordb-sync-server

The server half of the AnchorDB sync protocol, with Express, NestJS and Next.js adapters.

Overview · Report a bug or get support

npm install anchordb-sync-server

Express

import express from "express";
import { createAnchorRouter, MemoryStore } from "anchordb-sync-server";

const app = express();
app.use(express.json());
app.use("/anchor/v1", createAnchorRouter(express.Router, { store: new MemoryStore() }));

Next.js (App Router)

// app/anchor/v1/[...anchor]/route.ts
import { createAnchorRouteHandlers } from "anchordb-sync-server/nextjs";
import { MemoryStore } from "anchordb-sync-server";

export const { POST, GET } = createAnchorRouteHandlers({ store: new MemoryStore() });

NestJS

import { AnchorSyncService, createAnchorSyncService } from "anchordb-sync-server/nestjs";

NESTJS_CONTROLLER_EXAMPLE exports a ready-to-paste controller and module. NestJS itself is not a dependency of this package — the controller lives in your app, so it keeps your routing and your own Nest version.

Stores

| Store | Use | | --- | --- | | MemoryStore | default; development, tests, demos. Runs with no database | | MongooseStore | MongoDB, from anchordb-sync-server/mongoose |

import mongoose from "mongoose";
import { MongooseStore } from "anchordb-sync-server/mongoose";

const store = new MongooseStore({ mongoose });

Mongoose is a peer dependency and is passed in rather than imported, so the package installs without it and your app keeps a single mongoose instance.

What the server is responsible for

  1. Version counters — per-document integers; a stale baseVersion is a conflict.
  2. Authoritative timestamps — every response carries serverTime, which clients use to correct their own clock skew.
  3. A global change sequence — pull cursors are positions in it, so a partial sync resumes.
  4. Idempotency — (clientId, mutationId) verdicts are memoised, so a retry after a timeout replays the original result instead of applying the write twice.

The server never picks a conflict winner. It returns its document and lets the client's configured strategy decide, because only the client knows which strategy the developer chose.

Status

1.0.0. All three adapters share one protocol implementation and are held to the same 49-test conformance suite. MongooseStore is typechecked and written against the documented Mongoose API but is not exercised against a live MongoDB in this package's tests — set MONGODB_URI and run your own integration check before relying on it.

The AnchorDB family

Six packages. Only anchordb is required — the rest exist so that an offline-only app never has to download Express, and an Express server never has to download React.

| Package | What it is | Runs where | | --- | --- | --- | | anchordb | The database — schema, models, queries, aggregation, optional sync | phone · browser · Node | | anchordb-react | React and React Native hooks | the device | | anchordb-angular | Angular / Ionic module, DI and RxJS observables | the device | | anchordb-sync-server (this package) | Server half of sync — Express, NestJS, Next.js | your backend | | anchordb-relay | Dev relay for the Anchor Lens inspector | your laptop | | anchordb-lens-link | Open a QA build's database in Anchor Lens on the same phone, from a file | the device, in QA builds |

Each one needs a different third-party framework as a peer dependency, and npm resolves those per package rather than per import — which is why they are not one package. Full reasoning and API reference: github.com/knnadeera/anchordb.

MIT

Bugs, support and feedback

Report a bug, ask for help or suggest a feature on the AnchorDB project page — choose anchordb-sync-server as the package, and the reply comes by email.

Include the version (npm ls anchordb), where it runs, the smallest snippet that reproduces it, and the full error.

Sync problems: say which conflict strategy you use, and whether the mutation shows as parked in Anchor Lens — a push rejected by a unique index is parked rather than retried forever.