OrderFlow is a real-time e-commerce order tracking platform built with Spring Boot, Spring Cloud, Apache Kafka, and Angular. It enables seamless order creation, real-time delivery tracking, and live updates through event streaming.
Technology Stack used for development:
+---------------------+ +-------------------------+
| Frontend UI | ---------------> | API Gateway |
| (Angular + Leaflet) | (REST / WebSocket) | (Spring Cloud Gateway)|
+---------------------+ +-------------------------+
|
▼
┌───────────────────────────────┐
│ Apache Kafka │
│ (order-topic, delivery-topic)│
│ Simulates orders │
│ & driver location │
└─────────┬──┬──────────────────┘
│ │
┌────────────────────┘ └──────────────────┐
▼ ▼
┌────────────────────────────┐ ┌────────────────────────────┐
│ Consumer Order Service │ │ Consumer Delivery Service │
│ (Group: order-group) │ │ (Group: delivery-group) │
│ - Consumes new orders │ │ - Consumes driver location │
└────────────────────────────┘ └────────────────────────────┘
┌──────────────────────────────┐
│ Consul Registry │
│ (Service Discovery & Health) │
└──────────────────────────────┘
┌──────────────────────────────┐
│ Kafka UI │
│ (Topic inspection) │
└──────────────────────────────┘| Services | Port | Role |
|---|---|---|
| gateway-service | 8000 | API Gateway for routing requests to the appropriate microservice |
| producer-service | 9000 | Publishes order creation events to Kafka |
| consumer-order-service | 9001 | Consumes order events (order-topic) |
| consumer-delivery-service | 9002 | Consumes delivery events (delivery-topic) and simulates real-time driver locations |
| consul | 8500 | Service registry for discovery & health checks |
| kafka | 9092 | Message broker for streaming data (Kraft Mode) |
| zookeeper | 2181 | Coordinates Kafka broker |
| kafka-ui | 8501 | Web UI to monitor Kafka topics and consumers |
- Producer Service → Publishes new orders to Kafka (order-topic).
- Consumer Order Service → Processes order events
- Listens to order-topic (order list updates).
- Broadcasts order list in real time to connected WebSocket clients.
- Consumer Delivery Service →
- Listens to delivery-topic (driver position updates).
- Broadcasts updates in real time to connected WebSocket clients.
- Angular Frontend → Displays orders and live locations on a map (Leaflet).
In order to run this starter application locally you need to have Docker and Docker-Compose installed on your machine. Clone the repository:
git clone https://github.com/romdhanisam/OrderFlow.git
cd OrderFlowdocker-compose up --buildThis command will build and start all the services in the docker-compose.yml file, including:
- Kafka: The event streaming platform that enables real-time delivery tracking.
- Consul: The service registry for dynamic service discovery.
- Spring Cloud Gateway: Handles routing and load balancing between services.
- Producer and Consumer Services: Handle order events and delivery tracking.
- Frontend: Provides the Angular UI to display the order status and driver locations.
The gateway-service is a Spring Cloud Gateway application that acts as the entry point for all client requests. It routes incoming HTTP requests to the appropriate microservices.
Example (application.yml)
spring:
cloud:
gateway:
server:
webflux:
discovery:
locator:
enabled: true
routes:
- id: producer-service
uri: lb://producer-service
predicates:
- Path=/api/**
- id: consumer-order-service
uri: lb://consumer-order-service
predicates:
- Path=/ws-orders/**
- id: consumer-delivery-service
uri: lb://consumer-delivery-service
predicates:
- Path=/ws-delivery/**
