Trading platform
Nebula
Virtual stock trading and market education
A virtual trading platform where users can practice investing with simulated money, live market prices, and separate trader, broker, and admin dashboards.
Overview
Nebula combines a React client, a NestJS API, and an independent market simulation engine. The server handles trading rules, authentication, and financial state, while the engine generates prices and matches orders through Redis.
The project focuses on reliable financial operations: money is stored as integer paise, wallet changes use locks and database transactions, and duplicate order submissions are handled with idempotency keys.
Key features
- Market and limit orders with a live order book and portfolio tracking.
- An independent price simulation engine with a 10% circuit breaker.
- Email and Google sign-in with rotating refresh tokens and per-device session controls.
- Broker-managed top-ups, admin oversight, and an audit log of account activity.
- Room-based Socket.IO events for prices, fills, and market updates.
How it’s built
React client
Trader, broker, and admin interfaces communicate with the API.
NestJS API
Controllers, services, repositories, and DTOs separate routing, business rules, data access, and validation.
Market engine
An independent process generates prices and manages the Redis-backed order book.
PostgreSQL & Redis
PostgreSQL stores accounts and transactions. Redis supports messaging, order matching, and wallet locks.