# lpsm-dev/tech-blog architecture

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

- Interactive diagram: https://gitdiagram.com/lpsm-dev/tech-blog
- Repository: https://github.com/lpsm-dev/tech-blog

## Overview

##### Project Type & Purpose
- This project is a personal tech blog built with Astro. It uses a static-site generation approach where content is written in Markdown (organized by topics within the posts folder) and rendered into web pages. The project is designed to be simple yet practical—emphasizing fast, reliable builds, and a modern CI/CD pipeline via GitHub Actions. It also leverages best practices in naming, componentization (using atoms, molecules, and organisms), and configuration management (e.g., Tailwind CSS, ESLint).

##### Analyzing the File Structure
- Top-level directories include:
- “src”: contains the source code and is further divided into components (atoms, molecules, organisms), layouts, pages, plugins, and utilities.
- “posts”: holds Markdown files for blog posts (organized in subfolders by topics such as AI, Kubernetes, DevOps, etc.).
- “public”: contains static assets like images and fonts.
- “.github”: contains CI/CD configuration for GitHub Actions.
- Various configuration files (astro.config.mjs, tailwind.config.mjs, package.json) which define build, lint, and deployment tools.
- This separation reinforces a micro-architecture pattern: one part handles content (posts) and another handles code (with clearly modular components).

##### Main Components and Their Relationships
- Content Repository:
- “posts” folder: Markdown files with frontmatter metadata that determine how posts are rendered.
- Interaction: These files feed into the Astro build process via utility functions (e.g., parsing frontmatter, generating routes).
- Presentation Layer:
- “src/components”: Contains reusable UI components (atoms, molecules, organisms) that build up page designs.
- “src/layouts”: Defines the overall layout frameworks (BaseLayout, BlogPost layout) ensuring consistency across pages.
- “src/pages”: Contains route definitions that map URL paths to the generated blog pages.
- “src/styles”: Defines global styling including Tailwind CSS configurations.
- Build and Deployment:
- Configuration files (astro.config.mjs, tailwind.config.mjs, eslint.config.js, etc.) tie in the toolchain.
- CI/CD Pipeline: Defined in the “.github/workflows” directory. The pipeline executes steps to install dependencies, build the site, and deploy (to GitHub Pages in this case).
- External Services:
- GitHub Repository: Source code hosting.
- GitHub Actions and GitHub Pages: Automate the build process and host the deployed static site.
- Developer Workflow:
- Developer’s local environment uses the Taskfile.yaml and Devbox configuration to manage builds and dev dependencies.
- The commit process (via Conventional Commits) triggers the CI/CD pipeline in GitHub Actions.

##### Architectural Patterns & Technologies
- Static Site Generation using Astro.
- Component-Based Architecture with a clear separation into atoms, molecules, and organisms.
- CI/CD Automation with GitHub Actions, including workflows for quality, deploy, and release.
- The project also utilizes Tailwind CSS for styling and several utility functions (date formatting, image handling, etc.) to support dynamic content linking.
- It follows a “macro and micro” organizational approach where overall project structure (macro) is supported by fine-grained component organization (micro).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Developer Environment"]:::dev
    M["Taskfile.yaml & Devbox"]:::dev
    B["GitHub Repository"]:::repo
    C["CI/CD Pipeline"]:::build
    C1["Install Dependencies"]:::build
    C2["Build Site (CI/CD)"]:::build
    C3["Deploy Site"]:::build
    E["Static Site Build"]:::build
    F["GitHub Pages"]:::deploy
    G["Content Repository"]:::repo
    I["Utility Functions"]:::repo
    X["Astro Config"]:::build
    Y["ESLint Config"]:::repo

    A --> B
    A --> M
    B --> C
    C --> C1
    C1 --> C2
    C2 --> C3
    C3 --> E
    E --> F

    G --> X
    H --> X
    I --> X
    Y --> E
    X --> E

    subgraph "Presentation Layer"
        direction TB
        H["Presentation Layer"]:::repo
        H1["UI Components"]:::repo
        H2["Layouts"]:::repo
        H3["Pages"]:::repo
        H4["Global Styles"]:::repo
        H5["Tailwind Config"]:::repo
    end

    H --> H1
    H --> H2
    H --> H3
    H --> H4
    H --> H5

    subgraph "UI Components"
        direction TB
        J["Atoms"]:::repo
        K["Molecules"]:::repo
        L["Organisms"]:::repo
    end

    H1 --> J
    H1 --> K
    H1 --> L

    %% Connections from Presentation & Content to Static Build
    G --- X
    H --- X
    I --- X

    %% Styling Classes
    classDef dev fill:#FDF6E3,stroke:#657B83,stroke-width:2px;
    classDef repo fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef build fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px;
    classDef deploy fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px;

    %% Click Events
    click G "https://github.com/lpsm-dev/tech-blog/tree/main/posts/"
    click J "https://github.com/lpsm-dev/tech-blog/tree/main/src/components/atoms/"
    click K "https://github.com/lpsm-dev/tech-blog/tree/main/src/components/molecules/"
    click L "https://github.com/lpsm-dev/tech-blog/tree/main/src/components/organisms/"
    click H2 "https://github.com/lpsm-dev/tech-blog/tree/main/src/layouts/"
    click H3 "https://github.com/lpsm-dev/tech-blog/tree/main/src/pages/"
    click H4 "https://github.com/lpsm-dev/tech-blog/tree/main/src/styles/"
    click H5 "https://github.com/lpsm-dev/tech-blog/blob/main/tailwind.config.mjs"
    click X "https://github.com/lpsm-dev/tech-blog/blob/main/astro.config.mjs"
    click C "https://github.com/lpsm-dev/tech-blog/tree/main/.github/workflows/"
    click I "https://github.com/lpsm-dev/tech-blog/tree/main/src/utils/"
    click M "https://github.com/lpsm-dev/tech-blog/blob/main/Taskfile.yaml"
    click Y "https://github.com/lpsm-dev/tech-blog/blob/main/eslint.config.js"
```
