Hello, everyone!
I’m starting a series of articles to document the development of My Broker B3. This is a personal project where I’m applying advanced software engineering concepts, distributed systems, and messaging to simulate the real-world operations of a stock brokerage.
The main objective is to create an ecosystem that handles challenges such as data consistency, low latency, and asynchronous communication, all while integrating a simplified matching engine.
🏗️ System Architecture
The project was designed following a microservices approach, using a hybrid stack to leverage the best of each ecosystem:
-
Core Backend (Java/Spring Boot 3): Responsible for the order (
broker-order-api), wallet (broker-wallet-api), and asset management (broker-asset-api) APIs. -
Market Data (Python): An integrator (
broker-market-data-api) that manages market data ingestion via scheduled tasks. -
Matching Engine (Java): A B3 simulator (
b3-matching-engine-api) that processes the execution of orders sent by the brokerage.
⚙️ Data Flow and Technologies
To ensure resilience and scalability, I adopted a hybrid communication strategy:
- Synchronous (REST): Used for critical real-time validations, such as verifying the wallet balance before allowing an order to be sent.
-
Asynchronous (Event-Driven):
- Apache Kafka: Acts as an internal event bus for distributing market quotes and asset-related events.
- RabbitMQ: Manages the communication between the Broker and the B3 Simulator through dedicated queues.
Persistence and Caching
Each service utilizes the data strategy that best suits its specific purpose:
| Technology | Use Case |
|---|---|
| MySQL / PostgreSQL | Transactional data, orders, and wallet history. |
| MongoDB | Market quotes history (Time-series data) within the Market Data API. |
| Redis | "Hot" cache for market prices to ensure ultra-high-speed queries. |
Technical draw
🚀 What’s Next?
This post is just the kickoff. In the upcoming articles, I plan to detail:
- Infrastructure: How to deploy all these resources on AWS (Free Tier).
- Messaging: A deep dive into Kafka and RabbitMQ configurations.
- Technical Challenges: How I’m handling eventual consistency and the matching engine's processing logic.
Feel free to leave your feedback or questions in the comments!
Connect with me:

Top comments (0)