# jmustiola/share-it-blog architecture

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

- Interactive diagram: https://gitdiagram.com/jmustiola/share-it-blog
- Repository: https://github.com/jmustiola/share-it-blog

## Overview

##### Project type and purpose
- This is a static, content-driven blog built with the Astro framework. It pulls Markdown and YAML content (articles, authors, tags, resources) at build time, applies layout and component templates, and produces a purely static site.
- It includes a CI/CD pipeline (GitHub Actions) to build a Docker image and publish it, and uses Nginx (inside the Docker container) to serve the generated static files.

##### File structure
- Top-level:
- Dockerfile & .dockerignore → container build
- .github/workflows/docker-publish.yml → CI/CD pipeline
- .nginx/nginx.conf → production web server config
- astro.config.mjs, package.json, pnpm-lock.yaml, tsconfig.json → build tool and language configuration
- src/
- content/ (articles, authors, catalogs) → data sources (Markdown/YAML)
- layouts/ (Layout.astro) → page shells
- components/ (.astro, JSX, CSS) → UI building blocks
- pages/ (.astro + dynamic routes) → URL-to-page mapping
- public/ → static files copied verbatim (images, favicon)

##### README for additional insights
- Confirms key features (articles, tags, search, contributors), local dev commands, and project structure overview.
- Mentions deployment via `npm run build` → `dist/` folder, served on localhost:4321 in dev.

##### Main components in the system design
a. Content Sources
­– Markdown files (`src/content/articles`), YAML catalogs (`src/content/catalogs`), author metadata (`src/content/authors`).
b. Presentation Layer
– Astro pages (`src/pages`), layouts (`src/layouts/Layout.astro`), and UI components (`src/components`).
c. Build System
– Astro CLI + Node.js (driven by astro.config.mjs, package.json scripts, pnpm).
d. Static Assets
– public/, src/assets, src/styles.
e. CI/CD Pipeline
– GitHub Actions workflow (`.github/workflows/docker-publish.yml`) that builds a Docker image (Dockerfile) and pushes it to a registry.
f. Runtime / Hosting
– Docker container running Nginx (`.nginx/nginx.conf`), serving the `dist/` directory produced by `npm run build`.

##### Relationships and interactions
- Developer → push to GitHub → triggers GitHub Actions
- GitHub Actions → run build (`npm run build`) → generate `dist/`
- Build step → Dockerfile builds an image with static files + Nginx config
- CI → pushes Docker image to registry
- Hosting → container pulls image, Nginx serves static site
- At runtime → client browsers request HTML/CSS/JS via Nginx; no dynamic backend calls

##### Architectural patterns & principles
- Static Site Generation (SSG)
- Component-based UI (Astro-based .astro and React/JSX components)
- Content-as-data (Markdown/YAML pipelines)
- Twelve-factor app style containerization for deployment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Systems
    Developer["Developer"]:::external
    GitHub["GitHub Repo"]:::external
    Browser["Client Browser"]:::external

    %% Content & Code
    subgraph "Content & Code"
        CS1["src/content/articles"]:::content
        CS2["src/content/authors"]:::content
        CS3["src/content/catalogs"]:::content
        CS4["src/content.config.ts"]:::content
        Pages["src/pages"]:::content
        Layouts["src/layouts/Layout.astro"]:::content
        Components["src/components"]:::content
        Icons["src/icons"]:::content
        Public["public/"]:::content
        Assets["src/assets"]:::content
        GStyles["src/styles/globals.css"]:::content
        TStyles["src/styles/typography.css"]:::content
    end

    %% Build & CI
    subgraph "Build & CI"
        GitHubActions["GitHub Actions"]:::buildci
        AstroConfig["astro.config.mjs"]:::buildci
        Package["package.json"]:::buildci
        Lock["pnpm-lock.yaml"]:::buildci
        TSConfig["tsconfig.json"]:::buildci
        AstroBuild["Astro Build (npm run build)"]:::buildci
        Dockerfile["Dockerfile"]:::buildci
        DockerIgnore[".dockerignore"]:::buildci
    end

    %% Deployment & Runtime
    subgraph "Deployment & Runtime"
        DockerImage["Docker Image"]:::deploy
        Registry["Image Registry"]:::external
        Nginx["Nginx Container"]:::deploy
    end

    %% Flows
    Developer -->|push code| GitHub
    GitHub -->|trigger CI| GitHubActions

    %% Build dependencies
    CS1 --> AstroBuild
    CS2 --> AstroBuild
    CS3 --> AstroBuild
    CS4 --> AstroBuild
    Pages --> AstroBuild
    Layouts --> AstroBuild
    Components --> AstroBuild
    Icons --> AstroBuild
    Public --> AstroBuild
    Assets --> AstroBuild
    GStyles --> AstroBuild
    TStyles --> AstroBuild
    AstroConfig --> AstroBuild
    Package --> AstroBuild
    Lock --> AstroBuild
    TSConfig --> AstroBuild
    GitHubActions --> AstroBuild

    %% Docker build
    AstroBuild -->|produce dist| Dockerfile
    GitHubActions --> Dockerfile
    DockerIgnore -.-> Dockerfile
    Dockerfile --> DockerImage

    %% Deployment
    DockerImage --> Registry
    Registry --> Nginx

    %% Runtime
    Browser -->|HTTP request| Nginx
    Nginx -->|serve files| Browser

    %% Click Events
    click CS1 "https://github.com/jmustiola/share-it-blog/tree/master/src/content/articles"
    click CS2 "https://github.com/jmustiola/share-it-blog/tree/master/src/content/authors"
    click CS3 "https://github.com/jmustiola/share-it-blog/tree/master/src/content/catalogs"
    click CS4 "https://github.com/jmustiola/share-it-blog/blob/master/src/content.config.ts"
    click Pages "https://github.com/jmustiola/share-it-blog/tree/master/src/pages"
    click Layouts "https://github.com/jmustiola/share-it-blog/blob/master/src/layouts/Layout.astro"
    click Components "https://github.com/jmustiola/share-it-blog/tree/master/src/components"
    click Icons "https://github.com/jmustiola/share-it-blog/tree/master/src/icons"
    click Public "https://github.com/jmustiola/share-it-blog/tree/master/public/"
    click Assets "https://github.com/jmustiola/share-it-blog/tree/master/src/assets"
    click GStyles "https://github.com/jmustiola/share-it-blog/blob/master/src/styles/globals.css"
    click TStyles "https://github.com/jmustiola/share-it-blog/blob/master/src/styles/typography.css"
    click AstroConfig "https://github.com/jmustiola/share-it-blog/blob/master/astro.config.mjs"
    click Package "https://github.com/jmustiola/share-it-blog/blob/master/package.json"
    click Lock "https://github.com/jmustiola/share-it-blog/blob/master/pnpm-lock.yaml"
    click TSConfig "https://github.com/jmustiola/share-it-blog/blob/master/tsconfig.json"
    click GitHubActions "https://github.com/jmustiola/share-it-blog/blob/master/.github/workflows/docker-publish.yml"
    click Dockerfile "https://github.com/jmustiola/share-it-blog/tree/master/Dockerfile"
    click DockerIgnore "https://github.com/jmustiola/share-it-blog/blob/master/.dockerignore"
    click Nginx "https://github.com/jmustiola/share-it-blog/blob/master/.nginx/nginx.conf"

    %% Styles
    classDef content fill:#a0eac0,stroke:#2f6f4e,color:#000
    classDef buildci fill:#81c8f7,stroke:#1f5e9e,color:#000
    classDef deploy fill:#ffcb80,stroke:#b7761e,color:#000
    classDef external fill:#d3d3d3,stroke:#888888,color:#000
```
