# tharumika/industrial-tool-website architecture

> Architecture diagram of the GitHub repository tharumika/industrial-tool-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tharumika/industrial-tool-website
- Repository: https://github.com/tharumika/industrial-tool-website

## Overview

##### Project type + purpose (what you’re diagramming)
This is a **static, client-rendered React marketing site** built with **Vite**. It’s essentially a **SPA (Single Page Application)** focused on:
- **Marketing pages** (Home/Products/Services/About/Contact)
- **Lead generation** (Contact page/form)
- **Internationalization** via **i18next / react-i18next** with language persisted in **localStorage**
- **Styling** via **Tailwind CSS**
- **Client-side routing** via **React Router**

##### File tree → architecture signals (map folders/files to components)
From the tree:

##### Entry + composition
- `index.html` → Vite HTML entry template
- `index.tsx` → React bootstrap entry (mounting root, router/provider setup likely)
- `App.tsx` → Top-level app shell and **route management**
- `pages/*` → Route-level page components:
- `Home.tsx`, `Products.tsx`, `Services.tsx`, `About.tsx`, `Contact.tsx`
- `components/*` → Reusable UI building blocks:
- `Navbar.tsx`, `Footer.tsx`

##### Cross-cutting concern: Internationalization
- `i18n.ts` → i18next configuration and language setup (including localStorage persistence)

##### Tooling / build system
- `vite.config.ts` → build + dev server configuration
- `package.json` + `package-lock.json` → dependencies and scripts
- `tsconfig.json` → TypeScript compilation configuration
- `metadata.json` → treat as **static site metadata/config** consumed by the app or build (include it as a “Static configuration asset” if referenced)

##### What the README adds (things to explicitly show)
- **Tailwind** affects rendering layer → include as styling system (build-time + runtime class usage)
- **i18next + react-i18next** → include an “I18n subsystem” plus “language switcher” and “localStorage persistence”

##### Container / System Context (C4 Level 2-ish)
Shows:
- User browser
- Static hosting (where the Vite build output is served)
- The SPA (React app)
- External dependencies (localStorage, potential future backend endpoint)

Shows:
- App shell, router, pages, shared components, i18n module, assets/config

This project is small enough that Level 3 is very readable and gives the “most detailed” view without inventing non-existent services.

##### Runtime containers / nodes (top-level)
- **End User (Browser)**
- **Static Web Hosting / CDN** (Netlify/Vercel/S3+CloudFront/etc. — leave vendor-neutral)
- **React SPA (bundled JS/CSS/assets)**

##### Inside the SPA (component-level)
- **Bootstrap / Entry Point**: `index.tsx`
- Mounts React root
- Initializes Router + i18n integration
- **App Shell / Routes**: `App.tsx`
- Defines route table
- Composes layout (Navbar/Footer + routed page content)
- **Routing Layer**: React Router
- BrowserRouter
- Routes/Route mapping to `pages/*`
- **Pages (Route Components)**:
- Home / Products / Services / About / Contact
- **Shared UI Components**:
- Navbar (likely includes language switch UI)
- Footer
- **I18n Subsystem**:
- `i18n.ts` config
- Translation resource bundles (JSON assets)
- Language persistence: `localStorage`
- **Styling System**:
- Tailwind CSS (compiled CSS + utility classes)
- **Static Config / Metadata**:
- `metadata.json` (if used by pages for SEO content or page data)

- **Backend API (future)**:
- Contact form POST endpoint (Node/Express)
- Email service / CRM integration (future)

##### Client-side navigation flow (no server round trips)
- **User → React Router**: navigation events (click Navbar links)
- **React Router → Pages**: render route component (Home/Products/etc.)

##### Localization flow
- **User (language switch in Navbar) → i18n**: `changeLanguage(lang)`
- **i18n → localStorage**: persist selected language
- **On startup**: `i18n.ts` reads **localStorage → selects language → provides translation function**
- **Pages/Components → i18n**: request translations by key (`t('...')`)

##### Contact form (current vs future)
- Contact Page → “Form state/validation” (in-client) → (no external submission or “mailto:”)
- Contact Page → HTTP POST → Backend API → Email/CRM

##### Important architectural patterns/design principles to highlight
- **SPA + Client-side routing** (React Router)
- **Component-based UI composition** (`components/` reused across `pages/`)
- **Cross-cutting i18n concern** (centralized in `i18n.ts`, consumed everywhere)
- **Separation of concerns**:
- `pages/` = route-level feature composition
- `components/` = reusable presentational elements
- `i18n.ts` = infrastructure/config module
- **Build-time tooling separation**:
- Vite + TS config + Tailwind build pipeline

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Diagram 1: System / Container (Runtime + Delivery + Deploy)
  %% =========================
  subgraph "System Context (Runtime + Delivery)"
    direction TB

    User["End User"]:::external
    Browser["User Browser\n(Executes SPA)"]:::external

    subgraph "Delivery (Static Hosting)"
      direction TB
      CDN["Static Web Hosting / CDN\n(serves static assets)"]:::hosting
      ViteEntry["index.html\n(Vite HTML entry template)"]:::artifact
      Bundles["Vite Build Output\n(JS bundle(s) + CSS + assets)"]:::artifact
      I18nBundles["Translation resource bundles\n(JSON static assets, per README)"]:::artifact
    end

    subgraph "Client Runtime (SPA)"
      direction TB
      SPA["React Marketing SPA\n(Client-rendered SPA)"]:::spa
      LocalStorage[("localStorage\n(language preference)")]:::storage
      FutureAPI["Future Backend API\n(Contact form POST endpoint)"]:::future
      EmailCRM["Future Email / CRM Provider"]:::future
    end

    User -->|"uses"| Browser
    Browser -->|"HTTP_GET_/"| CDN
    CDN -->|"serves"| ViteEntry
    CDN -->|"serves"| Bundles
    CDN -->|"serves"| I18nBundles
    Bundles -->|"executes_in"| SPA

    SPA <-->|"read_write_lang"| LocalStorage

    SPA -.->|"POST_/contact (future)"| FutureAPI
    FutureAPI -.->|"send_lead (future)"| EmailCRM
  end

  %% =========================
  %% Diagram 2: SPA Component View (C4 Level 3-ish)
  %% =========================
  subgraph "SPA Component View (Most Detailed)"
    direction TB

    subgraph "Bootstrap"
      direction TB
      Entry["index.tsx\n(React bootstrap / mount root)"]:::infra
    end

    subgraph "App Shell + Routing"
      direction TB
      App["App.tsx\n(App shell + route table)"]:::infra
      Router["React Router\n(BrowserRouter + Routes)"]:::infra
    end

    subgraph "Layout (Shared UI Components)"
      direction TB
      Navbar["Navbar.tsx\n(Nav links + language switch)"]:::ui
      Footer["Footer.tsx"]:::ui
    end

    subgraph "Pages (Route Components)"
      direction TB
      Home["Home.tsx"]:::page
      Products["Products.tsx"]:::page
      Services["Services.tsx"]:::page
      About["About.tsx"]:::page
      Contact["Contact.tsx\n(Lead form page)"]:::page
      ContactState["Contact Form State/Validation\n(client-only)"]:::ui
      ContactSubmit["Contact Submission\n(none today)"]:::note
      FuturePost["HTTP POST /contact\n(future)"]:::future
    end

    subgraph "Cross-cutting: Internationalization (i18next)"
      direction TB
      I18n["i18n.ts\n(i18next + react-i18next config)"]:::infra
      TFunc["t(key)\n(translation lookup)"]:::infra
      LangSwitch["changeLanguage(lang)"]:::infra
      LS2[("localStorage\n(language)")]:::storage
      Translations["Translation bundles\n(JSON assets)"]:::artifact
    end

    subgraph "Cross-cutting: Styling"
      direction TB
      Tailwind["Tailwind CSS\n(utility classes + compiled CSS)"]:::styleCls
    end

    subgraph "Static Config"
      direction TB
      Metadata["metadata.json\n(static site metadata/config)"]:::artifact
    end

    %% Component interactions
    Entry -->|"mounts"| App
    App -->|"configures"| Router
    App -->|"wraps_layout"| Navbar
    App -->|"wraps_layout"| Footer

    Router -->|"route_/"| Home
    Router -->|"route_/products"| Products
    Router -->|"route_/services"| Services
    Router -->|"route_/about"| About
    Router -->|"route_/contact"| Contact

    %% i18n lifecycle + usage
    Entry -->|"initializes"| I18n
    I18n -->|"loads"| Translations
    I18n -->|"exposes"| TFunc
    Navbar -->|"calls"| LangSwitch
    LangSwitch -->|"updates"| I18n
    I18n <-->|"persist_lang"| LS2

    Home -->|"uses"| TFunc
    Products -->|"uses"| TFunc
    Services -->|"uses"| TFunc
    About -->|"uses"| TFunc
    Contact -->|"uses"| TFunc
    Navbar -->|"uses"| TFunc
    Footer -->|"uses"| TFunc

    %% Styling applies across UI
    Tailwind -->|"styles"| Navbar
    Tailwind -->|"styles"| Footer
    Tailwind -->|"styles"| Home
    Tailwind -->|"styles"| Products
    Tailwind -->|"styles"| Services
    Tailwind -->|"styles"| About
    Tailwind -->|"styles"| Contact

    %% Metadata consumption (if used)
    Metadata -->|"consumed_by"| App
    Metadata -->|"consumed_by"| Home
    Metadata -->|"consumed_by"| Products
    Metadata -->|"consumed_by"| Services
    Metadata -->|"consumed_by"| About
    Metadata -->|"consumed_by"| Contact

    %% Contact: current vs future
    Contact -->|"manages"| ContactState
    ContactState -->|"submit"| ContactSubmit
    Contact -.->|"future"| FuturePost
  end

  %% =========================
  %% Build / Tooling Pipeline (Vite + TS)
  %% =========================
  subgraph "Build & Tooling (Local Dev / CI)"
    direction TB
    Package["package.json\n(scripts + deps)"]:::tooling
    Lock["package-lock.json"]:::tooling
    TSConfig["tsconfig.json"]:::tooling
    ViteCfg["vite.config.ts"]:::tooling
    BuildStep["Vite Build\n(bundle TSX + Tailwind)"]:::tooling
    Deploy["Deploy to Static Hosting/CDN"]:::hosting
  end

  Package -->|"npm_scripts"| BuildStep
  Lock -->|"locks_deps"| BuildStep
  TSConfig -->|"ts_compile_opts"| BuildStep
  ViteCfg -->|"build_config"| BuildStep
  BuildStep -->|"outputs"| Bundles
  BuildStep -->|"outputs"| ViteEntry
  BuildStep -->|"outputs"| I18nBundles
  BuildStep -->|"deploy"| Deploy
  Deploy -->|"publishes"| CDN

  %% =========================
  %% Click Events (from component_mapping)
  %% =========================
  click ViteEntry "https://github.com/tharumika/industrial-tool-website/blob/main/index.html"
  click Entry "https://github.com/tharumika/industrial-tool-website/blob/main/index.tsx"
  click App "https://github.com/tharumika/industrial-tool-website/blob/main/App.tsx"
  click Home "https://github.com/tharumika/industrial-tool-website/blob/main/pages/Home.tsx"
  click Products "https://github.com/tharumika/industrial-tool-website/blob/main/pages/Products.tsx"
  click Services "https://github.com/tharumika/industrial-tool-website/blob/main/pages/Services.tsx"
  click About "https://github.com/tharumika/industrial-tool-website/blob/main/pages/About.tsx"
  click Contact "https://github.com/tharumika/industrial-tool-website/blob/main/pages/Contact.tsx"
  click Navbar "https://github.com/tharumika/industrial-tool-website/blob/main/components/Navbar.tsx"
  click Footer "https://github.com/tharumika/industrial-tool-website/blob/main/components/Footer.tsx"
  click I18n "https://github.com/tharumika/industrial-tool-website/blob/main/i18n.ts"
  click Metadata "https://github.com/tharumika/industrial-tool-website/blob/main/metadata.json"
  click ViteCfg "https://github.com/tharumika/industrial-tool-website/blob/main/vite.config.ts"
  click Package "https://github.com/tharumika/industrial-tool-website/blob/main/package.json"
  click Lock "https://github.com/tharumika/industrial-tool-website/blob/main/package-lock.json"
  click TSConfig "https://github.com/tharumika/industrial-tool-website/blob/main/tsconfig.json"

  %% =========================
  %% Styles
  %% =========================
  classDef external fill:#e8f3ff,stroke:#2b6cb0,stroke-width:1.5px,color:#102a43
  classDef hosting fill:#ffe8cc,stroke:#c05621,stroke-width:1.5px,color:#3c1f0e
  classDef spa fill:#dbeafe,stroke:#1d4ed8,stroke-width:1.5px,color:#0b1f4b
  classDef ui fill:#dbeafe,stroke:#2563eb,stroke-width:1.2px,color:#0b1f4b
  classDef page fill:#bfdbfe,stroke:#1e40af,stroke-width:1.2px,color:#0b1f4b
  classDef infra fill:#efe7ff,stroke:#6b21a8,stroke-width:1.5px,color:#2a1144
  classDef storage fill:#e5e7eb,stroke:#374151,stroke-width:1.5px,color:#111827
  classDef artifact fill:#f3f4f6,stroke:#6b7280,stroke-width:1.2px,color:#111827
  classDef tooling fill:#dcfce7,stroke:#166534,stroke-width:1.5px,color:#052e16
  classDef styleCls fill:#ffedd5,stroke:#9a3412,stroke-width:1.5px,color:#431407
  classDef future fill:#ffe4e6,stroke:#be123c,stroke-width:2px,color:#4c0519,stroke-dasharray:6 4
  classDef note fill:#fef9c3,stroke:#a16207,stroke-width:1.2px,color:#3b2f00
```
