# 10cyrilc/cardamom-auction-tracker architecture

> Architecture diagram of the GitHub repository 10cyrilc/cardamom-auction-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/10cyrilc/cardamom-auction-tracker
- Repository: https://github.com/10cyrilc/cardamom-auction-tracker

## Overview

##### Project type and purpose
- This is a full-stack-lite (client-only) single-page application built with React + TypeScript. Its sole responsibility is displaying real-time cardamom auction data by calling an external API and rendering it in a responsive UI.

##### Main components
a. User’s Browser (Client)
b. React SPA
- Entry point (main.tsx/App.tsx)
- Pages (PriceTracker page)
- UI Components (AuctionSelector, DateSelector, AuctionDetails, Loader, NavBar/Footer)
- State & Constants (src/constants, src/types)
c. Static Assets
- public/ (images, robots.txt, sitemap.xml)
d. Build & Deployment
- Vite dev server & bundler (vite.config.ts)
- package.json scripts
e. External Services
- Auction Data API (third-party)
- Optional: CDN or hosting (e.g., GitHub Pages, Netlify)

##### Relationships and data flows
- Browser loads index.html → Vite serves static assets + bundled JS/CSS → React app initializes.
- On user interaction (select date/auction), React components call the external Auction Data API using fetch/axios (via base URL in env.ts).
- API responds with JSON (typed by src/types/AuctionData.ts).
- React state updates → data flows into AuctionDetails component → UI re-renders.

##### Architectural patterns & principles
- Component-based UI decomposition (atomic design)
- Separation of concerns: pages vs. reusable components vs. constants vs. types
- Single Responsibility: each component handles one UI feature
- Config through environment variables (src/constants/env.ts)
- Build abstraction by Vite (hot-reload in dev, optimized bundles in prod)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Layer
    Browser["User's Browser<br/>(index.html)"]:::frontend

    %% Build & Deployment
    Vite["Vite Dev Server & Bundler<br/>(vite.config.ts)"]:::build
    Package["package.json"]:::build

    %% Static Assets
    subgraph "public/" 
        direction TB
        Images["images/"]:::asset
        Robots["robots.txt"]:::asset
        Sitemap["sitemap.xml"]:::asset
    end

    %% React SPA
    subgraph "React SPA"
        direction TB
        EntryMain["main.tsx"]:::frontend
        EntryApp["App.tsx"]:::frontend

        subgraph "src/pages"
            PriceTracker["PriceTracker Page"]:::frontend
        end

        subgraph "src/components"
            AuctionSelector["AuctionSelector"]:::frontend
            DateSelector["DateSelector"]:::frontend
            AuctionDetails["AuctionDetails"]:::frontend
            Loader["Loader"]:::frontend
            subgraph "Navigation"
                NavBar["NavBar"]:::frontend
                Footer["Footer"]:::frontend
            end
        end

        subgraph "src/constants"
            Env["env.ts"]:::frontend
            PageData["PageData.tsx"]:::frontend
            ConstIndex["index.ts"]:::frontend
            Variables["variables.ts"]:::frontend
        end

        subgraph "src/types"
            Types["AuctionData.ts"]:::frontend
        end
    end

    %% External Service
    API["Auction Data API"]:::service

    %% Flows
    Browser -->|"Loads index.html"| Vite
    Browser -->|"Fetches assets"| Images
    Browser -->|"Fetches assets"| Robots
    Browser -->|"Fetches assets"| Sitemap

    Vite -->|"Serves bundle & assets"| Browser
    Vite -->|"Bundles and serves React SPA"| EntryMain
    Package --> Vite

    Images ---> SPAProxy[/"React SPA"/]
    SPAProxy -->|"Bootstraps"| EntryMain
    EntryMain -->|"Renders"| EntryApp
    EntryApp --> PriceTracker

    PriceTracker --> AuctionSelector
    PriceTracker --> DateSelector
    PriceTracker --> AuctionDetails
    PriceTracker --> Loader
    PriceTracker --> NavBar
    PriceTracker --> Footer

    EntryApp --> Env
    EntryApp --> PageData
    EntryApp --> ConstIndex
    EntryApp --> Variables
    EntryApp --> Types

    AuctionSelector -->|"HTTP fetch"| API
    DateSelector -->|"HTTP fetch"| API
    AuctionDetails -->|"HTTP fetch"| API
    Loader -->|"HTTP fetch"| API

    API -->|"JSON response"| AuctionDetails

    %% Click Events
    click Browser "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/index.html"
    click Vite "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/vite.config.ts"
    click Package "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/package.json"
    click Images "https://github.com/10cyrilc/cardamom-auction-tracker/tree/main/public/images"
    click Robots "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/public/robots.txt"
    click Sitemap "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/public/sitemap.xml"
    click EntryMain "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/main.tsx"
    click EntryApp "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/App.tsx"
    click PriceTracker "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/pages/PriceTracker.tsx"
    click AuctionSelector "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/AuctionSelector.tsx"
    click DateSelector "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/DateSelector.tsx"
    click AuctionDetails "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/AuctionDetails.tsx"
    click Loader "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/Loader.tsx"
    click NavBar "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/Navigation/NavBar.tsx"
    click Footer "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/components/Navigation/Footer.tsx"
    click Env "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/constants/env.ts"
    click PageData "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/constants/PageData.tsx"
    click ConstIndex "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/constants/index.ts"
    click Variables "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/constants/variables.ts"
    click Types "https://github.com/10cyrilc/cardamom-auction-tracker/blob/main/src/types/AuctionData.ts"

    %% Styles & Legend
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef service fill:#DFFFD0,stroke:#3A7700,color:#3A7700;
    classDef build fill:#FFF4C1,stroke:#D1A200,color:#D1A200;
    classDef asset fill:#F0F0F0,stroke:#A0A0A0,color:#606060;
    classDef default fill:#FFFFFF,stroke:#000000;
```
