# ghulamrasool154/trading-nations architecture

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

- Interactive diagram: https://gitdiagram.com/ghulamrasool154/trading-nations
- Repository: https://github.com/ghulamrasool154/trading-nations

## Overview

##### Project type and purpose
- This is a Next.js web application (bootstrapped with create-next-app) focused on a marketing/ informational site (“trading-nations”) with multi-language support (via the app router’s [lang] parameter).
- Key features: server-rendered and statically generated pages, TailwindCSS styling, a localized routing structure, static assets (images, videos), reusable React components, and client-side hooks (theme switching).

##### File structure
- Top-level config:
- next.config.mjs, jsconfig.json, postcss.config.js/mjs, tailwind.config.js, package.json/lock
- Public folder:
- public/assets (gics, logos, map, social), public/videos → static assets served by Next.js/ CDN
- Source code in src/:
- app/ – Next.js App Router: dynamic [lang] subfolder, nested route groups for services, pages (about, contact, etc.), global layout, loading/404
- components/ – isolated UI components (headings, chatbox, nav, hero, cards, UI/button variants)
- layout/ – global header, footer, theme mode management
- hooks/ – custom hook for theme switching
- localization/ – i18n config, dictionary loader, language JSON files
- screen/ – per-page wrappers (home, about-us, services/quantum-resilient, etc.)
- seo/ – meta-data utilities
- utils/ – fonts loader

##### README for additional insights
- No backend/API routes; purely Next.js pages with optional SSR/SSG.
- Deployment is likely on Vercel, leveraging Next.js features (image optimization, built-in routing, file-based page generation).

##### Elements
- Client → Next.js Runtime (routing requests)
- Next.js Runtime → Localization JSONs
- Next.js Runtime → Component Library
- Next.js Runtime → CDN (static requests)
- Next.js Runtime → External APIs
- CDN → Client (asset delivery)
- Blue for runtime services (Next.js Server, CDN)
- Green for code modules (Component Library, Hooks, Localization)
- Orange for external dependencies (Google Fonts, analytics)
- Gray for client

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client["Browser"]:::client

    %% Server Layer
    subgraph "Next.js Runtime"
        Routing["Routing (src/app)"]:::runtime
        Rendering["Rendering Engine (SSR/SSG)"]:::runtime
        Localization["Localization Module"]:::module
        CompLib["Component Library"]:::module
        Layout["Global Layout & Theme"]:::module
        Hooks["Custom Hooks"]:::module
        SEO["SEO Utilities"]:::module
        Icons["SVG Icon Components"]:::module
        Utils["Utility Modules"]:::module
        Middleware["Middleware"]:::module
    end

    %% CDN Layer
    CDN["Static Asset CDN"]:::cdn

    %% External Layer
    External["External APIs<br/>(Google Fonts, Analytics)"]:::external

    %% Connections
    Client -->|"HTTP GET [lang]/page"| Routing
    Routing -->|"resolves route"| Rendering
    Rendering -->|"fetch JSON dictionary"| Localization
    Rendering -->|"render React components"| CompLib
    Rendering -->|"apply global layout/theme"| Layout
    Rendering -->|"use SEO utils"| SEO
    Rendering -->|"load SVG icons"| Icons
    Rendering -->|"load fonts utils"| Utils
    Rendering -->|"invoke middleware"| Middleware
    Client -->|"hydrate & theme switch"| Hooks
    Client -->|"request static assets"| CDN
    CDN -->|"serve assets (images, videos)"| Client
    Rendering -->|"request fonts bundle"| External

    %% Click Events - Next.js Runtime
    click Routing "https://github.com/ghulamrasool154/trading-nations/tree/main/src/app"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/layout.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/page.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/loading.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/not-found.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/(services)/gics-sectors/page.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/blob/main/src/app/[lang]/(services)/quantum-resilient/page.jsx"
    click Rendering "https://github.com/ghulamrasool154/trading-nations/tree/main/src/app/[lang]" "src/app/[lang]/*"

    %% Click Events - CDN
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/assets"
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/assets/gics"
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/assets/logos"
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/assets/map"
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/assets/social"
    click CDN "https://github.com/ghulamrasool154/trading-nations/tree/main/public/videos"
    click CDN "https://github.com/ghulamrasool154/trading-nations/blob/main/public/videos/trading_nations_green.mp4"
    click CDN "https://github.com/ghulamrasool154/trading-nations/blob/main/public/videos/trading_nations_white.mp4"

    %% Click Events - Localization
    click Localization "https://github.com/ghulamrasool154/trading-nations/blob/main/src/localization/get-dictionary.js"
    click Localization "https://github.com/ghulamrasool154/trading-nations/blob/main/src/localization/i18n-config.js"
    click Localization "https://github.com/ghulamrasool154/trading-nations/blob/main/src/localization/lang/en.json"
    click Localization "https://github.com/ghulamrasool154/trading-nations/blob/main/src/localization/lang/ar.json"
    click Localization "https://github.com/ghulamrasool154/trading-nations/blob/main/src/localization/languages-support.js"

    %% Click Events - Component Library
    click CompLib "https://github.com/ghulamrasool154/trading-nations/tree/main/src/components"

    %% Click Events - Global Layout & Theme
    click Layout "https://github.com/ghulamrasool154/trading-nations/blob/main/src/layout/index.jsx"

    %% Click Events - Custom Hooks
    click Hooks "https://github.com/ghulamrasool154/trading-nations/blob/main/src/hooks/use-switch-theme.jsx"

    %% Click Events - SEO Utilities
    click SEO "https://github.com/ghulamrasool154/trading-nations/blob/main/src/seo/meta-data.js"

    %% Click Events - SVG Icons
    click Icons "https://github.com/ghulamrasool154/trading-nations/tree/main/src/svg-icons"

    %% Click Events - Utility Modules
    click Utils "https://github.com/ghulamrasool154/trading-nations/blob/main/src/utils/fonts.js"

    %% Click Events - Middleware
    click Middleware "https://github.com/ghulamrasool154/trading-nations/blob/main/src/middleware.jsx"

    %% Styles
    classDef client fill:#DDDDDD,stroke:#888,stroke-width:1px
    classDef runtime fill:#D0E7FF,stroke:#0366D6,stroke-width:1px
    classDef module fill:#E6F4EA,stroke:#238636,stroke-width:1px
    classDef cdn fill:#FFF5CC,stroke:#DAB10D,stroke-width:1px
    classDef external fill:#FFEADF,stroke:#A04100,stroke-width:1px
```
