How central-co/triagen-web works
Project type and purpose
• This is a single-page web application built with Vite + React + TypeScript.
• It serves as a candidate interviewing dashboard (“triagen-web”) that:
• Uses Supabase for authentication, database, migrations, and an Edge Function for central config.
• Calls an external API (via the API_URL variable) to start interviews.
• Connects to LiveKit over WebSocket for real-time audio/video in interview rooms.
File structure
• Top-level files:
• package.json, tsconfig.*, vite.config.ts — build/tooling
• netlify.toml — deployment target
• .env.example — local supabase + optional API/LIVEKIT/RECAPTCHA fallbacks
• src/ directory:
• src/main.tsx + src/index.css — app entrypoint
• src/App.tsx — root layout & routing
• src/components/… — React page & UI components (LandingPage, LoginPage, Dashboard pages, InterviewRoom, etc.)
• src/hooks/… — custom hooks for auth, config loading, dashboard stats, dark mode, audio levels
• src/api/interview/start.ts — client call to your interview-start endpoint
• src/integrations/supabase — Supabase client + type definitions
• src/utils — cross-cutting utilities (apiSecurity, config)
• supabase/ directory:
• config.toml + migrations/*.sql — database schema & migrations for your Postgres instance
Key architectural insights from README
• Hybrid config: first load from your “get-app-config” Edge Function on Supabase, fallback to local .env in dev.
• No server-side code in this repo beyond API calls: the actual interview logic lives in a separate API server (API_URL).
• Real-time comms: LiveKit for websockets (LIVEKIT_URL).
Main components
a. Frontend SPA (Browser)
• React/Vite bundle deployed on Netlify (index.html + JS/CSS).
• Core UI: Login, Landing, Dashboard, InterviewRoom, NotFound.
• hooks & utils for state/config.
b. Supabase Services (Cloud)
• Auth service (sign-in, tokens).
• Postgres Database (candidates, jobs, reports…).
• Edge Function “get-app-config” (dynamic config endpoint).
• Migrations (managed separately via supabase migrations folder).
c. External Interview API
• Exposed at API_URL, used by src/api/interview/start.ts to initiate interview sessions.
d. LiveKit Real-Time Server
• WebSocket endpoint at LIVEKIT_URL for audio/video sessions.
e. Optional reCAPTCHA service (if enabled).
Relationships & data flows
1) Browser loads the SPA from Netlify.
2) On startup:
• SPA calls Supabase Edge Function (get-app-config) → returns API_URL, LIVEKIT_URL, RECAPTCHA_KEY.
• Falls back to VITE_* env vars if Edge Function is unreachable (development only).
3) User logs in via Supabase Auth (browser ↔ Supabase Auth API).
4) After auth:
• Browser queries Supabase Postgres for dashboard data (jobs, candidates, reports) through the Supabase client.
5) When user starts an interview:
• Browser calls API_URL/interview/start → external Interview API.
• Browser connects to LiveKit at LIVEKIT_URL via WebSocket for real-time media.
6) Real-time events flow over LiveKit; post-interview results can be written back to Supabase DB via the Supabase client or external API.
Architectural patterns & design principles
• Single-Page Application (SPA) with clear separation:
• Presentation (React components under src/components).
• State & side-effects (custom hooks under src/hooks).
• Integration layer (src/integrations & src/api).
• Utilities/config (src/utils).
• Hybrid configuration loading (Edge Function first, fallback env).
• Service-oriented: offload identity (Supabase Auth), storage (Supabase DB), real-time (LiveKit), business logic (external API).
Final checklist
• [ ] Clear component labels and grouping.
• Frontend (blue rectangles)
• Backend services (yellow clouds)
• External services (orange clouds)
• [ ] Notes on dynamic config loading order (Edge Function → env).