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

@dwk/microsub

v0.1.0-beta.2

Published

Microsub server: channel/feed subscriptions, server-side polling, and a normalised JF2 timeline. Consumes IndieAuth tokens.

Readme

@dwk/microsub

Microsub server: channel/feed subscriptions, server-side polling, and a normalised JF2 timeline. Consumes IndieAuth tokens.

Part of the @dwk IndieWeb + Solid cohort. See the package specification for the full requirements.

A Microsub server that runs as a Cloudflare Worker — the IndieWeb's read side, completing the loop alongside @dwk/micropub (write), @dwk/webmention (interaction), @dwk/indieauth (identity), and @dwk/websub (push).

It manages feed subscriptions organised into channels, polls and parses sources server-side (Atom / RSS / JSON Feed / h-feed), and serves a normalised JF2 timeline to reader clients (Monocle, Together, Indigenous). The user's reading state lives on infrastructure they own, not in a hosted aggregator.

Usage

import {
  createMicrosub,
  createMicrosubPoller,
  createMicrosubQueueConsumer,
} from "@dwk/microsub";

const config = {
  baseUrl: "https://example.com",
  // the owner's IndieAuth profile URL; tokens minted for any other `me` are
  // rejected even if they carry the right scope
  me: "https://example.com/",
  // optional: defaults to `${origin}/microsub`
  microsubEndpoint: "https://example.com/microsub",
};

const microsub = createMicrosub(config);
const poll = createMicrosubPoller(config);
const consume = createMicrosubQueueConsumer(config);

export default {
  fetch(request, env, ctx) {
    return microsub(request, env, ctx);
  },
  // Cron Trigger: enqueue a poll job per followed feed.
  scheduled(controller, env, ctx) {
    return poll(controller, env, ctx);
  },
  // Queue consumer: fetch + parse + append to channel timelines.
  queue(batch, env, ctx) {
    return consume(batch, env, ctx);
  },
};

Bindings (declared Env fragment)

The handler fails loudly at startup if any of these are missing:

  • MICROSUB_DB — D1 database for channels, follows, timeline items, and the per-feed poll cache.
  • MICROSUB_QUEUE — Queue for feed-poll fan-out and retries.
  • AUTH_DB — the @dwk/indieauth issued-token store, consulted for revocation.
  • TOKEN_SIGNING_KEY — the secret the IndieAuth token endpoint signs tokens with.

What it implements

The single endpoint dispatches on the action (and method) parameter:

  • Channels (action=channels): list, create, rename, delete (method=delete), and reorder (method=order). A reserved notifications channel always exists and cannot be deleted or renamed.
  • Following (action=follow / action=unfollow): subscribe with feed discovery (Atom / RSS / JSON Feed / h-feed); a follow populates the timeline immediately and primes the poll cache.
  • Timeline (action=timeline): JF2 entries with before / after opaque cursors, mark_read / mark_unread (entry, entry[], or last_read_entry), remove, and per-channel unread counts.
  • Search / preview (action=search / action=preview): discover or preview a feed's entries without subscribing.

Every request is authorized by a DPoP-bound IndieAuth access token whose subject must match the configured me, with the proof-of-possession binding completed via @dwk/dpop and revocation checked against the strongly-consistent token store. Polling runs off the read path on a Cron-triggered queue; the read path serves stored entries only. Every outbound fetch is SSRF-guarded.

License

ISC