> Apache Kafka with Node.js
Event streaming with KafkaJS. Producers, consumers, consumer groups, and exactly-once semantics.
fetch
$
curl "https://skillshub.wtf/skillshub-team/catalog-batch5/kafka-node?format=md"SKILL.md•Apache Kafka with Node.js
Kafka with KafkaJS
Setup
npm install kafkajs
Producer
const kafka = new Kafka({ clientId: 'app', brokers: ['localhost:9092'] });
const producer = kafka.producer();
await producer.connect();
await producer.send({ topic: 'events', messages: [{ key: 'user-1', value: JSON.stringify(event) }] });
Consumer
const consumer = kafka.consumer({ groupId: 'my-service' });
await consumer.subscribe({ topic: 'events' });
await consumer.run({
eachMessage: async ({ topic, partition, message }) => {
const event = JSON.parse(message.value!.toString());
await processEvent(event);
},
});
Admin
const admin = kafka.admin();
await admin.createTopics({ topics: [{ topic: 'events', numPartitions: 3 }] });
Key Patterns
- Message keys for partition ordering
- Consumer groups for parallel processing
- Idempotent consumers (handle duplicates)
- Transactional producer for exactly-once
> related_skills --same-repo
> Nix Dev Shells with direnv
Auto-activate reproducible dev environments with Nix flakes and direnv.
> Dagger with GitHub Actions
Run Dagger CI/CD pipelines in GitHub Actions for portable, testable builds.
> Bun + Hono API
Build fast APIs with Bun runtime and Hono framework.
> Deno Fresh Framework
Build full-stack web apps with Fresh on Deno. Islands, routes, and zero runtime overhead.
┌ stats
installs/wk0
░░░░░░░░░░first seenMar 18, 2026
└────────────