# big-ouden/blog-astro architecture

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

- Interactive diagram: https://gitdiagram.com/big-ouden/blog-astro
- Repository: https://github.com/big-ouden/blog-astro

## Overview

##### Project type and purpose
This is a static-site personal blog built on Astro. Markdown files under src/blog/* provide content, Astro (.astro) components and layouts render that content at build time, and the resulting static files are served via Nginx inside a Docker container. CI/CD (GitHub Actions) automates build and deployment.

##### Main components
- Source code repository (GitHub)
- CI/CD pipeline (GitHub Actions workflow)
- Build environment (Node.js, NPM, Astro, TypeScript, ESLint)
- Content layer (Markdown posts, images, localization in src/blog and src/i18n)
- Component layer (Astro, UI components, layouts in src/components and src/layouts)
- Output artifacts (static files in ./dist)
- Containerization (Dockerfile, docker-compose.yaml)
- Web server (Nginx with nginx.conf)
- Deployment orchestration (redeploy.sh, Traefik labels via docker-compose)
- End user (web browser)

##### Component relationships & flow
1. Developer pushes code to GitHub.
2. GitHub Actions trigger on main branch, install dependencies (`npm install`), lint, run `npm run build`.
3. Astro reads Markdown + .astro templates, generates static HTML/CSS/JS in ./dist.
4. CI job builds a Docker image: base = node (build stage) → copy dist → Nginx stage.
5. Docker image is tagged and published to the deployment host (or registry).
6. redeploy.sh (or docker-compose up) pulls the new image, starts container behind Traefik.
7. Nginx serves static files to the end user’s browser over HTTP(S).

##### Architectural patterns & design principles
- Static site generation (SSG) for speed, SEO, and simplicity.
- “Infrastructure as code” for deployment (Docker, docker-compose).
- CI/CD pipeline ensures consistency & repeatability.
- Single Responsibility: Markdown only for content, components/layouts only for UI.
- Localization (i18n folder, subfolders in src/pages and src/blog/posts).

##### Technologies, frameworks, key libraries
- Astro (static site generator)
- Node.js & NPM (build environment)
- TypeScript (type safety & config via tsconfig.json)
- ESLint (code quality)
- Docker & Docker-Compose (containerization)
- Nginx (static file server)
- GitHub Actions (CI/CD)
- Traefik or your reverse proxy (labels in docker-compose)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development & CI Stage
    subgraph "Development & CI" 
        direction TB
        GitHub["GitHub Repo"]:::dev
        CI["CI/CD Pipeline"]:::dev
        subgraph "Content & Configuration"
            direction TB
            PostsEN["Blog Posts EN"]:::dev
            PostsFR["Blog Posts FR"]:::dev
            ProjectsEN["Blog Projects EN"]:::dev
            ProjectsFR["Blog Projects FR"]:::dev
            I18nUtils["Localization Utilities"]:::dev
            Components["UI Component Library"]:::dev
            Layouts["Layout Templates"]:::dev
            Pages["Page Templates & Routes"]:::dev
            Styles["Global Stylesheet"]:::dev
            Assets["Static Assets"]:::dev
            Scripts["Client‐side Scripts"]:::dev
        end
    end

    GitHub -->|"git push"| CI
    CI -->|"runs build"| BuildEnv

    %% Build & Containerization Stage
    subgraph "Build & Containerization"
        direction TB
        BuildEnv["Build Environment\n(Node.js, NPM)"]:::build
        ConfigFiles["Build Configuration Files"]:::build
        AstroEngine["Astro Engine\n(.md + .astro → HTML/CSS/JS)"]:::build
        StaticDist["Static Files (./dist)"]:::build
        DockerBuild["Docker Build\n(Node build → Nginx stage)"]:::build
        Registry[(Image Registry)]:::build
    end

    BuildEnv --> ConfigFiles
    ConfigFiles --> AstroEngine
    AstroEngine --> StaticDist
    StaticDist --> DockerBuild
    DockerBuild --> Registry

    %% Runtime & Serving Stage
    subgraph "Runtime & Serving"
        direction TB
        Host["Deployment Host"]:::runtime
        Nginx["Nginx Container"]:::runtime
        Browser["End User Browser"]:::runtime
    end

    Registry -->|"pull image / redeploy.sh"| Host
    Host --> Nginx
    Nginx -->|"HTTP(S) Static File Serve"| Browser

    %% Click Events
    click CI "https://github.com/big-ouden/blog-astro/blob/main/.github/workflows/deploy.yml"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/package.json"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/package-lock.json"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/astro.config.mjs"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/tsconfig.json"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/eslint.config.cjs"
    click ConfigFiles "https://github.com/big-ouden/blog-astro/blob/main/.eslintrc.cjs"
    click PostsEN "https://github.com/big-ouden/blog-astro/tree/main/src/blog/posts/en/"
    click PostsFR "https://github.com/big-ouden/blog-astro/tree/main/src/blog/posts/fr/"
    click ProjectsEN "https://github.com/big-ouden/blog-astro/tree/main/src/blog/projects/en/"
    click ProjectsFR "https://github.com/big-ouden/blog-astro/tree/main/src/blog/projects/fr/"
    click I18nUtils "https://github.com/big-ouden/blog-astro/blob/main/src/i18n/ui.ts"
    click I18nUtils "https://github.com/big-ouden/blog-astro/blob/main/src/i18n/utils.ts"
    click Components "https://github.com/big-ouden/blog-astro/tree/main/src/components/"
    click Layouts "https://github.com/big-ouden/blog-astro/tree/main/src/layouts/"
    click Pages "https://github.com/big-ouden/blog-astro/tree/main/src/pages/"
    click Styles "https://github.com/big-ouden/blog-astro/blob/main/src/styles/global.css"
    click Assets "https://github.com/big-ouden/blog-astro/tree/main/assets/"
    click Assets "https://github.com/big-ouden/blog-astro/tree/main/src/images/"
    click Scripts "https://github.com/big-ouden/blog-astro/blob/main/src/scripts/menu.js"
    click DockerBuild "https://github.com/big-ouden/blog-astro/tree/main/Dockerfile"
    click DockerBuild "https://github.com/big-ouden/blog-astro/blob/main/docker-compose.yaml"
    click Nginx "https://github.com/big-ouden/blog-astro/blob/main/nginx.conf"
    click Host "https://github.com/big-ouden/blog-astro/blob/main/redeploy.sh"

    %% Styles
    classDef dev fill:#bbdefb,stroke:#1e88e5,color:#0d47a1;
    classDef build fill:#ffe0b2,stroke:#f57c00,color:#e65100;
    classDef runtime fill:#c8e6c9,stroke:#43a047,color:#1b5e20;
```
