# bernankez/blog architecture

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

- Interactive diagram: https://gitdiagram.com/bernankez/blog
- Repository: https://github.com/bernankez/blog

## Overview

##### Main Components
- Content Repository: The "content" directory holds all the Markdown files for different blog categories (e.g., blog posts, tech articles, stereotyped writings). This acts as the core data source for the blog.
- Static Site Generator (VitePress): The project is powered by VitePress. The ".vitepress" directory contains configuration files (config.ts) and a custom theme (inside .vitepress/theme) which are essential for rendering the site.
- Custom Theme & Components: Two locations house custom UI components:
- The ".vitepress/theme" folder customizes VitePress’s inbuilt theme.
- The "theme" directory contains additional Vue components, layouts, global components, composables, styles, and utilities that enhance and extend the UI and interactivity.
- Build & Configuration: Files like "vite.config.ts", "uno.config.ts", "pnpm-lock.yaml", and package.json define the development environment, build process, and dependency management.
- External Services: Although the core of the system is static, the README references external GitHub Issues for blog comments, adding an integration point for user interaction.

##### Relationships and Data Flow
- The Markdown content from the "content" directory is processed by VitePress.
- VitePress, guided by its configuration in ".vitepress/config.ts," integrates with the developer-defined theme (both in .vitepress/theme and the "theme" directory) to render pages.
- Vue components defined in the "theme/components" folder (both in common and global directories) are used to build the interactive parts of the site (navigation, search, code previews, etc.).
- Build tools and configuration files orchestrate the transformation process from Markdown to a fully rendered static website.
- The build process triggered by commands (e.g., “pnpm dev”) bundles these components, applying styles (found in "theme/styles") and utility functions (in "theme/utils" and "theme/composables").

##### Key Architectural Patterns and Design Principles
- Separation of Concerns: Content (Markdown files), presentation (custom themes and Vue components), configuration (VitePress and build tool settings), and external integrations (blog comments) are clearly separated.
- Static Site Generation: The design leverages VitePress for fast, static site generation with reactive Vue components to create a dynamic user experience despite being a static site.
- Customizability & Modular Design: The theme components, composables, and utilities indicate a modular approach to handle UI functionality and site behavior.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Content Layer
    subgraph "Content Layer"
        C_Content["Content (Markdown Files)"]:::content
    end

    %% VitePress Engine
    subgraph "VitePress Engine"
        VP_VP["VitePress Static Site Generator"]:::engine
        VP_Config["Config (.vitepress/config.ts)"]:::engine
        VP_Theme["Theme (.vitepress/theme)"]:::engine
        VP_VP -->|"includes"| VP_Config
        VP_VP -->|"includes"| VP_Theme
    end

    %% Custom Theme & Vue Components
    subgraph "Custom Theme & Vue Components"
        CT_Main["Custom Theme & Vue Components"]:::theme
        T_Layout["Layout.vue"]:::theme
        T_Components["Components"]:::theme
        T_Composables["Composables"]:::theme
        T_Styles["Styles"]:::theme
        T_Utils["Utils"]:::theme
        CT_Main -->|"contains"| T_Layout
        CT_Main -->|"contains"| T_Components
        CT_Main -->|"contains"| T_Composables
        CT_Main -->|"contains"| T_Styles
        CT_Main -->|"contains"| T_Utils
        T_Components -->|"integrates"| BI["GitHub Comments Integration"]:::external
    end

    %% Build Tools & Configuration
    subgraph "Build Tools & Configuration"
        BT_Aggregate["Build Tools & Configuration"]:::build
        BT_Vite["vite.config.ts"]:::build
        BT_Uno["uno.config.ts"]:::build
        BT_Pkg["package.json"]:::build
        BT_Pnpm["pnpm-lock.yaml"]:::build
        BT_Aggregate -->|"defines"| BT_Vite
        BT_Aggregate -->|"defines"| BT_Uno
        BT_Aggregate -->|"defines"| BT_Pkg
        BT_Aggregate -->|"defines"| BT_Pnpm
    end

    %% Final Delivery
    U_Browser["User Browser (Static Site Delivery)"]:::user

    %% Connections and Data Flow
    C_Content -->|"processesMarkdown"| VP_VP
    VP_VP -->|"rendersUsing"| CT_Main
    BT_Aggregate -->|"orchestrates"| VP_VP
    BT_Aggregate -->|"bundles"| CT_Main
    CT_Main -->|"deliversSite"| U_Browser

    %% Click Events
    click C_Content "https://github.com/bernankez/blog/tree/master/content"
    click VP_Config "https://github.com/bernankez/blog/blob/master/.vitepress/config.ts"
    click VP_Theme "https://github.com/bernankez/blog/tree/master/.vitepress/theme"
    click CT_Main "https://github.com/bernankez/blog/tree/master/theme"
    click T_Layout "https://github.com/bernankez/blog/blob/master/theme/Layout.vue"
    click T_Components "https://github.com/bernankez/blog/tree/master/theme/components"
    click T_Composables "https://github.com/bernankez/blog/tree/master/theme/composables"
    click T_Styles "https://github.com/bernankez/blog/tree/master/theme/styles"
    click T_Utils "https://github.com/bernankez/blog/tree/master/theme/utils"
    click BI "https://github.com/bernankez/blog/blob/master/theme/components/common/BGitalk.vue"
    click BT_Vite "https://github.com/bernankez/blog/blob/master/vite.config.ts"
    click BT_Uno "https://github.com/bernankez/blog/blob/master/uno.config.ts"
    click BT_Pkg "https://github.com/bernankez/blog/blob/master/package.json"
    click BT_Pnpm "https://github.com/bernankez/blog/blob/master/pnpm-lock.yaml"

    %% Styles
    classDef content fill:#f4c2c2,stroke:#333,stroke-width:2px;
    classDef engine fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef theme fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef build fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef user fill:#e6e6fa,stroke:#333,stroke-width:2px;
```
