# engdawood/portfolio-website-arabic-english architecture

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

- Interactive diagram: https://gitdiagram.com/engdawood/portfolio-website-arabic-english
- Repository: https://github.com/engdawood/portfolio-website-arabic-english

## Overview

##### Project type and purpose
- This is a full-stack, React-based portfolio website built with Next.js 15.
- Purpose: present personal information, projects, blog, services, with bilingual support, dynamic theming, animations, and optimal performance (SSR/SSG).

##### File structure
- src/app/ – Next.js App Router pages (home, about, blog, contact, projects, services).
- src/components/ – reusable UI components (layout, sidebar, theme toggle, animations, error boundary).
- src/context/ – React Context providers (language, theme, sidebar state).
- src/data/ & src/translations/ – static content and translations for bilingual support.
- src/hooks/ & src/utils/ – custom hooks (e.g., useColorScheme, useTranslatedData) and utility functions.
- Configuration/build files: next.config.*, tsconfig.json, eslint.config.mjs, postcss.config.mjs.

##### Key architectural patterns
- Next.js App Router with hybrid rendering: SSR (server-rendered pages), SSG (static pages generated at build time), and client components for interactivity.
- Context API for global state (language, theme, sidebar).
- Component-driven UI pattern: each feature (search, newsletter, sidebar) encapsulated in a component.
- Data-driven pages: page routes import static data and translation files.

##### Main components
a. Client (Browser)
- Renders React components, triggers client-side routing (Next.js Link).
- Switches themes and languages via Context providers.
b. Next.js Server (Node.js runtime on Vercel or custom host)
- Handles incoming HTTP requests.
- App Router logic: decides SSR vs SSG.
- Serves pre-rendered HTML, JSON for client components, and static assets.
c. Static Data Layer
- src/data/* and src/translations/* imported by server at build/run time.
d. Public/CDN Layer
- Static assets (images, CSS, fonts) served from public/ via CDN (Vercel edge).
- Next.js Image optimization and caching.
e. Deployment/Hosting
- Vercel platform (GitHub integration or CLI) manages build, cache, CDN, and edge functions.

##### Relationships and interactions
- Browser → HTTPS → Next.js Server
- Initial page request → SSR or SSG HTML
- Hydration: client-side React takes over
- Browser (client components) ↔ Next.js Data Fetching (app router)
- fetch static content or inline JSON
- Next.js Server ↔ File system
- Reads page components, static data, translations, utilities
- Next.js Server ↔ CDN/Public
- Uploads public assets during build → served to clients directly

##### Elements
- Clear component labels: Browser, Next.js Server (App Router), Data Files, CDN/Public Assets, Vercel.
- Browser → Server (request)
- Server → Browser (HTML/JSON)
- Server → File System (data lookup)
- Browser ↔ Client components (hydration/interactivity)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Browser"]:::frontend
        subgraph "Client-side React"
            direction TB
            ClientThemeProvider["ClientThemeProvider"]:::frontend
            LanguageContextClient["LanguageContext (useContext)"]:::frontend
            ThemeContextClient["ThemeContext (useContext)"]:::frontend
            SidebarContextClient["SidebarContext (useContext)"]:::frontend
            useColorScheme["useColorScheme()"]:::frontend
            useTranslatedData["useTranslatedData()"]:::frontend
            BlogPostClient["BlogPostClient"]:::frontend
            ProjectPageClient["ProjectPageClient"]:::frontend
        end
    end

    %% Server Layer
    subgraph "Next.js Server (Node.js Runtime)" 
        direction TB
        Server["Next.js Server\n(App Router)"]:::backend

        subgraph "Routing & Rendering (SSR/SSG)"
            direction TB
            HomePage["Home Page\n(SSR/SSG)"]:::backend
            AboutPage["About Page\n(SSR)"]:::backend
            BlogListPage["Blog List Page\n(SSG)"]:::backend
            BlogPostPage["Blog Post Page\n(Dynamic SSR/SSG)"]:::backend
            ContactPage["Contact Page\n(SSR/SSG)"]:::backend
            ProjectsListPage["Projects List Page\n(SSG)"]:::backend
            ProjectPage["Project Page\n(Dynamic SSR/SSG)"]:::backend
            ServicesListPage["Services List Page\n(SSG)"]:::backend
            ServiceDetailPage["Service Detail Page\n(SSR)"]:::backend
        end

        subgraph "Components & Layout"
            direction TB
            Layout["Global Layout"]:::backend
            GlobalsCSS["globals.css"]:::backend
            ThemeToggle["ThemeToggle"]:::backend
            Sidebar["Sidebar"]:::backend
            Search["Search"]:::backend
            Newsletter["Newsletter"]:::backend
            Animations["Animations"]:::backend
            ErrorBoundary["ErrorBoundary"]:::backend
        end

        subgraph "Context Providers"
            direction TB
            LanguageContext["LanguageContext"]:::backend
            ThemeContext["ThemeContext"]:::backend
            SidebarContext["SidebarContext"]:::backend
        end

        subgraph "Hooks & Utils"
            direction TB
            useColorSchemeServer["useColorScheme"]:::backend
            useTranslatedDataServer["useTranslatedData"]:::backend
            colorUtils["colorUtils"]:::backend
        end

        subgraph "Static Data Layer"
            direction TB
            DataFiles["src/data & src/translations"]:::data
        end
    end

    %% Persistence & Assets
    subgraph "Public & CDN Assets"
        direction TB
        PublicAssets["public/"]:::assets
    end

    subgraph "Deployment"
        direction TB
        Vercel["Vercel\n(Build & CDN)"]:::cloud
    end

    %% Connections
    Browser -->|HTTPS Request| Server
    Server -->|Responds HTML/JSON| Browser
    Browser -->|Hydration & Interactivity| ClientThemeProvider
    ClientThemeProvider --> LanguageContextClient
    ClientThemeProvider --> ThemeContextClient
    ClientThemeProvider --> SidebarContextClient
    LanguageContextClient --> useTranslatedData
    ThemeContextClient --> useColorScheme
    SidebarContextClient --> Sidebar
    Browser -->|Client Interaction| BlogPostClient
    Browser -->|Client Interaction| ProjectPageClient

    Server -->|Routes to Pages| HomePage
    Server --> AboutPage
    Server --> BlogListPage
    Server --> BlogPostPage
    Server --> ContactPage
    Server --> ProjectsListPage
    Server --> ProjectPage
    Server --> ServicesListPage
    Server --> ServiceDetailPage

    Server -->|Loads Layout & Components| Layout
    Server --> GlobalsCSS
    Server --> ThemeToggle
    Server --> Sidebar
    Server --> Search
    Server --> Newsletter
    Server --> Animations
    Server --> ErrorBoundary

    Server --> LanguageContext
    Server --> ThemeContext
    Server --> SidebarContext

    Server --> useColorSchemeServer
    Server --> useTranslatedDataServer
    Server --> colorUtils

    Server -->|Reads at Build/Run| DataFiles

    Server -->|Uploads Assets| PublicAssets
    PublicAssets -->|Served to Browser| Browser

    Server -->|Deploy Build| Vercel
    Vercel --> PublicAssets

    %% Click Events
    click HomePage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/page.tsx"
    click AboutPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/about/page.tsx"
    click BlogListPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/blog/page.tsx"
    click BlogPostPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/blog/[slug]/page.tsx"
    click BlogPostClient "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/blog/[slug]/BlogPostClient.tsx"
    click ContactPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/contact/page.tsx"
    click ProjectsListPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/projects/page.tsx"
    click ProjectPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/projects/[slug]/page.tsx"
    click ProjectPageClient "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/projects/[slug]/ProjectPageClient.tsx"
    click ServicesListPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/services/page.tsx"
    click ServiceDetailPage "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/services/[slug]/page.tsx"
    click Layout "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/layout.tsx"
    click GlobalsCSS "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/app/globals.css"
    click ThemeToggle "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/components/ThemeToggle.tsx"
    click ClientThemeProvider "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/components/ClientThemeProvider.tsx"
    click LanguageContext "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/context/LanguageContext.tsx"
    click ThemeContext "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/context/ThemeContext.tsx"
    click SidebarContext "https://github.com/engdawood/portfolio-website-arabic-english/blob/main/src/context/SidebarContext.tsx"
    click DataFiles "https://github.com/engdawood/portfolio-website-arabic-english/tree/main/src/data"
    click PublicAssets "https://github.com/engdawood/portfolio-website-arabic-english/tree/main/public/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#3B82F6,color:#000
    classDef backend fill:#D6F5D6,stroke:#10B981,color:#000
    classDef data fill:#FFF3CD,stroke:#F59E0B,color:#000
    classDef assets fill:#FFE4E1,stroke:#F87171,color:#000
    classDef cloud fill:#E5E7EB,stroke:#6B7280,color:#000
```
