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

@ebbjs/storage

v0.3.0

Published

Storage components for ebbjs

Readme

@ebbjs/storage

Local-first storage adapters for the ebbjs client. Provides an interface for caching and querying entity data, with in-memory and IndexedDB implementations.

Install

npm install @ebbjs/storage
npm install idb              # only for @ebbjs/storage/indexeddb

Node >=22.8.0. The root entry is types-only; runtime imports come from a subpath:

import type { StorageAdapter } from "@ebbjs/storage";
import { createMemoryAdapter } from "@ebbjs/storage/memory";
// also: @ebbjs/storage/indexeddb, @ebbjs/storage/replica, @ebbjs/storage/types

Components

| Component | Purpose | | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ActionLog | Append-ordered log of received actions. append returns the newly-added Updates plus a log-local position; readTail replays a watermark. Also provides entity-level queries for materialization. | | DirtyTracker | Tracks which entities need rematerialization. Queryable by type. | | EntityStore | Materialized entity cache. Handles get (by ID) and query (by type). | | CursorStore | Per-group GSN cursor tracking for sync resumption. | | OutboxStore | Durable buffer of locally-authored Actions awaiting acknowledgement, keyed by action.id. | | ReplicaStore | Single-slot persistence for the materialized replica (ReplicaRecord: format, position, revision, entities). A fast path only — an absent or corrupt record reads as null. | | StorageAdapter | Unified interface composing all components. createMemoryAdapter() returns a full in-memory implementation. |

Usage

import { createMemoryAdapter } from "@ebbjs/storage/memory";

const storage = createMemoryAdapter();

// Append an action (marks affected entities dirty)
await storage.actions.append(action);

// Get a single entity (materializes if dirty)
const entity = await storage.entities.get("todo_1");

// Query all entities of a type
const todos = await storage.entities.query("todo");

Architecture

Entities are materialized on-demand from the action log when they are dirty. This mirrors the server's materialized cache behavior — actions are the source of truth, entities are derived views.

Client receives action
        │
        ▼
  ActionLog.append()
        │
        ▼
  DirtyTracker.mark() — marks affected entity IDs dirty
        │
        ▼
  EntityStore.get() / .query() — materializes dirty entities
        │
        ▼
  Replays actions for each dirty entity, clears dirty flag

Constraints

  • Write path lives in @ebbjs/client — the storage layer ships the durable OutboxStore, while flush policy, retry, and acknowledgement semantics belong to the client outbox
  • Conflict detection and resolution live in @ebbjs/client — a detected LWW loser is a conflicted status plus payload on its own outbox row; storage ships only the durable OutboxStore, not a conflict table
  • Actions are append-only — never modified or deleted; rollbacks handled by compensating actions
  • Materialization is lazy — entities only rematerialized when read, not eagerly on action receipt
  • HLC + lexicographic tiebreak — same merge semantics as server (higher HLC wins, tiebreak by update_id)

Future Adapters

  • SQLite — persistent browser/storage adapter
  • Subscribe / Outbox — push-style subscriptions and the write outbox live in @ebbjs/client (see Epic #115 and #132).