Build map

What runs where

High-level map of the Next.js app, the desk, listings, contracts, telemetry, and the money rail. Read this before adding a page.

GigRentals is a Next.js 16 App Router monolith. proxy.ts (not middleware.ts) is the edge gate. Demo state is a cookie delta plus `.data/` blobs for photos and device snapshots. Production swaps adapters: Postgres, Redis, Stripe, Supabase Auth/Storage.

Technologies

LayerWhatWhere
WebNext.js 16 App Router + React 19app/, components/
AuthDemo cookie or Supabase OAuth (Google/Apple)actions/auth.ts, app/auth/callback
Desk RBACStaff roles, no in-app walletlib/security/desk.ts
ListingsHost CRUD + JPEG storeactions/listings.ts, .data/listings
MoneyInteger-cent ledger + Stripe Connect + program booksbackend/payments, lib/stripe.ts, lib/reporting/books.ts
MailResend or .data/mail.jsonlib/mail/send.ts, /admin/mail
TelematicsVendor catalog + webhooklib/telematics/, /admin/telematics
MatchH3 lookup + Hungarianbackend/dispatch
FormsFloating labels + Zodcomponents/ui/floating-field.tsx, lib/validations.ts
TelemetryCommon browser APIscomponents/telemetry/beacon.tsx
DocsThis site, generated from TypeScriptlib/docs/pages.ts

Pages and who they are for

PathPersonaJob
/PublicTwo doors: idle car vs $25/day driver
/join, /drivers/startAd clickOAuth Google/Apple then apply
/owners/apply → /owners/agreementHost applicantQuote then UETA signature
/owners/garageApproved hostUpload car, photos, money metrics, checkout status
/cars/[slug]LesseeFull booking page: story, specs, icons, book
/drivers/applyDriver applicantJob application, then program + signature
/rankingsPublicHost occupancy / driver care — no dollars
/adminDeskQueues, devices, ranks. Stripe link, not balances
/admin/incomeDesk finance/opsProgram books that match owner + driver
/admin/telematicsDesk opsTracker vendor catalog + hook status
/admin/mailDeskDemo transactional outbox
/owners/earningsHostHost net from the same books file
/drivers/earningsLesseeWhat they paid — same identity
/owners/monitorHostNeighborhood pings, vendor-agnostic
/forgot-password, /verify-emailPublicRecovery + confirm
/docsEngineers / investorsLive server documentation

Critical systems

  • Auth — demo cookie or Supabase. Google/Apple OAuth. Lockout, HIBP, IP throttle in lib/security/guard.ts.
  • Desk — editor/reviewer/ops/finance/support/superadmin. finance gets desk:stripe (a URL), never amounts.
  • Listings — ownerId, miles, VIN last 6, photos on disk. Delete photo / delete car. Public only if available.
  • Contracts — booking, owner-program, listing, driver-lease. Typed name + initials + checkbox = UETA.
  • Telemetry — UA hints, language, cores, deviceMemory, connection, screen, timezone, storage.estimate. No GPS prompt.
  • Rankings — occupancy, inspection, care, on-time. Public. Desk can sort people by the same scores.
  • Money — Stripe Connect is the wallet. Admin accounting is a deep-link. Program books (owner/driver/admin) live in lib/reporting/books.ts and must balance.
  • Mail — hashed verify/reset tokens, welcome + reset transactional mail, Resend when keyed.
  • Telematics — one adapter, 19 vendors with public APIs, webhook at /api/v1/fleet/telematics.

How files are annotated

Critical modules start with an @docs comment naming the system (listings, telemetry, desk, money, forms, storage). If you add a loop, add a row here and a @docs block on the file.