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

@sschepis/magazine

v0.1.3

Published

A decentralized library for Ethereum event logging, syncing, and querying with pluggable storage backends

Readme

Magazine

A decentralized library for Ethereum event logging, syncing, and querying with pluggable storage backends — built on ethers.js with support for GunDB and Plexus.

Magazine gives you a complete pipeline: sync events from any EVM chain, store them in a decentralized peer-to-peer network, transform them into structured data models, and query them with a fluent API. Choose your storage backend — Gun for decentralized graph storage or Plexus for WASM-based mesh networking — or write your own adapter.

Quick Start

npm install magazine

With Gun (default, synchronous)

import Magazine from 'magazine';

const magazine = new Magazine({
  name: 'My Token Tracker',
  address: '0x1234567890123456789012345678901234567890',
  abi: [
    'event Transfer(address indexed from, address indexed to, uint256 value)',
    'event Approval(address indexed owner, address indexed spender, uint256 value)'
  ],
  provider: 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID',
  networkId: 1,
  gun: { peers: ['https://gun-manhattan.herokuapp.com/gun'] }
});

With Plexus (async factory)

const magazine = await Magazine.create({
  name: 'My Token Tracker',
  address: '0x1234567890123456789012345678901234567890',
  abi: [...],
  provider: 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID',
  networkId: 1,
  storage: {
    type: 'plexus',
    plexus: {
      seed: '64-char-hex-seed...',
      peers: ['wss://peer1.example.com'],
      scopePrefix: 'my-app'
    }
  }
});

Sync and query

// Sync events from the blockchain
await magazine.syncEvents();

// Listen to events in real-time
const unsub = magazine.on('Transfer', (event) => {
  console.log(`Transfer: ${event.args.value} from ${event.args.from}`);
});

// Cleanup when done
await magazine.destroy();

Features

  • Pluggable Storage — abstract adapter layer with built-in Gun and Plexus backends, or bring your own
  • Event Syncing — automatic, manual, range-based, transaction-specific, and real-time WebSocket sync
  • Data Models — schema-based storage with validation, CRUD, bulk operations, lifecycle hooks, and schema migration
  • Advanced Querying — MongoDB-style operators ($gt, $in, $regex, $or, $and, ...), fluent QueryBuilder, async iteration
  • Aggregation Pipeline — group, bucket (time-series), sum, avg, count, min, max, sort
  • Network Resilience — multi-provider failover, token-bucket rate limiting, LRU caching
  • Compression — gzip, JSON, and optimized strategies for efficient storage
  • Decentralized Storage — GunDB and Plexus integration for peer-to-peer data sharing
  • Debug Tools — health checks, performance metrics (p95/p99), structured logging with file output

Documentation

| Guide | Description | |-------|-------------| | Getting Started | Installation, first sync, first query | | Architecture | Component diagram, data flow, storage model | | Configuration | Full config reference with all options |

Guides

| Guide | Description | |-------|-------------| | Event Syncing | Auto-sync, manual, range, WebSocket real-time | | Data Models | Schemas, CRUD, hooks, bulk ops, transformers | | Querying | QueryBuilder, operators, logical combinators | | Aggregation | Pipelines, grouping, time-series bucketing | | Schema Migration | Versioned schemas, migration paths | | Pagination | Offset, cursor, async iteration | | Network Resilience | Failover, rate limiting, caching | | Debugging | Logger, health checks, performance metrics | | Compression & Pub/Sub | Storage optimization, publishing |

API Reference

| Class | Description | |-------|-------------| | Magazine | Main entry point — syncing, querying, models | | DataModel | Schema-based CRUD with hooks and bulk ops | | AggregationPipeline | Analytics and time-series aggregation | | SchemaMigration | Document version migration | | QueryBuilder | Fluent query API for events | | EventFilter | Parameter matching and filtering | | NetworkManager | Provider failover, caching, rate limiting | | DataCompressor | Compression strategies | | Paginator | Offset and cursor-based pagination | | Logger | Structured logging | | EventSyncer | Blockchain sync engine | | DebugUtils | Health checks, performance reports | | Errors | ValidationError, ModelError |

Examples

The examples/ directory contains runnable scripts:

| Example | What it covers | |---------|---------------| | quick-start.js | Minimal setup, sync, query | | data-transformation.js | Models, schemas, event transformers | | filtering-pagination.js | Pagination, QueryBuilder, async iteration | | query-builder-advanced.js | Complex queries, $or/$and/$nor, regex | | aggregation-pipeline.js | Grouping, time-series bucketing, analytics | | lifecycle-hooks.js | Pre/post save, update, delete hooks | | schema-migration.js | Versioned schemas, migration paths | | bulk-operations.js | insertMany, updateMany, deleteMany | | realtime-sync.js | WebSocket real-time event streaming | | multi-provider-failover.js | Provider rotation and caching | | metadata-compression.js | Event enrichment, compression strategies | | debug-config.js | Config validation, health checks, debug mode | | Decentralized USDC Indexer | Full production app with peer coordination |

Named Exports

For advanced usage, all components are individually importable:

import Magazine, {
  // Storage adapters
  StorageAdapter,       // Abstract base class for custom adapters
  GunAdapter,           // GunDB adapter (default)
  PlexusAdapter,        // Plexus mesh-network adapter
  createAdapter,        // Factory: returns adapter from config

  // Core components
  DataModel,
  AggregationPipeline,
  SchemaMigration,
  ValidationError,
  ModelError,
  DataTransformer,
  EventFilter,
  ConfigManager,
  NetworkManager,
  EventStore,
  EventSyncer,
  EventMetadata,
  DataCompressor,
  Paginator,
  PaginationHelper,
  Logger,
  DebugUtils
} from 'magazine';

Development

# Install dependencies
npm install

# Build (ES, UMD, CJS with source maps)
npm run build

# Unit tests (no blockchain needed)
npm run test:unit

# Full test suite (starts Hardhat node)
npm test

Requirements

  • Node.js 20+ (ES modules)
  • Ethereum provider (Infura, Alchemy, or local node)
  • Optional: Plexus SDK (prl) — only needed if using storage.type: 'plexus'

License

MIT — see LICENSE

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Links