⬅️ Back to Domains Index

Home Domain

This domain covers the public landing page for the root route (/) implemented under frontend/src/pages/home.

1️⃣ Domain Purpose

The Home domain is a thin entry hub that: - redirects authenticated users straight into the app (/dashboard) - gives unauthenticated users two clear paths: - Sign in/login - Continue in Demo Mode → starts a client-only demo session and continues into the app

It intentionally keeps the unauthenticated UI minimal and avoids any direct backend calls.

2️⃣ Scope & Boundaries

Included: - Home.tsx (root landing page orchestrator) - Redirect behavior based on auth state (useAuth(): { user, loading }) - Demo entry via useAuth().loginAsDemo() - Public-route placement (outside AppShell)

Excluded: - Login UI + OAuth redirect: see Auth domain - Auth state and hydration rules: see Auth Context - Routing topology: see Routing - App chrome (AppBar/Drawer/Main): see App Shell

3️⃣ High-Level Diagram

flowchart TD Route["/" route] --> Home[Home.tsx] Home -->|loading=true| Spinner[Centered spinner] Home -->|user != null| DashNav[] Home -->|user == null| Card[Landing card] Card --> SignIn[Button: navigate("/login")] Card --> Demo[Button: loginAsDemo(); navigate("/dashboard", replace)] SignIn --> Login[/login] Demo --> Dashboard[/dashboard]

4️⃣ Domain Notes (Implementation-facing)

  • Home is a pure UI router:
    • no HTTP requests
    • no React Query usage
    • only depends on the AuthContext state and actions
  • Auth bootstrap is respected:
    • while loading=true, Home renders a spinner to avoid flicker/incorrect redirects.
  • Demo entry behavior:
    • loginAsDemo() persists a demo user in localStorage so deep-links and refreshes remain usable.
    • After starting demo, the app route entry is the same as real users: /dashboard.

5️⃣ Domain Map (Deep-dives)

Leaf docs for how Home works:


⬅️ Back to Domains Index