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

@anabranch/eventlog-kafka

v0.2.1

Published

Kafka adapter for eventlog using kafkajs with Task/Stream semantics

Readme

@anabranch/eventlog-kafka

Kafka adapter for @anabranch/eventlog using kafkajs. Provides Task/Stream semantics for event-sourced systems with Apache Kafka, Confluent Cloud, Redpanda, and other Kafka-compatible services.

Usage

import { EventLog } from '@anabranch/eventlog'
import { createKafka } from '@anabranch/eventlog-kafka'

const connector = createKafka({
  brokers: ['localhost:9092'],
  clientId: 'my-app',
  consumer: {
    maxWaitTimeInMs: 100,
    sessionTimeout: 6000,
  },
})

const log = await EventLog.connect(connector).run()

// Append events with partition keys
const eventId = await log.append('users', {
  type: 'UserCreated',
  userId: 'user-123',
  email: '[email protected]',
}, { partitionKey: 'user-123' }).run()

// Consume events as a stream
await log
  .consume<UserEvent>('users', 'my-processor', {
    batchSize: 50,
  })
  .tap((batch) => {
    for (const event of batch.events) {
      console.log(event.data)
    }
  })
  .map(async (batch) => {
    await batch.commit()
  })
  .partition()

API

createKafka(options)

Creates a Kafka connector.

import { createKafka } from '@anabranch/eventlog-kafka'

const connector = createKafka({
  brokers: ['localhost:9092'],
  clientId: 'my-app',
  sasl: {
    mechanism: 'plain',
    username: 'admin',
    password: 'secret',
  },
  ssl: true,
  consumer: {
    maxWaitTimeInMs: 100,
    sessionTimeout: 6000,
  },
})

Options

  • brokers (required): Array of Kafka broker addresses
  • clientId: Client ID for the producer
  • sasl: SASL authentication configuration
  • ssl: Enable SSL/TLS (default: false)
  • consumer: Kafka consumer configuration (passed to kafkajs)
  • producer: Kafka producer configuration (passed to kafkajs)
  • admin: Kafka admin configuration (passed to kafkajs)
  • onMalformedMessage: Callback for unparseable messages

Environment Variables

  • KAFKA_URL: Comma-separated list of broker addresses (alternative to brokers)

Requirements

  • Node.js 24+ or Deno
  • Kafka server (local or remote)

Installation

Deno:

import { createKafka } from '@anabranch/eventlog-kafka'

Node.js:

npm install @anabranch/eventlog-kafka @anabranch/eventlog kafkajs

See @anabranch/eventlog for the core event log abstraction.

See generated documentation for full API details.