# athachai29/athachai architecture

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

- Interactive diagram: https://gitdiagram.com/athachai29/athachai
- Repository: https://github.com/athachai29/athachai

## Overview

##### Main Components
- Client (User’s Browser): The entry point that requests pages, assets, and markdown content.
- Static Web Server/Hosting Environment: This is the platform (e.g., GitHub Pages, Netlify, or any static hosting) that serves the content.
- HTML Pages & Routing: The site’s root index.html along with pages in “pages/about” and “pages/articles” folders. Note that the routing mechanism may involve clean URLs without the ".html" extension.
- Markdown Content: Located in the “contents” folder, these markdown files are potentially processed (or directly rendered) via the JavaScript library.
- JavaScript Library (zero-md.js): This library helps in rendering markdown content to HTML in the browser.
- Styling: CSS files in the “styles” folder which dictate the visual presentation (general styles in index.css and specific markdown-related styles in markdown-styles.css).
- Media Assets: The “images” folder, which holds images used for styling, content, or visual content in the website.

##### Relationships and Interactions Between Components
- The Web Client loads the main index.html from the static hosting server.
- index.html references external stylesheets (the CSS files) and the JS file (zero-md.js) to ensure proper styling and dynamic markdown conversion.
- The user navigates to different sections (such as “about” or “articles”); each section is a separate HTML page with its own content, some pages may use markdown files from the “contents” folder.
- The JavaScript setup (zero-md.js) might dynamically fetch relevant markdown files from “contents” when a corresponding article page is accessed.
- Routing logic ensures the website URLs look clean (using techniques as described in the README reference).

##### Important Architectural Patterns and Design Principles
- Component Separation: Clearly distinguishing between static assets (HTML, CSS, images, JS) and content (markdown files and page-specific HTML).
- Clean URL Routing: The existence of a CNAME and reference article on URL rewriting to hide ".html" extensions shows web-routing design attention.
- Client-Side Processing: Using a zero-dependency JavaScript library to render markdown on the fly indicates a client-side rendering approach for some content.
- Minimalistic Architecture: Since this is a static website, there is no server-side backend component; everything is pre-generated or processed within the browser.

##### Relevant Technologies and Frameworks
- HTML, CSS, and JavaScript as the core client-side technologies.
- zero-md.js as the JavaScript library to handle markdown rendering.
- Static hosting (implied by files like CNAME and the simple structure).
- Markdown for content management, enabling writing in a simpler format which is then rendered to HTML.

##### Details
- Flow: from user request → web server delivery → client-side loading of HTML, CSS, JS → dynamic processing of markdown files.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Client (Browser)"]:::client

    subgraph "Static Web Server/Hosting"
        subgraph "HTML Pages & Routing"
            B1["index.html"]:::html
            B2["About Page (pages/about/index.html)"]:::html
            B3["Article Page (pages/articles/)"]:::html
        end
        C["Markdown Content (contents/)"]:::content
        D["JavaScript Rendering (zero-md.js)"]:::js
        subgraph "CSS Styling"
            E1["index.css (styles/index.css)"]:::css
            E2["Markdown Styles (styles/markdown-styles.css)"]:::css
        end
        F["Media Assets (images/)"]:::images
    end

    A -->|"GET"| B1
    B1 -->|"LoadsCSS"| E1
    B1 -->|"LoadsCSS"| E2
    B1 -->|"LoadsJS"| D
    D -->|"FetchesMarkdown"| C
    B1 -->|"RoutesTo"| B2
    B1 -->|"RoutesTo"| B3

    NOTE["Note:CleanURLs(without_.html_extension)"]:::note
    B1 --- NOTE

    click B1 "https://github.com/athachai29/athachai/blob/main/index.html"
    click B2 "https://github.com/athachai29/athachai/blob/main/pages/about/index.html"
    click B3 "https://github.com/athachai29/athachai/blob/main/pages/articles/my-personal-dashboard-journey/index.html"
    click C "https://github.com/athachai29/athachai/tree/main/contents/"
    click D "https://github.com/athachai29/athachai/blob/main/js/zero-md.js"
    click E1 "https://github.com/athachai29/athachai/blob/main/styles/index.css"
    click E2 "https://github.com/athachai29/athachai/blob/main/styles/markdown-styles.css"
    click F "https://github.com/athachai29/athachai/tree/main/images/"

    classDef client fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef html fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef js fill:#FFD54F,stroke:#FF6F00,stroke-width:2px;
    classDef css fill:#F8BBD0,stroke:#AD1457,stroke-width:2px;
    classDef content fill:#FFE0B2,stroke:#E65100,stroke-width:2px;
    classDef images fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef note fill:#E0F7FA,stroke:#006064,stroke-width:2px,stroke-dasharray:5 5;
```
