A full-stack trading platform where users long or short the net carry between DeFi yield rates and borrow costs — powered by live Pendle and Aave feeds, simulated at 1200× speed.
Three-tier system: React SPA → Hono backend → External DeFi data sources. Real-time data flows via Server-Sent Events from a single persistent stream.
Turborepo + Bun workspace with three packages: shared types at the base, API and frontend as consumers.
Backend server — handles auth, markets, real-time rate streaming, and order execution with a 1s liquidation loop.
Single-page app — AuthGuard routing, live spread chart, position management, all state via Zustand + SSE.
Shared contract between API and frontend — types and market config consumed by both packages.
All external fetching happens server-side. The frontend never calls DeFi APIs directly — data arrives via SSE.
| Source | What's Fetched | Freq | Market |
|---|---|---|---|
| Pendle Finance API | Implied APY for PT-sUSDe-7May26 |
~30s | usdc-susde-aave |
| Aave V3 GraphQL | Variable borrow APY + utilization for USDe |
~30s | usdc-susde-aave |
| Aave V3 GraphQL | Variable borrow APY + utilization for WETH |
~30s | eth-steth-aave |
PostgreSQL via Drizzle ORM. Four tables covering auth, market state, and positions. Key constraint: one active position per user per market.
filled order per user per market.Two main flows drive the platform: the real-time SSE stream, and the order lifecycle from placement through liquidation.
Turborepo orchestrates parallel builds. Production on Railway — backend serves the frontend SPA as static files with fallback routing.
Lean, modern full-stack: Bun runtime throughout, Hono for edge-ready API, Zustand for lightweight client state.