# idiltugba/idiltech architecture

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

- Interactive diagram: https://gitdiagram.com/idiltugba/idiltech
- Repository: https://github.com/idiltugba/idiltech

## Overview

##### Project Type & Purpose
- This is a Next.js v13 frontend project (no custom backend) built with TypeScript and Tailwind CSS.
- It serves as a personal website (“idiltech”) plus an embedded pin‑pong game and a dynamic “project” page.

##### Key Architectural Components
a. Client Browser
b. Next.js Server (or Vercel/Lambda deployment)
c. Application Router (app/ folder & dynamic routes)
d. React Components (components/ folder)
e. Static Assets (public/ folder)
f. Build Pipeline (Babel, Webpack, PostCSS, Tailwind)
g. Data Sources (oldprojects.json, works.json, social.json)

##### Component Relationships & Data Flow
- On a browser request, the Next.js Server uses the app/ router and page.tsx files to perform SSR or SSG.
- Layout.tsx provides the global page shell (header, footer, menus).
- Dynamic routes under app/[project]/page.tsx fetch project metadata from JSON or public/projects.
- React components under components/ render UI widgets (face‑animation, pinpongame, menu sections).
- Tailwind/PostCSS processes CSS (globals.css + tailwind.config.js) at build time.
- Static assets (images, fonts, scripts) in public/ are served directly by the CDN.

##### Architectural Patterns & Design Principles
- Component‑based UI: atomic React components in components/.
- App Router (Next.js 13) for declarative routing and nested layouts.
- SSG/SSR hybrid: static generation for pages without dynamic data; server rendering on demand for dynamic routes.
- Separation of concerns: styling (Tailwind) vs logic (TypeScript) vs assets (public).

- Notes on where SSR vs SSG vs client hydration occurs

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Browser"
        CB["Browser"]:::compute
    end

    %% CDN / Server Layer
    subgraph "CDN / Next.js Server"
        Server["Next.js Server / CDN"]:::compute
    end

    CB -->|"HTTP request"| Server

    %% Build Pipeline
    subgraph "Build Pipeline"
        Babel["Babel (.babelrc.json)"]:::compute
        PostCSS["PostCSS (postcss.config.js)"]:::compute
        Tailwind["Tailwind (tailwind.config.js)"]:::compute
    end

    Babel --> PostCSS --> Tailwind -->|"Generates .next/ static output"| Server

    %% Code Artifacts: App Router & Pages
    subgraph "app/ Router & Pages"
        Layout["layout.tsx"]:::code
        HomePage["page.tsx"]:::code
        ProjectPage["[project]/page.tsx"]:::code
        GlobalsCSS["globals.css"]:::code
    end

    Server -->|"SSR/SSG via Router"| Layout
    Layout --> HomePage
    Layout --> ProjectPage

    %% UI Components
    subgraph "components/ UI Modules"
        Face["Face Animation"]:::code
        Header["Header"]:::code
        Footer["Footer"]:::code
        Loading["Loading Indicator"]:::code
        Main["Main Content Container"]:::code
        Menu["Menu Section"]:::code
    end

    HomePage --> Face
    HomePage --> Header
    HomePage --> Footer
    HomePage --> Loading
    HomePage --> Main
    HomePage --> Menu

    %% Pin-Pong Game
    subgraph "Pin‑Pong Game (Client‑Only)"
        PinEntry["index.tsx"]:::code
        PinStyles["styles.module.css"]:::code
        Button["button.tsx"]:::code
        HandleBall["handleBall.tsx"]:::code
        HandleKey["handleKeyDown.tsx"]:::code
        HandleGame["handleGame.tsx"]:::code
        HandleScore["handleScoreBoard.tsx"]:::code
    end

    HomePage -->|"Client Hydration"| PinEntry
    PinEntry --> PinStyles
    PinEntry --> Button --> HandleBall --> HandleKey --> HandleGame --> HandleScore

    %% Data Sources
    subgraph "Data Sources"
        OldProj["oldprojects.json"]:::data
        Works["works.json"]:::data
        Social["social.json"]:::data
    end

    ProjectPage -->|"fetch metadata"| OldProj
    ProjectPage -->|"fetch metadata"| Works
    ProjectPage -->|"fetch metadata"| Social

    %% Static Assets
    subgraph "Static Assets"
        Public["public/"]:::assets
    end

    Server -->|"Serves assets via CDN"| Public

    %% Click Events
    click Layout "https://github.com/idiltugba/idiltech/blob/main/app/layout.tsx"
    click HomePage "https://github.com/idiltugba/idiltech/blob/main/app/page.tsx"
    click ProjectPage "https://github.com/idiltugba/idiltech/blob/main/app/[project]/page.tsx"
    click GlobalsCSS "https://github.com/idiltugba/idiltech/blob/main/app/globals.css"
    click Face "https://github.com/idiltugba/idiltech/blob/main/components/face-animation/index.tsx"
    click Header "https://github.com/idiltugba/idiltech/blob/main/components/header.tsx"
    click Footer "https://github.com/idiltugba/idiltech/blob/main/components/footer.tsx"
    click Loading "https://github.com/idiltugba/idiltech/blob/main/components/loading.tsx"
    click Main "https://github.com/idiltugba/idiltech/blob/main/components/main.tsx"
    click Menu "https://github.com/idiltugba/idiltech/blob/main/components/sections/menu.tsx"
    click PinEntry "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/index.tsx"
    click PinStyles "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/styles.module.css"
    click Button "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/button.tsx"
    click HandleBall "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/handleBall.tsx"
    click HandleKey "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/handleKeyDown.tsx"
    click HandleGame "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/handleGame.tsx"
    click HandleScore "https://github.com/idiltugba/idiltech/blob/main/components/pinpongame/handleScoreBoard.tsx"
    click OldProj "https://github.com/idiltugba/idiltech/blob/main/components/oldprojects.json"
    click Works "https://github.com/idiltugba/idiltech/blob/main/components/works.json"
    click Social "https://github.com/idiltugba/idiltech/blob/main/components/social.json"
    click Public "https://github.com/idiltugba/idiltech/tree/main/public/"

    %% Styles
    classDef compute fill:#cfe2f3,stroke:#000,stroke-width:1px
    classDef code fill:#d9ead3,stroke:#000,stroke-width:1px
    classDef assets fill:#fff2cc,stroke:#000,stroke-width:1px
    classDef data fill:#f4cccc,stroke:#000,stroke-dasharray:5 5,stroke-width:1px
```
