# jim2017jim/howtocook architecture

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

- Interactive diagram: https://gitdiagram.com/jim2017jim/howtocook
- Repository: https://github.com/jim2017jim/howtocook

## Overview

##### Project Type and Purpose
- This is an open-source, content-driven static web service project (“HowToCook”) that organizes cooking recipes (Markdown files) into a user-friendly website and PDF.
- It leverages GitHub for source control, GitHub Actions for CI/CD, MkDocs (Python) or a custom Node script to generate static HTML/PDF, and Docker to package the site as a containerized web server.

##### Key Components
a. Source Repository (GitHub)
- Contains:
- Content directories (`dishes/`, `tips/`, `starsystem/`) of Markdown files
- CI config (`.github/workflows/*.yml`) and lint/build scripts (`.github/manual_lint.js`, `readme-generate.js`)
- Dockerfile, `package.json` (Node), `requirements.txt` (Python)
b. Continuous Integration / Delivery (GitHub Actions)
- On each commit or PR:
- Lint Markdown / code
- Generate README/docs via script
- Build static site & PDF (via mkdocs or custom tool)
- Build and push Docker image to GitHub Container Registry
- (Optional) Publish to GitHub Pages or npm registry
c. Container Registry
- Hosts the built Docker image (`ghcr.io/anduin2017/how-to-cook:latest`)
d. Web Service Container
- Runtime: Python (MkDocs) or Node static-site server
- Exposes HTTP on port 5000, serving HTML and PDF at `/document.pdf`
e. End Users
- Pull and run Docker (`docker run -d -p 5000:5000 …`)
- Browse the site in a web browser
- Install CLI/npm package (`npm install how-to-cook`) if provided

##### Highlighted Patterns & Principles
- Content as Code: Markdown source drives site.
- CI/CD Pipeline: Automated lint, doc generation, build, and publish.
- Containerization: Single Dockerfile packaging static site server.
- Separation of Concerns:
- Content (Markdown) vs. Build (CI scripts) vs. Runtime (web server)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer
    Dev("Developer/Contributor"):::user

    %% GitHub Repository
    subgraph "GitHub Repository" 
        direction TB
        RepoContent["Content Directories"]:::repo
        dishes["dishes/"]:::repo
        tips["tips/"]:::repo
        stars["starsystem/"]:::repo
        CIConfig["CI/CD Workflows"]:::repo
        ciYML[".github/workflows/ci.yml"]:::repo
        buildYML[".github/workflows/build.yml"]:::repo
        lintScript["manual_lint.js"]:::repo
        genScript["readme-generate.js"]:::repo
        Templates["Templates"]:::repo
        mkdocsT["mkdocs_template.yml"]:::repo
        readmeT["readme_template.md"]:::repo
        DockerDef["Dockerfile"]:::repo
        pkgJSON["package.json"]:::repo
        pkgLock["package-lock.json"]:::repo
        reqs["requirements.txt"]:::repo
        mdLintCfg[".markdownlint.json"]:::repo
        textLint[".textlintrc"]:::repo
        prTemplate[".github/pull_request_template.md"]:::repo
        readmeProj["README.md"]:::repo
        contrib["CONTRIBUTING.md"]:::repo
        codeCond["CODE_OF_CONDUCT.md"]:::repo
        license["LICENSE"]:::repo
        gitignore[".gitignore"]:::repo
        dishesTemplate["dishes/template/示例菜/示例菜.md"]:::repo
    end

    %% CI/CD Pipeline
    subgraph "GitHub Actions CI/CD" 
        direction TB
        Lint["Lint & Test"]:::ci
        DocGen["Docs Generation"]:::ci
        SiteBuild["Static Site & PDF Build"]:::ci
        DockerPush["Docker Build & Push"]:::ci
    end

    %% Registry
    Registry(("Docker Registry")):::registry

    %% Runtime Container
    WebContainer["Web Server Container\n(port 5000)"]:::runtime

    %% End Users
    subgraph "End Users"
        direction TB
        Browser("Browser"):::user
        DockerCLI("Docker CLI"):::user
        Npm("npm"):::user
    end

    %% Connections
    Dev -->|"push code"| RepoContent
    RepoContent --> CIConfig
    CIConfig --> Lint
    Lint -->|"uses"| lintScript
    Lint -->|"config"| mdLintCfg
    Lint -->|"config"| textLint
    CIConfig --> DocGen
    DocGen -->|"script"| genScript
    DocGen -->|"template"| readmeT
    CIConfig --> SiteBuild
    SiteBuild -->|"mkdocs"| mkdocsT
    SiteBuild -->|"deps"| reqs
    SiteBuild --> Registry
    CIConfig --> DockerPush
    DockerPush -->|"Dockerfile"| DockerDef
    DockerPush -->|"npm scripts"| pkgJSON
    DockerPush --> Registry
    Registry --> WebContainer
    WebContainer -->|"serve HTML/PDF"| Browser
    Registry -->|"docker pull"| DockerCLI
    Registry -->|"npm install"| Npm

    %% Click events
    click dishes "https://github.com/jim2017jim/howtocook/tree/master/dishes/"
    click tips "https://github.com/jim2017jim/howtocook/tree/master/tips/"
    click stars "https://github.com/jim2017jim/howtocook/tree/master/starsystem/"
    click ciYML "https://github.com/jim2017jim/howtocook/blob/master/.github/workflows/ci.yml"
    click buildYML "https://github.com/jim2017jim/howtocook/blob/master/.github/workflows/build.yml"
    click lintScript "https://github.com/jim2017jim/howtocook/blob/master/.github/manual_lint.js"
    click genScript "https://github.com/jim2017jim/howtocook/blob/master/.github/readme-generate.js"
    click mkdocsT "https://github.com/jim2017jim/howtocook/blob/master/.github/templates/mkdocs_template.yml"
    click readmeT "https://github.com/jim2017jim/howtocook/blob/master/.github/templates/readme_template.md"
    click DockerDef "https://github.com/jim2017jim/howtocook/tree/master/Dockerfile"
    click pkgJSON "https://github.com/jim2017jim/howtocook/blob/master/package.json"
    click pkgLock "https://github.com/jim2017jim/howtocook/blob/master/package-lock.json"
    click reqs "https://github.com/jim2017jim/howtocook/blob/master/requirements.txt"
    click mdLintCfg "https://github.com/jim2017jim/howtocook/blob/master/.markdownlint.json"
    click textLint "https://github.com/jim2017jim/howtocook/blob/master/.textlintrc"
    click prTemplate "https://github.com/jim2017jim/howtocook/blob/master/.github/pull_request_template.md"
    click readmeProj "https://github.com/jim2017jim/howtocook/blob/master/README.md"
    click contrib "https://github.com/jim2017jim/howtocook/blob/master/CONTRIBUTING.md"
    click codeCond "https://github.com/jim2017jim/howtocook/blob/master/CODE_OF_CONDUCT.md"
    click license "https://github.com/jim2017jim/howtocook/tree/master/LICENSE"
    click gitignore "https://github.com/jim2017jim/howtocook/blob/master/.gitignore"
    click dishesTemplate "https://github.com/jim2017jim/howtocook/blob/master/dishes/template/示例菜/示例菜.md"

    %% Styles
    classDef repo fill:#D8BFD8,stroke:#800080,stroke-width:2px
    classDef ci fill:#E6E6FA,stroke:#9370DB,stroke-width:2px
    classDef registry fill:#98FB98,stroke:#00A000,stroke-width:2px
    classDef runtime fill:#ADD8E6,stroke:#0000CD,stroke-width:2px
    classDef user fill:#FFFFE0,stroke:#CCCC00,stroke-width:2px
```
