Advanced

Event-Driven Architecture with Kafka

Decouple two services with Apache Kafka — produce and consume events, understand partitions and consumer groups, and choose an actively maintained Node.js client for a broker running in KRaft mode.

~4h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Build a Job Queue with Redis (to contrast queues vs event streams); Docker and Docker Compose for running a local Kafka broker.

Targeted versions: Apache Kafka 4.x running in KRaft mode (ZooKeeper mode was removed entirely starting with Kafka 4.0); confluent-kafka-javascript as the Node.js client; verified against kafka.apache.org and github.com/confluentinc, mid-2026.

You'll stand up a local Kafka broker, publish events from one service, and consume them from another — independently, at their own pace, without either service knowing the other exists. This is the core distinction from the job queue project earlier in this roadmap: a queue job is claimed and processed once by one worker, while a Kafka event can be read by any number of independent consumer groups, each keeping its own position in the log.

🔨

Run a local Kafka broker

🔨

Choose a maintained Node.js client

🔨

Produce events

🔨

Consume with a consumer group

🎯
Secret Mission

Secret Mission: idempotent consumption

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock