# fxpby/myblog architecture

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

- Interactive diagram: https://gitdiagram.com/fxpby/myblog
- Repository: https://github.com/fxpby/myblog

## Overview

##### Project type and purpose
- This is a JAMstack‐style static documentation and blog website built with Docusaurus.
- Purpose: serve docs (in /docs), blog posts (in /blog), custom React pages (in /src/pages), and custom interactive widgets (in /src/components) as a static site.

##### File structure
- Top‐level config: docusaurus.config.ts, sidebars.ts, package.json, tsconfig.json.
- Content directories:
- /docs – Markdown/MDX docs organized by category (coding, dishes, etc.).
- /blog – MDX posts plus authors.yml and tags.yml for metadata.
- /src/components – React components (DrawGift, FoodsCalories, WorkoutCycleCalc, HomepageFeatures, PostBlogs) used on custom pages.
- /src/pages – custom pages (index.tsx, markdown‐page.md).
- /static – images and static assets.
- CI/CD: .github/workflows/ci.yml (lint/build/test), host.yml (deploy to gh-pages).
- Build scripts: yarn start, yarn build, yarn deploy.

##### README for additional insights
- Confirms Docusaurus static site generator.
- Local dev uses a live‐reload dev server.
- Build outputs to /build; deploys via GitHub Pages.
- No runtime server or database; purely static hosting.

##### Main components and interactions
a. Components
- Developer Workstation (IDE, Git)
- GitHub Repository (code + content)
- CI/CD Pipeline (GitHub Actions)
- Docusaurus Build Process (Node.js + Yarn)
- Build Artifacts (/build directory)
- Static Hosting (GitHub Pages or CDN)
- End‐User Browser
b. Relationships & Data Flow
1. Developer pushes code/content → GitHub repo.
2. GitHub Actions CI (ci.yml) triggers: install, lint, test, build.
3. On success, host.yml deploys /build artifacts → gh-pages branch → GitHub Pages.
4. End‐User’s browser requests pages → served by GitHub Pages/CDN → loads static HTML/CSS/JS and assets from /static.
5. Components loaded in browser: React code from /src/components renders interactive widgets.
c. Architectural patterns & principles
- JAMstack: Pre‐build at deploy, serve static assets via CDN.
- File‐based routing (Docusaurus reads /docs and /blog).
- Component‐based UI (React in /src/components).
- CI/CD automation for build & deploy.
d. Key technologies/frameworks
- Docusaurus (static site generator)
- React & JSX/TSX components
- Markdown/MDX
- Node.js & Yarn/npm
- GitHub Actions (CI/CD)
- GitHub Pages (static hosting)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer and Repository
    Developer["Developer Workstation<br>(IDE & Git)"]:::dev
    GitHubRepo["GitHub Repository"]:::repoHost

    Developer -->|"push code"| GitHubRepo
    Developer -->|"yarn start (local preview)"| LocalDev["Local Dev Server<br>(live reload)"]:::build

    %% CI/CD Pipeline
    GitHubRepo -->|"trigger CI"| CI_YML_ACTION["GitHub Actions CI"]:::ci
    CI_YML_ACTION --> CI_Install["Install Dependencies"]:::ci
    CI_Install --> CI_LintTest["Lint & Test"]:::ci
    CI_LintTest --> DocusaurusBuild["Docusaurus Build Process"]:::build
    DocusaurusBuild --> BuildArtifacts["/build Directory"]:::artifact
    BuildArtifacts --> HOST_YML_ACTION["Deploy to GitHub Pages"]:::ci
    HOST_YML_ACTION --> StaticHosting["GitHub Pages / CDN"]:::hosting

    %% Runtime Flow
    LocalDev --> Browser["End-User Browser"]:::user
    StaticHosting -->|serves| Browser
    Browser -->|requests assets| STATIC
    Browser -->|loads JS widgets| DG
    Browser -->|loads JS widgets| FC
    Browser -->|loads JS widgets| WC
    Browser -->|loads JS widgets| HF
    Browser -->|loads JS widgets| PB

    %% Repository Contents
    subgraph "Code Repository" 
        CFG1["docusaurus.config.ts"]:::config
        SB["sidebars.ts"]:::config
        PKG["package.json"]:::config
        TSC["tsconfig.json"]:::config
        CCSS["src/css/custom.css"]:::config

        DOCS["/docs"]:::content
        BLOG["/blog"]:::content
        AuthYML["authors.yml"]:::content
        TagsYML["tags.yml"]:::content

        subgraph "Pages"
            P_IDX["index.tsx"]:::page
            P_MD["markdown-page.md"]:::page
        end

        subgraph "UI Components"
            DG["DrawGift"]:::component
            FC["FoodsCalories"]:::component
            WC["WorkoutCycleCalc"]:::component
            HF["HomepageFeatures"]:::component
            PB["PostBlogs"]:::component
        end

        STATIC["/static/img"]:::asset
        CI_YML[".github/workflows/ci.yml"]:::ci
        HOST_YML[".github/workflows/host.yml"]:::ci
    end

    %% Click Events
    click CFG1 "https://github.com/fxpby/myblog/blob/master/docusaurus.config.ts"
    click SB "https://github.com/fxpby/myblog/blob/master/sidebars.ts"
    click PKG "https://github.com/fxpby/myblog/blob/master/package.json"
    click TSC "https://github.com/fxpby/myblog/blob/master/tsconfig.json"
    click CCSS "https://github.com/fxpby/myblog/blob/master/src/css/custom.css"
    click DOCS "https://github.com/fxpby/myblog/tree/master/docs/"
    click BLOG "https://github.com/fxpby/myblog/tree/master/blog/"
    click AuthYML "https://github.com/fxpby/myblog/blob/master/blog/authors.yml"
    click TagsYML "https://github.com/fxpby/myblog/blob/master/blog/tags.yml"
    click P_IDX "https://github.com/fxpby/myblog/blob/master/src/pages/index.tsx"
    click P_MD "https://github.com/fxpby/myblog/blob/master/src/pages/markdown-page.md"
    click DG "https://github.com/fxpby/myblog/tree/master/src/components/DrawGift/"
    click FC "https://github.com/fxpby/myblog/tree/master/src/components/FoodsCalories/"
    click WC "https://github.com/fxpby/myblog/tree/master/src/components/WorkoutCycleCalc/"
    click HF "https://github.com/fxpby/myblog/tree/master/src/components/HomepageFeatures/"
    click PB "https://github.com/fxpby/myblog/tree/master/src/components/PostBlogs/"
    click STATIC "https://github.com/fxpby/myblog/tree/master/static/img/"
    click CI_YML "https://github.com/fxpby/myblog/blob/master/.github/workflows/ci.yml"
    click HOST_YML "https://github.com/fxpby/myblog/blob/master/.github/workflows/host.yml"

    %% Styles
    classDef dev fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef repoHost fill:#E0FFFF,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef content fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef page fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef component fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef asset fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef ci fill:#90EE90,stroke:#000,stroke-width:1px
    classDef build fill:#90EE90,stroke:#000,stroke-width:1px
    classDef artifact fill:#FFFACD,stroke:#000,stroke-width:1px
    classDef hosting fill:#FFA500,stroke:#000,stroke-width:1px
    classDef user fill:#FFA500,stroke:#000,stroke-width:1px
```
