# jitenverma076/talent-arc architecture

> Architecture diagram of the GitHub repository jitenverma076/talent-arc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jitenverma076/talent-arc
- Repository: https://github.com/jitenverma076/talent-arc

## Overview

##### Project type and purpose
- TalentArc is a single-page web application (SPA) built with React and Vite that matches technical candidates to companies via skill-based challenges.
- It leverages Firebase for authentication and data storage (Firestore) and Google Gemini AI for candidate analysis.

##### File structure
- src/
- components/ – Reusable UI components (Navbar, Footer, AuthModal, ThemeToggle, etc.)
- pages/ – Route-level components (Home, Dashboard, Challenges, Companies, Profile, AdminDashboard, etc.)
- context/ – React Context providers (AuthContext, ModalContext)
- hooks/ – Custom hooks (useAuth)
- lib/ – Abstractions over Firebase (auth.js, firestore.js) and utility functions
- utils/ – Static or demo data (candidateData.js)
- assets/ – Images and static files for the UI
- main.jsx & App.jsx – Application entry point and root layout
- Public folder & index.html – Static host file
- Configuration files – Vite, Tailwind, ESLint, .env.example
- firestore.rules – Security rules for Firestore

##### Key architectural insights from README
- Tech stack: React 19 (Vite + Tailwind CSS), Firebase Auth + Firestore, Google Gemini AI (fallback to statistical analysis)
- Authentication & API integration points: Firebase SDK, HTTP calls to Gemini AI
- No separate “backend” service other than Firebase and external AI

##### Main components
a. Client SPA (React/Vite)
- UI Layer: Pages, Components, Context Providers, Hooks
- Routing & Protected Routes
b. Firebase services
- Authentication (Email/Password)
- Firestore (Challenges, Users, Results)
- Firestore Security Rules
c. External AI Service
- Google Gemini AI API (via REST/HTTPS)
- Fallback statistical analysis module (in src/lib/utils.js)
d. Build & Deployment
- Vite Dev Server & Production Build
- Hosting (e.g., Firebase Hosting or any static host)

##### Relationships & interactions
- The SPA renders pages and components, uses AuthContext to manage user sessions.
- On login/register flows, it calls Firebase Auth SDK.
- Authenticated sessions fetch user and challenge data from Firestore.
- Submissions or candidate profiles trigger calls to Gemini AI API.
- AI responses are stored/displayed via Firestore or in-memory state.
- UI responds to data via React state and Context.

##### Architectural patterns & design principles
- SPA (client-heavy) with thin “backend” (Firebase) and pluggable AI service
- Separation of concerns:
- UI components (pure presentation)
- Context for global state (Auth, Modal)
- Hooks for logic reuse (useAuth)
- lib/ for service abstraction (firebase.js, firestore.js, auth.js)
- Protected routes & error boundaries for resilience
- Configurable via .env for different environments

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client SPA
    subgraph "Client SPA"
        direction TB
        Main["main.jsx"]:::frontend
        App["App.jsx"]:::frontend

        subgraph "UI Layer"
            direction TB
            Navbar["Navbar"]:::frontend
            Footer["Footer"]:::frontend
            AuthModal["AuthModal"]:::frontend
            ThemeToggle["ThemeToggle"]:::frontend
            ProtectedRoute["ProtectedRoute"]:::frontend
            ErrorBoundary["ErrorBoundary"]:::frontend
            ThemeProvider["ThemeProvider"]:::frontend
            UserProfile["UserProfile"]:::frontend
            Button["Button"]:::frontend
        end

        subgraph "Pages"
            direction TB
            Home["Home"]:::frontend
            Dashboard["Dashboard"]:::frontend
            Challenges["Challenges"]:::frontend
            Companies["Companies"]:::frontend
            Candidates["Candidates"]:::frontend
            Profile["Profile"]:::frontend
            AdminDashboard["AdminDashboard"]:::frontend
            Login["Login"]:::frontend
            Register["Register"]:::frontend
            SignIn["SignIn"]:::frontend
            Unauthorized["Unauthorized"]:::frontend
            NotFound["NotFound"]:::frontend
            HowItWorks["HowItWorks"]:::frontend
            Contact["Contact"]:::frontend
        end

        subgraph "State Management"
            direction TB
            AuthContext["AuthContext"]:::frontend
            ModalContext["ModalContext"]:::frontend
            useAuth["useAuth"]:::frontend
        end

        subgraph "Service Layer"
            direction TB
            FirebaseInit["firebase.js"]:::frontend
            AuthLib["auth.js"]:::frontend
            FirestoreLib["firestore.js"]:::frontend
            UtilsLib["utils.js"]:::frontend
        end
    end

    %% External Services
    FirebaseAuth["Firebase Auth\nauth(firebase.google.com)"]:::cloud
    Firestore["Firestore\n(firestore.googleapis.com)"]:::cloud
    Gemini["Google Gemini AI API"]:::ai
    StatFallback["Statistical Analysis\n(src/lib/utils.js)"]:::ai
    Hosting["Hosting\n(Firebase Hosting/CDN)"]:::cloud
    FirestoreRules["firestore.rules"]:::infra
    Config["Config Files\n(.env.example, vite.config.js, tailwind.config.js)"]:::infra

    %% Data Flows
    Main --> App
    App -->|renders| Navbar
    App -->|renders| Footer
    App -->|"opens modals"| AuthModal
    App -->|"toggles theme"| ThemeToggle
    App -->|"protects routes"| ProtectedRoute
    App -->|"catches errors"| ErrorBoundary
    App -->|"provides theme"| ThemeProvider
    App -->|route| Home
    App -->|route| Dashboard
    App -->|route| Challenges
    App -->|route| Companies
    App -->|route| Candidates
    App -->|route| Profile
    App -->|route| AdminDashboard
    App -->|route| Login
    App -->|route| Register
    App -->|route| SignIn
    App -->|route| Unauthorized
    App -->|route| NotFound
    App -->|route| HowItWorks
    App -->|route| Contact

    Home --> AuthContext
    Dashboard --> AuthContext
    Challenges --> AuthContext
    Companies --> AuthContext
    Candidates --> AuthContext
    Profile --> AuthContext
    AdminDashboard --> AuthContext

    AuthContext -->|uses| useAuth
    useAuth -->|calls| AuthLib
    AuthLib -->|calls| FirebaseAuth
    App -->|fetches data| FirestoreLib
    FirestoreLib -->|reads/writes| Firestore
    Challenges -->|submit profile| UtilsLib
    UtilsLib -- "fallback" --> StatFallback

    Challenges -->|analyze| Gemini
    Gemini -->|response| App
    App -->|store results| FirestoreLib
    FirestoreLib -->|writes| Firestore

    App -->|build| Hosting

    %% Config and Rules
    Config -.->|env & build| App
    FirestoreRules -.->|secure| Firestore

    %% Click Events
    click Main "https://github.com/jitenverma076/talent-arc/blob/main/src/main.jsx"
    click App "https://github.com/jitenverma076/talent-arc/blob/main/src/App.jsx"
    click Navbar "https://github.com/jitenverma076/talent-arc/blob/main/src/components/Navbar.jsx"
    click Footer "https://github.com/jitenverma076/talent-arc/blob/main/src/components/Footer.jsx"
    click AuthModal "https://github.com/jitenverma076/talent-arc/blob/main/src/components/AuthModal.jsx"
    click ThemeToggle "https://github.com/jitenverma076/talent-arc/blob/main/src/components/ThemeToggle.jsx"
    click ProtectedRoute "https://github.com/jitenverma076/talent-arc/blob/main/src/components/ProtectedRoute.jsx"
    click ErrorBoundary "https://github.com/jitenverma076/talent-arc/blob/main/src/components/ErrorBoundary.jsx"
    click ThemeProvider "https://github.com/jitenverma076/talent-arc/blob/main/src/components/ThemeProvider.jsx"
    click UserProfile "https://github.com/jitenverma076/talent-arc/blob/main/src/components/UserProfile.jsx"
    click Button "https://github.com/jitenverma076/talent-arc/blob/main/src/components/ui/button.jsx"
    click Home "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Home.jsx"
    click Dashboard "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Dashboard.jsx"
    click Challenges "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Challenges.jsx"
    click Companies "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Companies.jsx"
    click Candidates "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Candidates.jsx"
    click Profile "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Profile.jsx"
    click AdminDashboard "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/AdminDashboard.jsx"
    click Login "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Login.jsx"
    click Register "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Register.jsx"
    click SignIn "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/SignIn.jsx"
    click Unauthorized "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Unauthorized.jsx"
    click NotFound "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/NotFound.jsx"
    click HowItWorks "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/HowItWorks.jsx"
    click Contact "https://github.com/jitenverma076/talent-arc/blob/main/src/pages/Contact.jsx"
    click AuthContext "https://github.com/jitenverma076/talent-arc/blob/main/src/context/AuthContext.jsx"
    click ModalContext "https://github.com/jitenverma076/talent-arc/blob/main/src/context/ModalContext.jsx"
    click useAuth "https://github.com/jitenverma076/talent-arc/blob/main/src/hooks/useAuth.jsx"
    click FirebaseInit "https://github.com/jitenverma076/talent-arc/blob/main/src/lib/firebase.js"
    click AuthLib "https://github.com/jitenverma076/talent-arc/blob/main/src/lib/auth.js"
    click FirestoreLib "https://github.com/jitenverma076/talent-arc/blob/main/src/lib/firestore.js"
    click UtilsLib "https://github.com/jitenverma076/talent-arc/blob/main/src/lib/utils.js"
    click StatFallback "https://github.com/jitenverma076/talent-arc/blob/main/src/lib/utils.js"
    click Config "https://github.com/jitenverma076/talent-arc/blob/main/.env.example"
    click FirestoreRules "https://github.com/jitenverma076/talent-arc/blob/main/firestore.rules"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0366D6,color:#0366D6
    classDef cloud fill:#E6FFEA,stroke:#2C8F2C,color:#2C8F2C
    classDef ai fill:#FFEBD0,stroke:#D29922,color:#D29922
    classDef infra fill:#F0F0F0,stroke:#999999,color:#555555
```
