Appearance
Architecture
The exchange is one Laravel application surrounded by a few small services. Knowing which part does what makes installation, monitoring and troubleshooting much easier.
The big picture
Browsers & API clientsVisitors, traders, admins, merchants
HTTPS 443 · WSS 443
Nginxyourdomain.com · /chart.io · socket.yourdomain.com
PHP-FPM · proxy
Laravel web appPages, admin panel, REST API, order entry
Soketi:6001 · live updates
chart-udf:8081 · provider candles
shared database, Redis and code
Horizon workersorders · orderbook · market · events · webhooks · low
PM2 processesorder-processor · stop-trigger · market-watcher · liquidity runners · bots · futures · P2P · options
Schedulercron · deposits · rewards · watchers
read / write
PostgreSQL:5432 · users, balances, orders, settings
Redis:6379 · queues, cache, sessions
Rust engine:9000 · optional
blockchains & market data
Bridges:8000–8007 · ETH, BNB, Tron, Polygon, Solana, TON
External servicesBinance · MEXC · Bybit · Etherscan · node providers · KYC · payments
The parts
| Part | What it does | Runs as |
|---|---|---|
| Laravel web app | Every page, the admin panel at /exchange-control-panel, the REST API at /api/v1, sign-in, and placing orders | PHP-FPM behind Nginx |
| PostgreSQL | The source of truth: users, wallets and balances, orders, trades, deposits, withdrawals, and every admin setting | System service |
| Redis | Queues, cache (including live market statistics) and sessions | System service |
| Horizon | Background workers for queued jobs: order processing, live updates, emails, merchant webhooks | PM2 horizon, started by pm:watcher |
| Order processor | Every 2 seconds, fills resting spot limit orders that the liquidity provider's moving prices now cross (new orders are matched the moment they're placed) | PM2 order-processor, started by pm:watcher |
| Price tracker | Keeps market prices and 24h statistics current and pushes them to browsers | PM2 market-watcher, started by pm:watcher |
| Liquidity runners | Two processes for all markets: one Binance connection mirrors the book and trades of every provider-backed market; the other simulates every custom-token market | PM2 liquidity-binance, liquidity-custom, started by pm:watcher |
| Stop trigger | Places stop-limit and OCO stop orders, moves and fires trailing stops, and fires TP/SL orders when a trade or price move reaches the stop (woken at once, checks every 3 s anyway) | PM2 stop-trigger, started by pm:watcher |
| Futures, P2P and options processors | Liquidations, futures limit and TP/SL orders, expired P2P orders, option settlement | PM2, started by pm:watcher (plan 5) |
| Scheduler | Everything on a timer: deposit detection, wallet balances, rewards, funding fees, mini-charts, the process watchers | One cron entry |
| Soketi | Pushes live updates to browsers over WebSockets | PM2 soket |
| chart-udf | Serves Binance candles for markets whose chart type is From liquidity provider | PM2 chart |
| Bridges | One Node.js service per network: create addresses, sign and send transactions | PM2 bridge-<network> |
| Rust matching engine | Optional in-memory matching for markets without a liquidity provider | PM2 matching-engine |
Details for each are in Services & infrastructure. Ports and process names are in Ports & processes.
What happens when someone places an order
- The order form sends the order to the platform's API. Orders from the website are allowed automatically for signed-in users. Orders from trading bots need an API key with the trade permission.
- One market at a time. The spot engine (
app/Services/Spot) takes a database lock for the market and opens one database transaction. Everything below happens inside it: if anything fails, nothing is kept. - Checks and balance hold. Price, amount, minimums and the order type's rules are checked. The amount the order needs is moved from the user's available balance to in orders with a guarded update (it can't go below zero), and the order is saved with what it holds. An OCO saves two orders sharing one hold.
- Matching. The order is matched straight away by price, then time, against the platform's book and the liquidity provider's mirrored levels as one book (stop-limit orders wait for their stop price instead). See Spot trading → How orders are matched.
- Trades are recorded. Each fill creates the two trade rows, moves funds between the wallets and takes the maker or taker fee by role.
- The rest. A limit order that isn't fully filled stays in the book (IOC / FOK / market orders don't). The
order-processorfills resting orders later if the liquidity provider's price moves through them;orders:trigger-stopsand every trade trigger waiting stop orders. - Live updates. After the transaction is saved, order-book, trade, price and wallet events go onto the
orderbook,marketandeventsqueues. Horizon sends them to Soketi, and every open trade page updates within moments.
Two front-end bundles, one theme system
The browser code is built twice from the same source:
- the visitor bundle (
public/frontend/) for everyone without theadminrole, and - the admin bundle (
public/alternative/), which adds the admin panel and is loaded for admins on every page.
Both use the same page templates: each template is looked up in resources/js/Themes/prime first, then resources/js/Themes/default. Visitors can pick light, dark or system theme; the colour palette is Gold (set with UI_PALETTE). See Building assets and Languages & themes.
Plans
APP_PLAN in .env sets which product package is active. With APP_PLAN=5 (the value in .env.example) the platform also runs the futures, P2P and options background processors and shows plan-5 admin features such as cold storage.
Optional modules
Some modules are switched on in .env:
| Module | Switch |
|---|---|
| Lending | LENDING_ENABLED=true |
| Merchant payments | MERCHANT_ACQUIRING_ENABLED=true |
| Rust matching engine | MATCHING_ENGINE_ENABLED=true |
| Card on-ramp (Buy crypto) | UNLIMIT_ENABLED=true |
| Sumsub KYC | SUMSUB_ENABLED=true |
| Fireblocks custody | FIREBLOCKS_ENABLED=true |
| Deposit bonuses | DEPOSIT_BONUS_ENABLED=true |
All of them are explained in Environment (.env).
