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

@echomirror/social

v0.1.0

Published

EchoMirror SDK social module — global feed, leaderboard, and real-time updates

Readme

@echomirror/social

EchoMirror SDK social module — global feed, leaderboard, and real-time updates.

Installation

npm install @echomirror/social

Requires @echomirror/core as a dependency. React hooks require react >= 18 (optional peer).

Usage

Global Feed (paginated, infinite-scroll friendly)

import { GlobalFeedClient } from '@echomirror/social'
import { EchoMirrorClient } from '@echomirror/core'

const client = new EchoMirrorClient({ apiKey: 'your_api_key' })
const feed = new GlobalFeedClient(client)

// First page
const { entries, nextCursor } = await feed.fetchFeed()
// Next page
const page2 = await feed.fetchFeed({ cursor: nextCursor })

Leaderboard (time-windowed)

import { LeaderboardClient } from '@echomirror/social'

const leaderboard = new LeaderboardClient(client)
const weekly = await leaderboard.fetchLeaderboard()
const daily = await leaderboard.fetchLeaderboard({ window: 'daily' })

React hooks

import { useGlobalFeed, useLeaderboard } from '@echomirror/social'
import { useEchoMirrorClient } from '@echomirror/react'

function GlobalFeed() {
  const client = useEchoMirrorClient()
  const { entries, isLoading, fetchMore, hasMore, refresh } = useGlobalFeed(client)

  return (
    <div>
      {entries.map(e => <p key={e.id}>{e.score}/10</p>)}
      {hasMore && <button onClick={fetchMore}>Load more</button>}
    </div>
  )
}

function LeaderboardView() {
  const client = useEchoMirrorClient()
  const { entries, isLoading } = useLeaderboard(client, 'weekly')

  return <div>{entries.map(e => <p key={e.userId}>#{e.rank} {e.displayName}</p>)}</div>
}

Real-time subscriptions

import { SocialSubscription } from '@echomirror/social'

const sub = new SocialSubscription()
const unsubscribe = sub.subscribe((event) => {
  if (event.type === 'feed:new_entry') {
    console.log('New feed entry:', event.entry)
  }
})
// Cleanup
unsubscribe()

API

| Export | Description | |--------|-------------| | GlobalFeedClient | Paginated feed fetch with cursor API and client-side caching | | LeaderboardClient | Time-windowed leaderboard with short-TTL cache | | SocialSubscription | Real-time event subscription with reconnect | | WebSocketTransport | Default WebSocket transport for SocialSubscription | | RealtimeTransport | Interface for swapping transport (e.g. SSE) | | TtlCache | Generic TTL-based cache used internally | | useGlobalFeed() | React hook for feed state (entries, isLoading, fetchMore, refresh, hasMore) | | useLeaderboard() | React hook for leaderboard state (entries, isLoading, refresh) |

Open Questions / Assumptions

The following aspects were not discoverable from the available code or documentation and are assumed until the backend contract is confirmed:

| Assumption | Details | |------------|---------| | Feed endpoint | GET /social/feed?cursor=...&limit=... — assumed to return { entries, nextCursor } | | Leaderboard endpoint | GET /social/leaderboard?window=daily|weekly|all-time — assumed to return LeaderboardEntry[] | | Tie-break rules | Inferred order: weeklyScore desc → totalEntries asc → streak desc (see leaderboard.ts for the inline ASSUMPTION comment) | | Real-time protocol | Assumed WebSocket at wss://api.echomirror.dev/v1/social/ws. The RealtimeTransport interface is designed so SSE (or any other transport) can be swapped in with a single-line change | | Cache TTL | Feed: 30s. Leaderboard: 15s. Configurable via CacheConfig. |

Once the backend is reachable, these assumptions should be verified against actual API responses.