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

@betterinternship/broker

v1.2.0

Published

RabbitMQ transport for BetterInternship services: work queues for commands, one topic exchange for events.

Readme

@betterinternship/broker

The transport layer. Two standard RabbitMQ shapes, and deliberately nothing else — no DAGs, no orchestration state, no workflow engine.

| Plane | Shape | Use it when | | ----------- | ------------------------- | --------------------------------------------------- | | Command | work queue | exactly one handler; losing the message is a bug | | Event | topic exchange (events) | zero-to-many consumers, each with its own queue |

The litmus test: a second consumer someday would be a feature → event. Two consumers reacting would be a bug → command.

Local development

docker compose -f docker-compose.rabbit.yml up -d
# RABBITMQ_URL=amqp://bi:bi@localhost:5672/bi-dev

Dev and prod are separated by vhost (bi-dev / bi-prod), never by name prefixes. Every queue, exchange and routing key is spelled identically in both.

Publishing

import { broker, EmailSend } from '@betterinternship/broker';

await broker.send(EmailSend, {
  to: signatory.email,
  subject: '✅ Your form is ready',
  html: renderedHtml,
  alias: 'sign',
});

send and emit await a publisher confirm, so they reject on a nack, on a timeout, and — for commands, which publish mandatory — when no queue exists to take the message. A publish never silently disappears.

There is no RABBITMQ_ENABLED flag and no inline-execution fallback: the broker is tier-1 infrastructure like Postgres. Servers still boot and serve HTTP with it down; publishes just fail fast with a clear error.

Consuming

import { broker, EmailSend, FilloutCompleted, isEvent } from '@betterinternship/broker';

// Command: one handler, prefetch 5.
await broker.handle(EmailSend, async (msg, { attempt }) => {
  await deliver(msg.payload, { idempotencyKey: msg.payload.messageId ?? msg.id });
}, { prefetch: 5 });

// Event: this consumer's own queue, bound to the keys it cares about.
await broker.subscribe('delivery.discord', [FilloutCompleted], async (msg) => {
  if (isEvent(msg, FilloutCompleted)) await postPrefillEmbed(msg.payload);
}, { prefetch: 1 });

Resolve to ack. Throw to nack — the broker counts deliveries and parks the message in <queue>.dlq once x-delivery-limit (3) is reached. Backoff for a transient blip belongs inside the handler:

await retryTransient(() => renderPdf(input), { label: 'pdf render' });

Handlers must be idempotent: a crash, a deploy or a DLQ shovel all replay the same message.

Topology

Declaration is consumer-owned and idempotent — a consumer asserts its queue, its DLQ and its bindings on every boot. Publishers assert exchanges only, so there is no whoever-connects-first topology. Every queue is a quorum queue with x-delivery-limit: 3 and x-dead-letter-exchange: dlx (routing key = queue name).

Shutdown

process.on('SIGTERM', () => void broker.shutdown());

Stops consuming, lets in-flight handlers finish and ack, then closes. Wire it up — a deploy that skips this abandons unacked work to redelivery.

Contracts

Contracts live with their owner. A contract whose producer and consumer are the same repo (docs.fillout) is declared in that repo, so adding a domain job needs no package publish. Only cross-repo contracts live here:

  • EmailSendemail.send, consumed by the delivery worker
  • FilloutCompleteddocs.fillout.completed

Publishing this package

Shared package: the owner creates and publishes it. Do not bump version here.