# sahilgiri49/fire-free-arena-hub architecture

> Architecture diagram of the GitHub repository sahilgiri49/fire-free-arena-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahilgiri49/fire-free-arena-hub
- Repository: https://github.com/sahilgiri49/fire-free-arena-hub

## Overview

##### Project type and purpose
- This is a full-stack single-page web application. The front end is a React + TypeScript SPA built with Vite, Tailwind CSS and shadcn-ui. The back end is provided as a Backend-as-a-Service via Supabase (authentication, database, real-time, storage).
- The app delivers tournament, team, news and live-stream features, plus an admin dashboard for managing those resources.

##### File structure
- Top-level:
- package.json, vite.config.ts, tsconfig.*.json, tailwind.config.ts – front-end build and config.
- public/ – static assets (HTML shell, robots.txt).
- supabase/ – Supabase config.toml and SQL migrations (defines your database schema).
- src/:
- main.tsx – SPA entry point.
- App.tsx / App.css – root component.
- components/ – reusable UI and domain-specific components (hero, leaderboard, tournament cards…).
- components/ui/ – shadcn-ui primitives (buttons, dialogs, tables, etc.).
- context/AuthContext.tsx – React context for auth state.
- hooks/ – custom hooks (mobile detection, toast).
- integrations/supabase/ – Supabase client setup and types.
- pages/ – route components (Index, News, Teams, Tournaments, Profile, plus admin sub-folder).
- lib/utils.ts – utility functions.

##### README for additional insights
- Confirms tech stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS.
- Mentions deployment and domain setup via Lovable (the hosting platform).

##### Elements
- Clear labels for each component or group.
– Asset requests (Browser → CDN)
– API calls & real-time subscriptions (SPA ↔ Supabase)
– Migration deployment (DevOps → Supabase DB)
– Another for external systems (e.g., gray)
- Separate user flows for normal users vs. admin users.

##### Detailed but not over-engineered
- Supabase features distinctly (Auth vs. DB vs. Real-time).
- Build/deploy step (Vite → static assets → Lovable CDN).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User and CDN
    Browser["User's Browser"]:::external
    CDN["Static Hosting / CDN\n(Lovable)"]:::external
    Browser -->|"Request assets"| CDN

    %% Frontend Layer
    subgraph "Frontend SPA" 
        direction TB
        Entry["Entry Point\nsrc/main.tsx"]:::frontend
        AppComp["Root App\nsrc/App.tsx\nsrc/App.css"]:::frontend
        UILayer["UI Layer\nshadcn-ui + Tailwind"]:::frontend
        Comp["Domain Components\nsrc/components/"]:::frontend
        AuthCtx["Auth Context\nsrc/context/AuthContext.tsx"]:::frontend
        Protected["ProtectedRoute\nsrc/components/auth/ProtectedRoute.tsx"]:::frontend
        Hooks["Custom Hooks\nsrc/hooks/"]:::frontend
        Integr["Supabase Integration\nclient & types"]:::frontend
        Utils["Utility Functions\nsrc/lib/utils.ts"]:::frontend
        Pages["Page Routes\nsrc/pages/"]:::frontend
        AdminPages["Admin Dashboard\nsrc/pages/admin/"]:::frontend

        Entry --> AppComp
        AppComp --> UILayer
        AppComp --> Comp
        AppComp --> AuthCtx
        AppComp --> Protected
        AppComp --> Hooks
        AppComp --> Integr
        AppComp --> Utils
        AppComp --> Pages
        Pages --> AdminPages
    end

    CDN -->|"Serve SPA"| Entry

    %% Supabase BaaS
    subgraph "Supabase Services" 
        direction TB
        Auth["Auth Service"]:::backend
        DB["Database"]:::backend
        Realtime["Real-time"]:::backend
    end

    %% Connections between SPA and Supabase
    AppComp -->|"Auth API calls"| Auth
    AppComp -->|"DB queries & mutations"| DB
    AppComp -->|"Real-time subscriptions"| Realtime

    %% External Streaming Service
    ExternalStream["External Streaming Service"]:::external
    AppComp -->|"Embed/Fetch streams"| ExternalStream

    %% DevOps / Migrations
    subgraph "DevOps Artifact" 
        direction TB
        ConfigToml["Supabase Config\nsupabase/config.toml"]:::devops
        Migrations["SQL Migrations\nsupabase/migrations/20240318000000_create_teams_tables.sql"]:::devops
    end
    Migrations -->|"Schema deploy"| DB
    ConfigToml --> DB

    %% Class Definitions
    classDef frontend fill:#cce5ff,stroke:#999;
    classDef backend fill:#d4edda,stroke:#999;
    classDef devops fill:#ffeeba,stroke:#999;
    classDef external fill:#e2e3e5,stroke:#999;

    %% Click Events
    click Entry "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/main.tsx"
    click AppComp "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/App.tsx"
    click UILayer "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/tailwind.config.ts"
    click UILayer "https://github.com/sahilgiri49/fire-free-arena-hub/tree/main/src/components/ui/"
    click Comp "https://github.com/sahilgiri49/fire-free-arena-hub/tree/main/src/components/"
    click AuthCtx "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/context/AuthContext.tsx"
    click Protected "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/components/auth/ProtectedRoute.tsx"
    click Hooks "https://github.com/sahilgiri49/fire-free-arena-hub/tree/main/src/hooks/"
    click Integr "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/integrations/supabase/client.ts"
    click Integr "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/integrations/supabase/types.ts"
    click Utils "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/src/lib/utils.ts"
    click Pages "https://github.com/sahilgiri49/fire-free-arena-hub/tree/main/src/pages/"
    click AdminPages "https://github.com/sahilgiri49/fire-free-arena-hub/tree/main/src/pages/admin/"
    click CDN "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/public/index.html"
    click CDN "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/public/robots.txt"
    click ConfigToml "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/supabase/config.toml"
    click Migrations "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/supabase/migrations/20240318000000_create_teams_tables.sql"
    click CDN "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/vite.config.ts"
    click CDN "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/package.json"
    click CDN "https://github.com/sahilgiri49/fire-free-arena-hub/blob/main/tsconfig.json"
```
