Understanding exchange infrastructure by building it from scratch.
Most trading platforms expose charts, prices, and order forms while the infrastructure underneath remains hidden.
XCHG Lab is an exchange infrastructure project that rebuilds the core systems behind a modern electronic exchange—including the matching engine, order book, market data pipeline, and trading interface—to explore how these components work together.
Build first. Understand every layer. Optimize later.
Core components of the project.
Every subsystem is implemented independently to understand the architecture behind modern electronic exchanges instead of relying on third-party services.
Matching Engine
A deterministic price-time priority matching engine built from scratch using in-memory order books for predictable order execution.
Real-time Market Data
Market depth, trades, and ticker updates are streamed over WebSockets with low-latency event delivery.
Persistent Storage
Orders, trades, and historical market data are stored in PostgreSQL and TimescaleDB for analytics and charting.
Service-Oriented Design
Independent services communicate through Redis to keep the platform modular, maintainable, and scalable.
Built with modern tools.
XCHG Lab is built using a modern TypeScript stack focused on real-time communication, reliable persistence, and modular backend services.
Built from first principles.
The matching engine, order book, market data streaming, historical storage, and trading interface are all functional and continue to evolve as new ideas are explored.
The goal isn't to replicate a commercial exchange feature-for-feature, but to understand the engineering trade-offs involved in building one from first principles.
Let's build better systems.
XCHG Lab is an exchange infrastructure project built to understand the architecture behind modern electronic exchanges. If you'd like to discuss distributed systems, matching engines, or have feedback on the project, I'd be happy to connect.
XCHG Lab is an Experimental exchange infrastructure project focused on exchange infrastructure, distributed systems, and low-latency backend architecture. It is intended for research, experimentation, and education rather than production trading.