- This project is a small version of any
Exchange
application likeBinance, Backpack CoinDTX
etc. Here I show the Realtime price, chart, trade, asks and bids of any currency likeBitcoin
,Solana
,Ethereum
and many more. - Here I try to implement my own backend Service for trade and RealTime logic. Use can Also see the Backend Architecture here.
for Reference I use the docs of Binance
This Project contains following services and folders:
Frontend
: A Next application to see all data of Exchange and GUI for Trading.api-Server
: An Express API Server for REST API's to interact with frontend.tradeEngine
: A highly Scalabe NodeJs server which Contain the core Logic to perform all RealTime trade by using the Message Queue for high performance.wsSocketServer
: A Web Socket server responsible for Realtime communication between the client and server. To scale the Web Socket I use the PUB/SUBS architecture.DataBase
: A timeScale PostgesQL DataBase to store the market data and Trade information.Redis
: Use to implement a Message queue and a Publisher/Subscriber architecture.
- This repo is create with
TurboRepo
. Because TurboRepo provides efficient monorepo management, enablingfaster builds
and streamlined workflows by sharing dependencies,caching results
, and optimizing project configurations.
- Run
npm run build
in root folder to build all the 5 serivces. TurboRepo start all service simultaneously. - SetUp all
.env files
in all service folders. - Run
docker-compose up
command to run the Redis and PostgresQL database in docker container. - Run
npm run dev
in root folder to up all service in development enviroment.
At this point following services would be up and running:
S.No | Service | PORT |
---|---|---|
1 | Frontend |
:3000 |
2 | Api server |
:4000 |
3 | Web Socket server |
:9000 |
Learn more about the power of Turborepo
: