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

sync-resource

v1.1.0

Published

Server-authoritative resource sync with caching, optimistic updates, realtime delivery and recovery, while remaining framework agnostic.

Readme

Sync Resource

Sync Resource is a typed, server-authoritative synchronization library for cached reads, optimistic writes, realtime updates, replay, repair, and mutation finality.

The database remains authoritative. Browser cache accelerates startup, optimistic state keeps interactions immediate, and cursor replay plus repair preserve correctness when realtime delivery is interrupted.

Install

npm install sync-resource

The examples use npm by default, but Sync Resource works with npm, pnpm, Bun, or any compatible package manager.

The core client is framework-neutral. When using an adapter, add only its optional framework peer:

# npm
npm install sync-resource react

# pnpm
pnpm add sync-resource vue

# Bun
bun add sync-resource solid-js

Quick Start

import { configureSync, createStore } from 'sync-resource/client/core';
import { cacheAdapter } from './cache.js';
import type { NotesManager } from './notesManager.js';

configureSync({
	streamUrl: '/api/sync-resource/stream',
	cache: { adapter: cacheAdapter }
});

const notes = createStore<NotesManager>({
	key: 'notes',
	getParams: () => ({ workspaceId: 'workspace-123' }),
	getUrl: ({ workspaceId }) => `/api/workspaces/${workspaceId}/notes/sync`,
	query: () => ({ status: 'active', limit: 50 })
});

const unsubscribe = notes.on.items((items) => {
	renderNotes(items);
});

const result = await notes.hydrate();
if (result.isErr()) {
	console.error(result.error);
}

Store construction is network-free. hydrate() restores cached authoritative state, refreshes from the server, and connects realtime delivery. The application owns its concrete cache adapter.

Documentation

  • Coding agents: start with AGENTS.md. It routes agents to the correct usage guide and source layer.
  • Complete usage and API — resources, managers, client stores, pure JavaScript examples, protocol, replay, repair, pagination, reconciliation, and finality
  • Solid — accessor mapping and automatic owner cleanup
  • Vue — shallow-ref mapping and effect-scope cleanup
  • React — hook mapping and explicit store ownership

README.md, AGENTS.md, and the complete docs/ directory are published with the npm package. Agents working from an installed dependency can find them under node_modules/sync-resource/.

The framework adapters create the same core store. They change only how state becomes reactive and how the store lifetime is owned; cache, transport, writes, replay, repair, and finality work the same way.

Public Entry Points

| Import | Purpose | | ---------------------------- | --------------------------------------------- | | sync-resource/server | Resources, managers, streams, and persistence | | sync-resource/client/core | Framework-neutral runtime and stores | | sync-resource/client/solid | Solid accessors and owner cleanup | | sync-resource/client/vue | Vue refs and effect-scope cleanup | | sync-resource/client/react | React hooks and explicit store lifecycle | | sync-resource/shared | Protocol, schemas, errors, and shared types |

Guarantees

  • Synchronized writes flow through managers so persistence, outbox replay, realtime fanout, and finality stay aligned.
  • HTTP acknowledgement is not mutation finality; authoritative envelope or reset coverage settles a write.
  • Realtime is not the sole correctness mechanism; cursor replay and repair preserve convergence.
  • Framework adapters do not duplicate synchronization logic from the core store.
  • IndexedDB and other concrete cache implementations remain application-owned adapters.

Status

The package builds ESM JavaScript, TypeScript declarations, and source maps for every public entry point. Maintained characterization tests cover the shared protocol, resources, managers, persistence, direct and shared SSE, client hydration and cache behavior, optimistic writes, replay, repair, finality, and framework adapters.

Development

Requirements: Node 22.18 or newer and pnpm 11.1.2.

pnpm install
pnpm run validate

The required validation runs formatting checks, Oxlint, type-aware checks, Vitest, and the package build. Run vp test --coverage when manually auditing coverage.


Designed by humans ❤️. Built and documented using agents 🤖.