Skip to main content

Architecture Overview

This section covers the high-level architecture of our Enterprise Recommendation System.

Core Components

  1. FastAPI (API Layer): Serves as the web framework. It handles incoming HTTP GET requests for recommendations. FastAPI was chosen for its high performance, native async support, and automatic Swagger UI generation.
  2. Kafka (Event Streaming Layer): Acts as the backbone for asynchronous communication and self-adjusting mechanisms. The system listens to a stream of events (e.g., user interactions, product updates) via Kafka topics to continuously refine its recommendation models or states.
  3. Zookeeper: Manages and coordinates the Kafka brokers (used in traditional Kafka setups, though modern Kafka is moving towards KRaft).

Data Flow

  1. A client requests recommendations via a GET request to the FastAPI server (/recommendations/{user_id}).
  2. The server responds with the current best recommendations.
  3. Concurrently, a background Kafka consumer within the FastAPI application listens for recommendation_events.
  4. As new events arrive, the system processes them to self-adjust future recommendations.