1
Home
Claude edited this page 2026-04-03 11:12:45 +01:00
Table of Contents
Lethean Trade DEX Backend
The trade backend is the server-side component of the Lethean decentralised exchange. It is a Node.js / TypeScript REST API that manages the order book, facilitates peer-to-peer trades, and coordinates on-chain swap operations for Lethean and its registered assets.
What It Provides
- Order book -- create, cancel, and browse buy/sell orders across any asset pair where LTHN is the quote currency.
- P2P trade flow -- real-time chat, deposit tracking, and transaction confirmation between counterparties via Socket.IO.
- Swap operations -- on-chain settlement backed by the Lethean daemon and wallet RPC endpoints.
- Asset discovery -- automatic import of assets from the Lethean explorer, with whitelist enforcement from
api.lethean.io. - Market statistics -- 24-hour volume, price change, TVL, candlestick data, and per-asset stats.
- Admin panel -- manage administrators, featured pairs, and inspect orders/users.
Architecture
+-------------+ +-------------------+ +-----------------+
| Frontend | <---> | Trade Backend | <---> | PostgreSQL |
| (WebSocket) | | (Express + WS) | | (Sequelize) |
+-------------+ +-------------------+ +-----------------+
|
v
+-------------------+
| Lethean Daemon |
| (RPC: json_rpc) |
+-------------------+
|
v
+-------------------+
| Lethean Wallet |
| (RPC: json_rpc) |
+-------------------+
The backend is a single Express application that mounts all routes under /api (and /api/admin for privileged operations). A Socket.IO server runs on the same HTTP server for real-time order and chat notifications.
Technology Stack
| Component | Detail |
|---|---|
| Runtime | Node.js (ESM, tsx) |
| Language | TypeScript |
| Framework | Express 4 |
| Database | PostgreSQL via Sequelize 6 |
| Real-time | Socket.IO 4 |
| Auth | JWT (wallet signature verification) |
| Rate limiting | express-rate-limit (6000 req / 10 min) |
Quick Links
- Setup -- Docker deployment and local development
- API -- REST endpoint reference
- Configuration -- Environment variables