// Crypto Exchange is a high-performance crypto exchange supporting spot trading across 150+ assets with secure deposits/withdrawals on multiple chains.
Overview:
Crypto Exchange is a high-performance crypto exchange supporting spot trading across 150+ assets with secure deposits/withdrawals on multiple chains (e.g., Ethereum, TON, BSC, Polygon, Tron, Polkadot). The platform blends a modular microservices backend with a scalable frontend architecture to deliver real-time order books, portfolio management, KYC/AML workflows, and institutional-grade APIs for partners and market makers.
My Role:
Led backend architecture & system design: service decomposition, domain boundaries, data models, reliability/SLOs.
Led frontend architecture: React/Next.js app structure, performance budgets, data loading strategy, and design system integration.
Designed the exchange core: order intake, matching integration, account balances, ledger, and settlement flows.
Built the Blockchain Integration Layer: chain adapters, deposit listeners, confirmation policies, fee estimation, sweeping, and withdrawal orchestration.
Designed the Wallet Architecture: hot/cold segregation, automated sweeping, multi-sig/HSM/KMS strategy, address management, and risk controls.
Auth & Security: OAuth2/JWT, 2FA, device/session security, IP/rate-limit, signed requests (HMAC), and per-scope API keys.
Public & Partner APIs: REST + WebSocket market data; authenticated trading, wallet, and account endpoints; GraphQL for complex portfolio queries.
Compliance & Risk: KYC tiers, withdrawal holds, address risk scoring hooks, transaction screening, and audit trails.
Observability: centralized structured logging, metrics, tracing, alerting, and runbooks for incident response.
Technologies:
Node.js, TypeScript, NestJS/Express, Kafka, Redis, PostgreSQL (core ledgers), MongoDB (accounts/profile), ClickHouse/Elastic (analytics & search), React, Next.js, React Query, Tailwind CSS, shadcn/ui, WebSocket, GraphQL, Docker, Kubernetes, Nginx, Terraform, Vault/KMS/HSM
Architecture Highlights:
Microservices by domain: gateway, auth, users, wallets, deposits, withdrawals, quotes, orders, matching-adapter, balances/ledger, markets, notifications, compliance.
Event-driven backbone with Kafka: deposits detected → credited after confirmations; withdrawals requested → queued → signed → broadcasted → settled.
Matching Engine Integration: low-latency order intake via gRPC/WebSocket to matching service; balance locks and atomic settlement against the internal ledger.
Wallet/Chain Adapters: unified interface for UTXO/account-based chains; per-chain confirmation rules, gas/fee estimation, nonce management, mempool re-broadcast, and stuck-tx recovery.
Hot/Cold Key Management: hot wallets for real-time ops with tight limits; automated sweeping to cold storage; support for multi-sig and hardware KMS/HSM.
Real-time Client Experience: streaming order books, trades, and balances via WebSocket; optimistic UI updates with server reconciliation.
API Design:
REST for standard resources (/orders, /balances, /withdrawals).
WebSocket for market streams (/ws/market, /ws/user).
GraphQL for aggregated portfolio/analytics views.
HMAC-SHA256 signed requests, nonce/ts headers, per-endpoint rate limits, and API key scopes.
Reliability: idempotent endpoints, outbox/inbox pattern for exactly-once publishing, retries with backoff, circuit breakers, sagas for long-running ops.
Data:
PostgreSQL: double-entry ledger (journal, postings) for balances & settlements.
Redis: price caches, session tokens, rate limits, order book snapshots.
ClickHouse: time-series market data & analytics.
Compliance: KYC tiers (L1–L3), proof-of-funds checks, travel-rule hooks (pluggable), configurable withdrawal cooling-off, and address screening providers.
Challenges & Achievements:
Delivered deterministic balance accounting via a double-entry ledger with auditability and replay.
Built multi-chain deposit detection with resilient listeners and reorg handling; configurable confirmations per asset.
Reduced withdrawal errors via pre-flight simulation (fee/nonce/gas) and asynchronous signing queues.
Achieved sub-second market latency to UI using WebSocket multiplexing and lightweight state normalization.
Implemented tenant-ready partitioning (brands/regions) to support future white-label and geo data residency.
Migrated market/portfolio pages to React/Next.js + React Query, cutting bundle size and improving TTI.