Architecture
Tech Stack
| Layer | Technology |
|---|---|
| Framework | Next.js (App Router, Turbopack); ISR revalidation per page (30 or 60 minutes) |
| Language | TypeScript (strict) |
| Styling | Tailwind CSS v4 with @theme inline design tokens |
| UI Primitives | Base UI (not Radix); wrapped with custom Tailwind classes |
| Charts | Recharts 3, wrapped in shadcn-style ChartContainer / ChartTooltip |
| Database | PostgreSQL, accessed via a typed query() wrapper |
| On-chain reads | Raw eth_call against public RPC (current state) and a dRPC archive endpoint (historical blocks), plus DefiLlama for prices and block-by-timestamp |
| Fonts | Geist Sans (prose), Geist Mono (numerics), JetBrains Mono (logo) |
Pages are server components by default. Client components are isolated to interactivity that genuinely requires the browser: table sorting/filtering, accordion expansion, chart time-range selection, legend toggling, the carry trade simulator, and the lazy-loaded oracle tab. The split keeps server-rendered HTML clean for SEO and avoids shipping chart libraries in the initial bundle.
Project Layout
src/
app/
page.tsx # Asset Coverage
carries/page.tsx # Carry Strategies
strategies/page.tsx # Managed Strategies
money-market-rates/page.tsx# Money Market Rates
api/
carry-oracle/ # GET oracle report for a carry strategy
sim/swap-cost/ # POST 0x execution-cost quote for the simulator
notify-capacity/ # POST capacity-alert email capture
newsletter/subscribe/ # POST newsletter signup
components/
assets/ # AssetsTable, YieldHistoryChart, IssuerIcon
carries/ # CarriesTable, CarryChart, OraclePanel, BorrowCapacityChart, CapacityTightPanel
strategies/ # StrategiesTable, StrategyChart, ComparisonChart, TvlChart, UsdVaultRows
money-market/ # MoneyMarketTable, MoneyMarketRateChart
icons/ # ProtocolIcons, TokenIcons
layout/ # AppSidebar, MobileNav, TerminalSectionHeader
ui/ # Base UI wrappers (Button, Card, Tooltip, etc.)
data/
asset-narratives.ts # Per-asset yield-mechanism narrative copy
lib/
data/
apy.ts # Canonical annualisation + index-ratio math
carries-table.ts # Carry strategy readers + distributional stats
strategies-table.ts # Managed vault share-rate readers
assets-table.ts # Asset coverage table reader
money-market-rates.ts # Money market supply-rate reader
oracles.ts # Per-strategy oracle config + live reads (oracle tab)
sofr.ts # SOFR index reader
vault-capacity.ts # Fluid / Aave borrow-cap reader
vault-risk.ts # Max-LTV / liquidation-threshold reader
prices.ts / llama-prices.ts # DefiLlama USD price fetchers
rpc.ts # eth_call / archive / storage / block-by-ts helpers
sim/
leveraged-position.ts # Buy-and-hold leveraged carry simulator
format.ts # fmtUsd / fmtPct / fmtBps / fmtNumber
seo.ts # Canonical URLs, structured data
scripts/
refreshers/ # Off-chain ingestion jobs (see Data Pipeline)
sync-fluid-vaults.ts # Ad-hoc Fluid vault coverage sync (registry)
refresh-*.ts / backfill-*.ts # Cron entry points + one-off history backfillsDatabase Schema (PostgreSQL, onchain_credit schema)
All time-series data is ingested by off-chain refresher scripts (see Data Pipeline) and stored in the onchain_credit schema. The application is read-only against these tables; the only rows the app itself writes are user signups (newsletter_subscribers, capacity_notifications) via API routes.
| Table | Cadence | Contents |
|---|---|---|
token_yield_apy | 6h | Share-rate snapshots for yield-bearing wrappers (sUSDe, sUSDS, syrupUSDC, syrupUSDT, reUSD, wstETH, weETH, rETH, tETH, osETH, ezETH, plus the managed-vault share tokens) |
fluid_ll_apy | 6h | Fluid Liquidity Layer supply/borrow exchange-price snapshots per token |
fluid_dex_apy | 6h | Fluid DEX pool snapshots: fee APY, smart-col/smart-debt TVL split, per-token weights |
aave_v3_reserve_apy | 6h | Aave v3 reserve supply/borrow index snapshots (RAY-scaled liquidity/borrow index) |
sparklend_reserve_apy | 6h | SparkLend reserve supply/borrow index snapshots (Aave v3 fork, separate pool/table) |
fluid_ll_apy_daily, fluid_dex_apy_daily | Daily rollup | Daily-resolution copies the carry charts read on the 6M / 1Y / YTD views |
vault_risk_params | Weekly | Per-strategy max-LTV + liquidation threshold, with changed_at audit |
vault_capacity | Weekly | Per-strategy borrow-cap / supply-cap headroom |
sofr_rates | Daily | SOFR overnight rate + compounded 30d/90d/180d averages + the compounding index (NY Fed) |
assets | Daily | Top-level asset-coverage metrics: APY, 1M/YTD/1Y returns, market cap |
fluid_vault_registry | Ad-hoc sync | Auto-discovered Fluid vaults with a coverage status (see Carry Strategies) |
newsletter_subscribers, capacity_notifications | App-write | Email captures from the newsletter banner and capacity-alert form |