TradeFlux

Cloud-native trading infrastructure simulation built with event-driven microservices, Kafka, and observability tooling.

Distributed SystemsJul 2026 – Aug 20262 monthsCompleted
View Repository

Overview

TradeFlux is a cloud-native distributed trading infrastructure platform built to simulate real-world stock trading workflows using microservices, event-driven architecture, observability, and container orchestration. The project focuses on designing production-grade backend systems by combining synchronous and asynchronous communication patterns, service discovery, distributed tracing, monitoring, and Docker-based deployment.

Problem Statement

Trading platforms must coordinate user accounts, order placement, wallet operations, portfolio updates, and market-facing workflows while keeping the system responsive and reliable. A monolithic backend makes it harder to isolate these responsibilities and scale them independently. This project explores how a trading system can be modeled using distributed microservices that communicate through a mix of synchronous calls and Kafka events while remaining observable and containerized.

Features

  • JWT authentication
  • Service discovery with Eureka
  • API Gateway routing
  • Event-driven communication
  • Order lifecycle management
  • Wallet management
  • Portfolio management
  • Distributed tracing
  • Metrics collection
  • Dockerized infrastructure
  • Docker Compose deployment

Core Services

The system is composed of independently deployable services, each responsible for a single business capability.

01

API Gateway

Single entry point for all client requests with routing and route protection.

02

Auth Service

Handles user registration, authentication, JWT generation, and validation.

03

User Service

Manages user profile data and registration event handling.

04

Wallet Service

Handles wallet creation, fund management, reserve funds, release funds, and fund consumption.

05

Order Service

Manages buy order placement, order lifecycle, Kafka event publishing, and wallet integration.

06

Portfolio Service

Tracks portfolio holdings and updates positions based on events.

Technology Stack

Technologies, frameworks, infrastructure, and tooling used throughout the development of this project.

Backend

Java 21 • Spring Boot 3 • Spring Cloud

Database

PostgreSQL

Messaging

Apache Kafka

Infrastructure

Docker • Docker Compose

Developer Tools

Eureka Discovery Server • Spring Cloud Gateway • OpenFeign • Prometheus • Grafana • Zipkin • Micrometer • Spring Actuator • Git • Maven

Engineering Decisions

Architectural choices made to improve scalability, maintainability, reliability, and long-term evolution of the system.

01

Microservice Architecture

The system is split into independent services so trading, wallet, portfolio, and authentication concerns can evolve separately.

02

Event-Driven Communication

Kafka is used for asynchronous workflows such as order placement and order execution, reducing tight coupling between services.

03

Synchronous Service Calls

OpenFeign is used where a direct request-response interaction is useful, such as communication between the order and wallet services.

04

Service Discovery

Eureka is used so services can locate each other dynamically instead of hardcoding service endpoints.

05

Observability First

Prometheus, Grafana, Zipkin, Micrometer, and Spring Actuator are used to monitor, trace, and inspect the distributed system.

06

Containerized Deployment

All services and dependencies run in Docker, making the platform easier to start and reproduce locally with Docker Compose.

Challenges

The most significant engineering challenges encountered while building the system.

01

Designing event-driven flows for order placement and execution.

02

Coordinating wallet and portfolio updates through Kafka events.

03

Balancing synchronous and asynchronous communication patterns.

04

Keeping distributed tracing and monitoring visible across services.

05

Managing several infrastructure components during local development.

What I Learned

Key technical concepts and engineering practices gained during the implementation.

01

How distributed trading systems are structured at a high level.

02

How to combine synchronous calls with Kafka-based workflows.

03

How service discovery and API gateways simplify distributed communication.

04

How observability improves debugging in microservice systems.

05

How Docker Compose helps manage a multi-service backend locally.

Future Improvements

Potential enhancements that could improve scalability, reliability, and maintainability.

01

Add Kubernetes deployment.

02

Add CI/CD with GitHub Actions.

03

Introduce centralized logging.

04

Deploy on Minikube and AWS EKS.

05

Add stronger automated testing.