KafkaJS
A modern Apache Kafka client for Node.js
Repository Health
Technical Analysis
KafkaJS is a Node.js client for Apache Kafka compatible with Kafka 0.10 and above, offering producers, consumer groups with pause/resume/seek, transactional messaging, and an admin client, all implemented natively in JavaScript with no dependency on librdkafka bindings.
It supports Plain, SSL, and SASL_SSL connections including SCRAM-SHA-256/512 and AWS IAM authentication, plus pluggable compression codecs (GZIP built-in, Snappy/LZ4/ZSTD via plugins). While actively used across the ecosystem and integrated into frameworks like NestJS, the upstream repository has seen no commits since mid-2024, so evaluate maintenance status against your production requirements.
What You Get
- Native JavaScript Kafka client with no
librdkafka/native binding dependency - Producer API with batching, compression, and idempotent/transactional writes
- Consumer groups with pause, resume, and manual seek support
- Admin client for topic/partition management and cluster metadata
- SSL and SASL_SSL support including SCRAM-SHA-256/512 and AWS IAM authentication
- Pluggable compression codecs (GZIP built-in; Snappy, LZ4, ZSTD via plugins)
Common Use Cases
- Building event-driven microservices that produce/consume Kafka topics from Node.js
- Implementing exactly-once processing pipelines using transactional producers/consumers
- Connecting to managed Kafka (Confluent Cloud, AWS MSK) via SASL/IAM authentication
- Building admin tooling to manage topics, partitions, and consumer group offsets
- Integrating Kafka messaging into NestJS or Express-based services
Under The Hood
Architecture - src/cluster maintains broker metadata and connection pooling, src/broker implements the low-level Kafka wire protocol request/response cycle, src/consumer layers consumer-group coordination (join/sync/heartbeat, partition assignment, offset commits) on top of that, src/producer handles batching and idempotent/transactional writes, and src/admin exposes cluster/topic management - all connected through an src/instrumentation event bus that powers KafkaJS’s built-in logging and metrics hooks.
Tech Stack - Plain JavaScript (no TypeScript source, though types/ ships hand-written .d.ts definitions), zero required native dependencies - compression codecs like Snappy/LZ4/ZSTD are optional peer packages - and the repo ships Docker Compose files for Kafka versions 0.10 through 2.4 to test protocol compatibility across a broad version matrix.
Code Quality - Jest-based test suite (jest.config.js, *.spec.js files colocated with source, e.g. src/index.spec.js) with snapshot tests and a testHelpers directory for spinning up integration tests against real brokers via docker-compose; the project has 3,097 total commits and 144 contributors historically, but has had no commits since August 2024, so newly-opened issues/PRs are not being actively triaged.
API Design - The API centers on kafka.producer() / kafka.consumer({groupId}) factories returning promise-based objects with a small, consistent method surface (send, subscribe, run), and the instrumentation event bus lets consumers hook into internal events (e.g. REQUEST, CONNECT) for logging/metrics without modifying core behavior - a well-regarded design that contributed to its popularity even as maintenance has slowed.
Used by 13 apps in this directory
Pezzo
AI Development · Monitoring
Open-source LLMOps platform for prompt management, AI observability, intelligent caching, and real-time cost tracking across LLM providers.
Trench
Analytics · Data Engineering · Monitoring
Open-source event tracking infrastructure built on Kafka and ClickHouse that handles thousands of events per second on a single node, with full Segment API compatibility and no cookies.
Umami
Analytics
Privacy-first web analytics that respects your users — self-hosted, cookieless, and GDPR compliant out of the box.
Uptime Kuma
Monitoring
Self-hosted monitoring for every service you run — 23 monitor types, 95 notification channels, live dashboards, and public status pages with no vendor lock-in.