StatsHub Docs
General

Data

Browser fetching, Next.js API routes, Postgres, and the Go replacement.

Browser code normally reads /api/* with SWR. The shared configuration in src/pages/_app.tsx deduplicates requests and revalidates on focus and reconnect.

Handlers in src/pages/api use the Drizzle client in src/db, external providers, and Supabase session data. The web server therefore requires DATABASE_URL.

The Go API in apps/api replaces these handlers route by route. Check the generated port ledger and contract suite before changing a caller:

  • The web API is the compatibility reference.
  • Go responses preserve fields and status codes used by clients.
  • Expo consumes the versioned HTTP API; it does not import web code.