Skip to content

Architecture

Tech Stack

LayerTechnology
FrameworkNext.js (App Router, Turbopack); ISR revalidation per page (30 or 60 minutes)
LanguageTypeScript (strict)
StylingTailwind CSS v4 with @theme inline design tokens
UI PrimitivesBase UI (not Radix); wrapped with custom Tailwind classes
ChartsRecharts 3, wrapped in shadcn-style ChartContainer / ChartTooltip
DatabasePostgreSQL, accessed via a typed query() wrapper
On-chain readsRaw eth_call against public RPC (current state) and a dRPC archive endpoint (historical blocks), plus DefiLlama for prices and block-by-timestamp
FontsGeist 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 backfills

Database 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.

TableCadenceContents
token_yield_apy6hShare-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_apy6hFluid Liquidity Layer supply/borrow exchange-price snapshots per token
fluid_dex_apy6hFluid DEX pool snapshots: fee APY, smart-col/smart-debt TVL split, per-token weights
aave_v3_reserve_apy6hAave v3 reserve supply/borrow index snapshots (RAY-scaled liquidity/borrow index)
sparklend_reserve_apy6hSparkLend reserve supply/borrow index snapshots (Aave v3 fork, separate pool/table)
fluid_ll_apy_daily, fluid_dex_apy_dailyDaily rollupDaily-resolution copies the carry charts read on the 6M / 1Y / YTD views
vault_risk_paramsWeeklyPer-strategy max-LTV + liquidation threshold, with changed_at audit
vault_capacityWeeklyPer-strategy borrow-cap / supply-cap headroom
sofr_ratesDailySOFR overnight rate + compounded 30d/90d/180d averages + the compounding index (NY Fed)
assetsDailyTop-level asset-coverage metrics: APY, 1M/YTD/1Y returns, market cap
fluid_vault_registryAd-hoc syncAuto-discovered Fluid vaults with a coverage status (see Carry Strategies)
newsletter_subscribers, capacity_notificationsApp-writeEmail captures from the newsletter banner and capacity-alert form

Private documentation. creddit.xyz