# ai-fanatic/salary-surge-calculator-main architecture

> Architecture diagram of the GitHub repository ai-fanatic/salary-surge-calculator-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ai-fanatic/salary-surge-calculator-main
- Repository: https://github.com/ai-fanatic/salary-surge-calculator-main

## Overview

##### Main Components
a. Entry Point and Application Shell:
- Main entry file is src/main.tsx. This bootstraps the React application.
- src/App.tsx acts as the primary container for rendering pages/components.
b. UI Components:
- The src/components/ui directory contains many reusable UI elements (accordion, alerts, buttons, dialog, etc.)
c. Domain-Specific Components:
- The src/components/salary directory holds components like GridBackground.tsx and SalaryTile.tsx, which provide specific functionality.
d. Pages and Routing:
- There is a src/pages directory (with at least an Index.tsx) that defines the different views or pages.
e. Custom Hooks and Utilities:
- src/hooks directory contains custom hooks (such as use-mobile and use-toast) that manage state or logic.
- src/lib and src/utils provide utility functions.
f. Static Assets and Public Files:
- The public directory and index.html that serve as the shell for the client.

##### Relationships and Interactions
- App.tsx forms the core container and routes to different pages (src/pages).
- Pages import and render various UI components from src/components/ui and domain components from src/components/salary.
- Custom hooks and utility functions are used by these components to handle state management and business logic.
- All static configs and assets (e.g., Tailwind configuration, ESLint, PostCSS) support the build environment provided by Vite.
- External dependencies (React, TypeScript, shadcn-ui, Tailwind CSS) should be noted as underlying frameworks.

##### Architectural Patterns
- The project employs a modular component-based architecture; components are logically grouped by their roles (UI generic elements vs. domain-specific functionality).
- Maintain clear separation of concerns: UI component rendering, custom hooks/utilities for state management, and configuration for build tooling.
- While not an MVC system, it emphasizes reusability and composition typical in React applications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Environment
    subgraph "Client Environment"
        Public["index.html & Public Assets"]:::public
    end

    %% Application Layer
    subgraph "Application Layer"
        Main["src/main.tsx"]:::entry
        App["src/App.tsx"]:::entry
    end

    %% Features Layer
    subgraph "Features"
        Pages["src/pages (Index.tsx)"]:::pages
        UI["UI Components (src/components/ui)"]:::ui
        Domain["Domain Components (Salary Feature)"]:::domain
    end

    %% Supporting Tools Layer
    subgraph "Supporting Tools"
        Hooks["Custom Hooks (src/hooks)"]:::hooks
        Utils["Utilities & Libraries (src/lib/utils, src/utils)"]:::utils
    end

    %% Configuration & Build Tools
    subgraph "Configuration & Build Tools"
        Vite["Vite"]:::config
        React["React"]:::config
        TS["TypeScript"]:::config
        Tailwind["Tailwind CSS"]:::config
        Shadcn["shadcn-ui"]:::config
    end

    %% Relationships
    Public -->|"loads"| Main
    Main -->|"bootstraps"| App
    App -->|"routes-to"| Pages
    Pages -->|"renders"| UI
    Pages -->|"renders"| Domain
    UI -->|"uses"| Hooks
    UI -->|"uses"| Utils
    Domain -->|"uses"| Hooks
    Domain -->|"uses"| Utils

    %% External Dependencies influence the application
    Vite --- Main
    React --- App
    TS --- App
    Tailwind --- UI
    Shadcn --- UI

    %% Click Events
    click Main "https://github.com/ai-fanatic/salary-surge-calculator-main/blob/main/src/main.tsx"
    click App "https://github.com/ai-fanatic/salary-surge-calculator-main/blob/main/src/App.tsx"
    click UI "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/src/components/ui/"
    click Domain "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/src/components/salary/"
    click Pages "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/src/pages/"
    click Hooks "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/src/hooks/"
    click Utils "https://github.com/ai-fanatic/salary-surge-calculator-main/blob/main/src/lib/utils.ts"
    click Utils "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/src/utils/"
    click Public "https://github.com/ai-fanatic/salary-surge-calculator-main/tree/main/public/"

    %% Styles
    classDef entry fill:#f3d1dc,stroke:#cb3f82,stroke-width:2px;
    classDef pages fill:#cce5ff,stroke:#3399ff,stroke-width:2px;
    classDef ui fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef domain fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef hooks fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef utils fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
    classDef config fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef public fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
```
