# fxianglong/interview architecture

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

- Interactive diagram: https://gitdiagram.com/fxianglong/interview
- Repository: https://github.com/fxianglong/interview

## Overview

##### Project Type and Purpose
- It’s primarily a **static documentation site** (a “Docsify”‐powered knowledge base) with accompanying C/C++ code examples (algorithms, data structures, design patterns, problems, STL usage).
- The README and `docs/` folder drive the hosted site; the top‐level folders (`Algorithm/`, `DataStructure/`, `DesignPattern/`, etc.) are source directories for reference code.

##### Top‐Level Folder Analysis
- `/docs`: markdown + HTML/CSS/JS for the Docsify web UI. Contains `index.html`, nav config, CNAME, static assets.
- `Algorithm/`, `DataStructure/`, `DesignPattern/`, `Problems/`, `STL/`, …: code‐example modules, each with its own substructure and sometimes local READMEs or binaries.
- `README.md`, `README_en.md`: root landing documentation.
- Git metadata: `.gitignore`, `LICENSE`.

##### Runtime Site Architecture
- **User (Browser)** loads site URL (e.g. `https://interview.huihut.com`).
- **GitHub Pages / Static‐host (Netlify / Docsify)** serves `docs/index.html` plus JS/CSS.
- **Docsify Engine** (client‐side JavaScript) dynamically pulls markdown files from `/docs` and from the repo root (via relative paths) to render nav, pages, code snippets.
- **Static Assets** (`images/`, any local READMEs) get fetched by the browser as needed.

##### Main Components
a. **Browser/Client** – Runs Docsify single‐page app, renders markdown → HTML.
b. **Docsify JS Engine** – Interprets `index.html` + `_navbar.md` + `_sidebar.md` + markdown files.
c. **Markdown Content** – All `.md` under `docs/` and root that Docsify serves.
d. **Code Modules** – Algorithm, DataStructure, DesignPattern, Problems, STL folders (these live in the repo and get linked into the site as code blocks).
e. **Static Host** – GitHub Pages or equivalent (delivers HTML, JS, CSS, images, markdown).
f. **External Services** – DNS/CNAME (points custom domain to GitHub Pages), optionally Netlify/CDN.

##### Relationships & Data Flow
- Browser requests `/` → Host serves `index.html`
- Docsify JS fetches `_sidebar.md`, `_navbar.md`, then other `.md` on navigation
- When user clicks “Algorithm” → Docsify loads `Algorithm/README.md` or code listings via raw HTTP
- All content delivered over HTTPS by static host; no backend.

##### Architectural Patterns & Principles
- **Client‐Side Rendering**: Docsify SPA pattern.
- **Static Site Generation** (via markdown, but generated at runtime on client).
- **Modular Code Layout**: separate folders for each knowledge domain.
- **Progressive Enhancement**: plain HTML fallback if JS disabled.

##### Technologies & Frameworks
- Markdown for content
- Docsify JS (spa docs generator)
- HTML/CSS/JavaScript for UI
- Git/GitHub for source management
- GitHub Pages (or any static‐site hosting)
- CNAME DNS configuration for custom domain
- C/C++ (.h/.cpp) for code examples

- **Browser** (Client)
- **Docsify SPA** (JS Engine loaded by index.html)
- **Markdown Repositories** (`docs/*.md`, root READMEs)
- **Code Examples** (Algorithm/, DataStructure/, DesignPattern/, Problems/, STL/)
- **Static Host** (GitHub Pages)
- **DNS/CNAME** mapping to static host
- **Assets** directory (images/)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Side"
        Browser["Browser (Client)"]:::clientside
        Docsify["Docsify SPA (JS Engine)"]:::clientside
    end

    subgraph "Content Storage"
        DocsMD1["docs/README.md"]:::content
        DocsMD2["docs/en.md"]:::content
        RootMD1["README.md"]:::content
        RootMD2["README_en.md"]:::content
        Algorithm["Algorithm/"]:::content
        DataStructure["DataStructure/"]:::content
        DesignPattern["DesignPattern/"]:::content
        Problems["Problems/"]:::content
        STL["STL/"]:::content
        Images["images/"]:::content
    end

    subgraph "Infrastructure"
        DNS["DNS / CNAME"]:::infra
        StaticHost["Static Host (GitHub Pages)"]:::infra
        CNAME["CNAME Config"]:::infra
    end

    DNS --> StaticHost
    CNAME --> StaticHost

    Browser -->|GET index.html & JS/CSS| StaticHost
    StaticHost -->|Serve index.html, CSS, JS| Browser

    Browser -->|Load Docsify SPA| Docsify

    Docsify -->|GET docs/_navbar.md| StaticHost
    Docsify -->|GET docs/_sidebar.md| StaticHost
    Docsify -->|Fetch docs markdown| StaticHost
    Docsify -->|Fetch root markdown| StaticHost
    Docsify -->|Fetch code modules| StaticHost
    Docsify -->|Fetch images| StaticHost

    StaticHost -->|Serve docs markdown| DocsMD1
    StaticHost -->|Serve docs markdown| DocsMD2
    StaticHost -->|Serve root markdown| RootMD1
    StaticHost -->|Serve root markdown| RootMD2
    StaticHost -->|Serve code files| Algorithm
    StaticHost -->|Serve code files| DataStructure
    StaticHost -->|Serve code files| DesignPattern
    StaticHost -->|Serve code files| Problems
    StaticHost -->|Serve code files| STL
    StaticHost -->|Serve images| Images

    click Browser "https://github.com/fxianglong/interview/blob/master/docs/index.html"
    click Docsify "https://github.com/fxianglong/interview/blob/master/docs/_navbar.md"
    click DocsMD1 "https://github.com/fxianglong/interview/blob/master/docs/README.md"
    click DocsMD2 "https://github.com/fxianglong/interview/blob/master/docs/en.md"
    click RootMD1 "https://github.com/fxianglong/interview/blob/master/README.md"
    click RootMD2 "https://github.com/fxianglong/interview/blob/master/README_en.md"
    click Algorithm "https://github.com/fxianglong/interview/tree/master/Algorithm/"
    click DataStructure "https://github.com/fxianglong/interview/tree/master/DataStructure/"
    click DesignPattern "https://github.com/fxianglong/interview/tree/master/DesignPattern/"
    click Problems "https://github.com/fxianglong/interview/tree/master/Problems/"
    click STL "https://github.com/fxianglong/interview/tree/master/STL/"
    click CNAME "https://github.com/fxianglong/interview/tree/master/docs/CNAME"
    click Images "https://github.com/fxianglong/interview/tree/master/images/"

    classDef clientside fill:#e0f7fa,stroke:#006064
    classDef content fill:#e8f5e9,stroke:#2e7d32
    classDef infra fill:#fff3e0,stroke:#ef6c00
```
