# aryabandhu/react_currency_converter architecture

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

- Interactive diagram: https://gitdiagram.com/aryabandhu/react_currency_converter
- Repository: https://github.com/aryabandhu/react_currency_converter

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React.js, Vite and Tailwind CSS.
- Its sole purpose is to display real-time currency exchange rates and allow users to convert between currencies, by querying ExchangeRate-API.com.

##### Main components
a. User’s Web Browser
- The runtime environment for the SPA
b. Static Asset Server / CDN
- Hosts the built files (index.html, bundled JS/CSS, images in public/)
- In development: Vite dev server
- In production: e.g. Netlify, Vercel, S3 + CloudFront, etc.
c. React Application
- Entry point: src/main.jsx
- Root component: src/App.jsx
- UI Components: src/components/InputBox.jsx, etc.
- Styling: Tailwind CSS (configured via tailwind.config.js, postcss.config.js)
d. Data-layer Hook
- src/hooks/useCurrencyinfo.js — encapsulates the HTTP fetch to ExchangeRate-API.com
e. External Service
- ExchangeRate-API.com — provides real-time rate data via REST API

##### Relationships and data flows
- Browser → Static Asset Server (HTTP GET for index.html & JS/CSS bundles)
- Browser (client) → React App UI (renders components, attaches event handlers)
- User action in UI → useCurrencyinfo hook → HTTP GET to ExchangeRate-API.com
- ExchangeRate-API.com → JSON response → hook → React state → UI re-renders
- (Optional) Dev-time flow: source files → Vite dev server (HMR) → browser
- (Optional) Build pipeline: source files → Vite build → static assets → deployment

##### Architectural patterns & design principles
- Component-based design (React) with clear separation of concerns
- Unidirectional data flow: UI triggers hook → fetch → update state → re-render
- Static asset hosting for front-end only (no own backend)
- Utility-first styling (Tailwind + PostCSS)

##### Final detail checklist
- All components clearly labeled
- Call out key technologies (React, Vite, Tailwind CSS, ExchangeRate-API.com)
- If including build/deployment, indicate Vite build step and hosting environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Environment"
        Browser["User's Web Browser"]:::client
    end

    subgraph "Development"
        ViteDev["Vite Dev Server"]:::dev
    end

    subgraph "Production"
        CDN["Static Asset Server / CDN"]:::cdn
    end

    subgraph "React Application"
        EP["Entry Point\nsrc/main.jsx"]:::frontend
        RC["Root Component\nsrc/App.jsx"]:::frontend
        subgraph "UI Components\nsrc/components"
            IB["InputBox\nsrc/components/InputBox.jsx"]:::frontend
            IDX["Components Index\nsrc/components/index.js"]:::frontend
        end
        Hook["useCurrencyinfo Hook\nsrc/hooks/useCurrencyinfo.js"]:::frontend
        subgraph "Styling & Assets"
            TWC["tailwind.config.js"]:::config
            PCC["postcss.config.js"]:::config
            GCSS["Global CSS\nsrc/index.css"]:::config
            ACSS["App CSS\nsrc/App.css"]:::config
            HTML["HTML Template\nindex.html"]:::assets
            Public["Public Folder\npublic/"]:::assets
        end

        EP --> RC
        RC --> IB
        RC --> IDX
        RC --> GCSS
        RC --> ACSS
        RC --> Hook
    end

    subgraph "Project Configuration"
        VITECFG["vite.config.js"]:::config
        PKG["package.json"]:::config
        LOCK["package-lock.json"]:::config
    end

    Browser -->|"HTTP GET index.html & bundles"| ViteDev
    ViteDev -->|"HMR / Serves Assets"| Browser
    Browser -->|"HTTP GET index.html & bundles"| CDN
    Browser --> RC
    Hook -->|"HTTP GET Rates"| API["ExchangeRate-API.com"]:::external
    API -->|"JSON Response"| Hook
    Hook -->|"Update State"| RC

    classDef client fill:#CEF2F1,stroke:#000,stroke-width:1px
    classDef dev fill:#FDEBD0,stroke:#000,stroke-width:1px
    classDef cdn fill:#D6EAF8,stroke:#000,stroke-width:1px
    classDef frontend fill:#D5F5E3,stroke:#000,stroke-width:1px
    classDef config fill:#FCF3CF,stroke:#000,stroke-width:1px
    classDef assets fill:#F9EBEA,stroke:#000,stroke-width:1px
    classDef external fill:#FADBD8,stroke:#000,stroke-width:1px

    click EP "https://github.com/aryabandhu/react_currency_converter/blob/master/src/main.jsx"
    click RC "https://github.com/aryabandhu/react_currency_converter/blob/master/src/App.jsx"
    click IB "https://github.com/aryabandhu/react_currency_converter/blob/master/src/components/InputBox.jsx"
    click IDX "https://github.com/aryabandhu/react_currency_converter/blob/master/src/components/index.js"
    click Hook "https://github.com/aryabandhu/react_currency_converter/blob/master/src/hooks/useCurrencyinfo.js"
    click TWC "https://github.com/aryabandhu/react_currency_converter/blob/master/tailwind.config.js"
    click PCC "https://github.com/aryabandhu/react_currency_converter/blob/master/postcss.config.js"
    click GCSS "https://github.com/aryabandhu/react_currency_converter/blob/master/src/index.css"
    click ACSS "https://github.com/aryabandhu/react_currency_converter/blob/master/src/App.css"
    click HTML "https://github.com/aryabandhu/react_currency_converter/blob/master/index.html"
    click Public "https://github.com/aryabandhu/react_currency_converter/tree/master/public/"
    click VITECFG "https://github.com/aryabandhu/react_currency_converter/blob/master/vite.config.js"
    click PKG "https://github.com/aryabandhu/react_currency_converter/blob/master/package.json"
    click LOCK "https://github.com/aryabandhu/react_currency_converter/blob/master/package-lock.json"
```
