Skip to main content

Kafka Topics ๐Ÿ“ก

This document describes the Kafka topics used in ShopVerse, their purpose, producers, and consumers.

Kafka acts as the event backbone of the system, enabling loose coupling, scalability, and asynchronous processing.


๐ŸŽฏ Why Kafka in ShopVerse?โ€‹

Kafka is used to:

  • Decouple microservices
  • Handle async workflows
  • Prevent cascading failures
  • Enable analytics & recommendations
  • Support future extensibility

๐Ÿ—‚๏ธ Topic Overviewโ€‹

Topic NamePurpose
auth-eventsAuthentication-related events
product-eventsProduct lifecycle events
order-eventsOrder lifecycle events
payment-eventsPayment status events
analytics-eventsUnified analytics stream

๐Ÿ” auth-eventsโ€‹

๐Ÿ“Œ Purposeโ€‹

Tracks authentication-related actions.

๐Ÿ“ค Producersโ€‹

  • Auth Service

๐Ÿ“ฅ Consumersโ€‹

  • Notification Service
  • Analytics Service

๐Ÿ“ฆ Event Typesโ€‹

  • USER_REGISTERED
  • USER_LOGIN

๐Ÿ“ฆ product-eventsโ€‹

๐Ÿ“Œ Purposeโ€‹

Tracks product catalog changes.

๐Ÿ“ค Producersโ€‹

  • Product Service

๐Ÿ“ฅ Consumersโ€‹

  • Notification Service
  • Analytics Service
  • Recommendation Service

๐Ÿ“ฆ Event Typesโ€‹

  • PRODUCT_CREATED
  • PRODUCT_UPDATED
  • PRODUCT_DELETED
  • PRODUCT_STOCK_UPDATED

๐Ÿงพ order-eventsโ€‹

๐Ÿ“Œ Purposeโ€‹

Tracks order lifecycle changes.

๐Ÿ“ค Producersโ€‹

  • Order Service

๐Ÿ“ฅ Consumersโ€‹

  • Notification Service
  • Analytics Service
  • Recommendation Service

๐Ÿ“ฆ Event Typesโ€‹

  • ORDER_PLACED
  • ORDER_STATUS_UPDATED

๐Ÿ’ณ payment-eventsโ€‹

๐Ÿ“Œ Purposeโ€‹

Tracks payment lifecycle.

๐Ÿ“ค Producersโ€‹

  • Payment Service

๐Ÿ“ฅ Consumersโ€‹

  • Notification Service
  • Analytics Service
  • Order Service (optional sync)

๐Ÿ“ฆ Event Typesโ€‹

  • PAYMENT_CREATED
  • PAYMENT_SUCCESS
  • PAYMENT_FAILED

๐Ÿ“Š analytics-eventsโ€‹

๐Ÿ“Œ Purposeโ€‹

Unified stream for analytics processing.

๐Ÿ“ค Producersโ€‹

  • All core services

๐Ÿ“ฅ Consumersโ€‹

  • Analytics Service (Flink job)

๐Ÿ“Œ Naming Conventionsโ€‹

  • Topic names use kebab-case
  • Event types use UPPER_SNAKE_CASE
  • One topic per domain

๐Ÿ“ˆ Scalability Notesโ€‹

  • Topics are partitioned
  • Consumer groups enable horizontal scaling
  • Producers are stateless

๐Ÿ“Œ Summaryโ€‹

Kafka topics in ShopVerse are:

  • Domain-driven
  • Clearly scoped
  • Easy to extend
  • Production-aligned

They form the communication contract between services.