Skip to main content

Architecture Overview

HostMetrics is a monolithic Next.js 15 application deployed on Vercel, with Supabase as the backend-as-a-service and AWS Lambda for background toll scraping jobs.

System Diagram

Service Responsibilities

Key Design Decisions

  1. No global state library — React hooks + Context API are sufficient. Custom hooks in src/hooks/ encapsulate all data fetching.
  2. All DB queries filter by user_id — Multi-tenant isolation at the query level, backed by Supabase RLS.
  3. CSV as primary data format — Turo exports CSVs; toll agencies export CSVs. The import pipeline handles both.
  4. Client-side Supabase — Most DB calls happen directly from the browser using the Supabase JS client (with anon key + RLS). API routes are used only for server-side operations (webhooks, toll sync, extension auth).