# fusemachines/covid-nepal-web architecture

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

- Interactive diagram: https://gitdiagram.com/fusemachines/covid-nepal-web
- Repository: https://github.com/fusemachines/covid-nepal-web

## Overview

##### Project type and purpose
- This is a single‐page, full‐stack “front‐end” application (bootstrapped with Create React App) written in React + TypeScript.
- It presents COVID-19 information for Nepal: case counts, hospital data, contacts, news, FAQs, etc., by calling a separate COVID-Nepal backend and other external services (push notifications, Google Translate, Google Maps).

##### File structure
- Top level:
- OneSDK/ – OneSignal push-notification worker scripts (PWA push integration)
- public/ – static assets (index.html, manifest.json, images)
- src/ – all app code
- Inside src/:
- App.tsx & Router.tsx – root component and route definitions
- components/ – reusable UI elements (buttons, badges, cards, modals, loader, navbar, etc.)
- routes/ – page-level containers organized by feature (dashboard, landing, contacts, news, notices, etc.)
- services/ – API client modules (contacts.ts, news.ts, hospitals.ts, covidCases.ts, etc.)
- utils/ – shared helpers (axios config, error handling, translation, storage, analytics)
- i18n/ & customHooks/ – internationalization (en, ne) and a useLanguage hook
- config/ & constants/ – environment setup and static data (routes, options, faq, notices, hospital list)
- scss/ – global and per‐component styles
- serviceWorker.ts – PWA service worker registration & lifecycle

##### README
- Confirms React+TS, CRA, PWA capabilities, push notifications via OneSignal, and reliance on a separate backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser / PWA Shell
    subgraph "Browser / PWA Shell"
        direction TB
        IDX["index.html"]:::static
        MAN["manifest.json"]:::static
        ROB["robots.txt"]:::static
        SW["serviceWorker.ts"]:::static
    end

    %% React Application
    subgraph "React Application"
        direction TB
        ENTRY["src/index.tsx"]:::code
        APP["App.tsx"]:::code
        ROU["Router.tsx"]:::code

        subgraph "UI Components / Routes"
            direction TB
            COMP["components/"]:::ui
            ROUTES["routes/"]:::ui
        end

        subgraph "Service Layer"
            direction TB
            S1["contacts.ts"]:::service
            S2["news.ts"]:::service
            S3["hospitals.ts"]:::service
            S4["covidCases.ts"]:::service
            S5["notices.ts"]:::service
            S6["frontline.ts"]:::service
        end

        subgraph "Configuration / Env"
            direction TB
            CFG["config/index.ts"]:::config
            ENV[".sample.env"]:::config
        end

        subgraph "Constants / Static Data"
            direction TB
            C1["routes.ts"]:::const
            C2["options.ts"]:::const
            C3["faq/index.json"]:::const
            C4["govtNotices.json"]:::const
            C5["resources.json"]:::const
            C6["support.json"]:::const
            C7["hospitals.ts"]:::const
        end

        subgraph "i18n & Hooks"
            direction TB
            I1["i18n/index.ts"]:::i18n
            I2["en.ts"]:::i18n
            I3["ne.ts"]:::i18n
            I4["locale.ts"]:::i18n
            HL["useLanguage.tsx"]:::hook
        end

        subgraph "Utilities"
            direction TB
            U1["axios.ts"]:::util
            U2["error.ts"]:::util
            U3["storage.ts"]:::util
            U4["helpers.ts"]:::util
            U5["date.ts"]:::util
            U6["numberTranslate.ts"]:::util
            U7["stringManipulation.ts"]:::util
            GA["googleAnalytics.tsx"]:::third
        end

        subgraph "Styling"
            direction TB
            SCSS["scss/"]:::static
        end

        subgraph "Type Definitions"
            direction TB
            T1["@types/react-app-env.d.ts"]:::static
            T2["@types/libraries/google-translate/index.d.ts"]:::static
        end

        subgraph "Google Translate Integration"
            direction TB
            TRAN["translate.ts"]:::service
        end

        subgraph "Maps Component"
            direction TB
            MAPC["MapsIframe.tsx"]:::ui
            MPI["MapsIframe/index.ts"]:::ui
        end
    end

    %% External Services
    BACK["COVID-Nepal REST API"]:::external
    ONS["OneSignal"]:::external
    GTR["Google Translate API"]:::external
    GMA["Google Maps Embed"]:::external

    %% Flows
    IDX -->|serves| ENTRY
    MAN -->|provides| ENTRY
    ROB -->|provides| ENTRY
    ENTRY -->|renders| APP
    APP -->|routes| ROU
    ROU -->|loads| COMP
    ROU -->|loads| ROUTES
    ROUTES -->|calls| S1
    ROUTES -->|calls| S2
    ROUTES -->|calls| S3
    ROUTES -->|calls| S4
    ROUTES -->|calls| S5
    ROUTES -->|calls| S6
    S1 -->|requests| BACK
    S2 -->|requests| BACK
    S3 -->|requests| BACK
    S4 -->|requests| BACK
    S5 -->|requests| BACK
    S6 -->|requests| BACK
    BACK -->|responses| ROUTES
    ROUTES -->|render data| COMP
    APP -->|registers| SW
    SW -->|caches| IDX
    SW -->|caches| COMP
    APP -->|initializes| ONS
    ONS -->|push| APP
    I1 -->|uses| TRAN
    TRAN -->|calls| GTR
    MAPC -->|embeds| GMA
    GA -->|tracks| APP

    %% Click Events
    click IDX "https://github.com/fusemachines/covid-nepal-web/blob/develop/public/index.html"
    click MAN "https://github.com/fusemachines/covid-nepal-web/blob/develop/public/manifest.json"
    click ROB "https://github.com/fusemachines/covid-nepal-web/blob/develop/public/robots.txt"
    click SW "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/serviceWorker.ts"
    click ENTRY "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/index.tsx"
    click APP "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/App.tsx"
    click ROU "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/Router.tsx"
    click COMP "https://github.com/fusemachines/covid-nepal-web/tree/develop/src/components/"
    click ROUTES "https://github.com/fusemachines/covid-nepal-web/tree/develop/src/routes/"
    click S1 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/contacts.ts"
    click S2 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/news.ts"
    click S3 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/hospitals.ts"
    click S4 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/covidCases.ts"
    click S5 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/notices.ts"
    click S6 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/services/frontline.ts"
    click CFG "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/config/index.ts"
    click ENV "https://github.com/fusemachines/covid-nepal-web/blob/develop/.sample.env"
    click C1 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/routes.ts"
    click C2 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/options.ts"
    click C3 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/faq/index.json"
    click C4 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/notices/govtNotices.json"
    click C5 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/notices/resources.json"
    click C6 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/notices/support.json"
    click C7 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/constants/hospitals.ts"
    click I1 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/i18n/index.ts"
    click I2 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/i18n/en.ts"
    click I3 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/i18n/ne.ts"
    click I4 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/i18n/locale.ts"
    click HL "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/customHooks/useLanguage.tsx"
    click U1 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/axios.ts"
    click U2 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/error.ts"
    click U3 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/storage.ts"
    click U4 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/helpers.ts"
    click U5 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/date.ts"
    click U6 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/numberTranslate.ts"
    click U7 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/stringManipulation.ts"
    click GA "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/googleAnalytics.tsx"
    click SCSS "https://github.com/fusemachines/covid-nepal-web/tree/develop/src/scss/"
    click T1 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/@types/react-app-env.d.ts"
    click T2 "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/@types/libraries/google-translate/index.d.ts"
    click TRAN "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/utils/translate.ts"
    click MAPC "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/components/MapsIframe/MapsIframe.tsx"
    click MPI "https://github.com/fusemachines/covid-nepal-web/blob/develop/src/components/MapsIframe/index.ts"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0288D1,stroke-width:2px
    classDef service fill:#E0F7FA,stroke:#006064,stroke-width:2px
    classDef code fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px
    classDef config fill:#FFF3E0,stroke:#EF6C00,stroke-width:2px
    classDef const fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px
    classDef i18n fill:#FFF9C4,stroke:#F9A825,stroke-width:2px
    classDef hook fill:#FCE4EC,stroke:#C2185B,stroke-width:2px
    classDef util fill:#ECEFF1,stroke:#455A64,stroke-width:2px
    classDef static fill:#CFD8DC,stroke:#607D8B,stroke-width:2px
    classDef third fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px
    classDef external fill:#FFE0B2,stroke:#E65100,stroke-width:2px
```
