# eduabenathar/cheatsheets architecture

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

- Interactive diagram: https://gitdiagram.com/eduabenathar/cheatsheets
- Repository: https://github.com/eduabenathar/cheatsheets

## Overview

##### Project Type Analysis
This is a static website generator built with Astro.js that serves as a documentation platform for developer cheatsheets. The project uses modern web technologies and follows a JAMstack architecture.

##### Main Components

a. Content Layer:
- Markdown files (*.md) containing cheatsheets
- Ruby-based preprocessing (src/ruby/)
- Kramdown rendering system

b. Build System:
- Astro.js framework
- Vite bundler
- PostCSS processing
- TypeScript compilation

c. Frontend Architecture:
- Components (src/components/)
- Layouts (BaseLayout)
- Pages (src/pages/)
- Styles (src/sass/)

d. Search & Analytics:
- Fuse.js search implementation
- Google Analytics integration
- Cloudflare Analytics

**┌─────────────────────────────────────────────────────┐**
- Client Browser                      │
- ┘
- ↑

**┌─────────────────────────────────────────────────────┐**
- Static Hosting                      │
- (Netlify/CloudFlare)                   │
- ┘
- ↑

**┌─────────────────────────────────────────────────────┐**
- Build Process                        │
- ┬─────────────────┬─────────────────┤
- Astro.js      │    Ruby         │     Assets      │
- Processing    │    Preprocessing │     Pipeline    │
- ┴─────────────────┴─────────────────┘
- ↑

**┌─────────────────────────────────────────────────────┐**
- Source Content                       │
- ┬─────────────────┬─────────────────┤
- Markdown      │    Components   │     Styles      │
- Cheatsheets   │    & Layouts    │     (SASS)      │
- ┴─────────────────┴─────────────────┘

##### Important Relationships to Highlight

a. Content Flow:
- Markdown → Ruby Preprocessing → Astro Build → Static HTML
- SASS → PostCSS → CSS Output
- TypeScript → JavaScript Bundle

b. Runtime Features:
- Client-side search implementation
- Analytics integration
- SEO optimization

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        Browser["Web Browser"]
        Search["Client-Side Search"]:::search
        Analytics["Analytics Tracking"]:::analytics
    end

    subgraph Hosting["Hosting Layer"]
        StaticHost["Static Hosting (Netlify/Cloudflare)"]:::hosting
    end

    subgraph Build["Build Process Layer"]
        Astro["Astro.js Build System"]:::build
        click Astro "https://github.com/eduabenathar/cheatsheets/blob/master/astro.config.mjs"
        
        Vite["Vite Bundler"]:::build
        click Vite "https://github.com/eduabenathar/cheatsheets/blob/master/vite.config.js"
        
        PostCSS["PostCSS Processing"]:::build
        click PostCSS "https://github.com/eduabenathar/cheatsheets/blob/master/postcss.config.js"
        
        TypeScript["TypeScript Compilation"]:::build
        click TypeScript "https://github.com/eduabenathar/cheatsheets/blob/master/tsconfig.json"
    end

    subgraph Content["Content Processing Layer"]
        RubyPreprocess["Ruby Preprocessing"]:::ruby
        click RubyPreprocess "https://github.com/eduabenathar/cheatsheets/tree/master/src/ruby/"
        
        KramdownEngine["Kramdown Engine"]:::ruby
        click KramdownEngine "https://github.com/eduabenathar/cheatsheets/blob/master/src/ruby/kramdown.rb"
        
        RenderEngine["Render Engine"]:::ruby
        click RenderEngine "https://github.com/eduabenathar/cheatsheets/blob/master/src/ruby/renderer.rb"
    end

    subgraph Frontend["Frontend Layer"]
        Components["Components"]:::frontend
        click Components "https://github.com/eduabenathar/cheatsheets/tree/master/src/components/"
        
        BaseLayout["Base Layout"]:::frontend
        click BaseLayout "https://github.com/eduabenathar/cheatsheets/blob/master/src/components/BaseLayout.astro"
        
        Pages["Pages"]:::frontend
        click Pages "https://github.com/eduabenathar/cheatsheets/tree/master/src/pages/"
        
        Styles["Styles (SASS)"]:::styles
        click Styles "https://github.com/eduabenathar/cheatsheets/tree/master/src/sass/"
        
        SearchImpl["Search Implementation"]:::search
        click SearchImpl "https://github.com/eduabenathar/cheatsheets/blob/master/src/lib/fuseSearch/fuseSearch.ts"
        
        SEO["SEO Components"]:::seo
        click SEO "https://github.com/eduabenathar/cheatsheets/tree/master/src/components/SEO/"
        
        GATracker["Google Analytics"]:::analytics
        click GATracker "https://github.com/eduabenathar/cheatsheets/blob/master/src/analytics/GoogleAnalytics.astro"
        
        CFTracker["Cloudflare Analytics"]:::analytics
        click CFTracker "https://github.com/eduabenathar/cheatsheets/blob/master/src/analytics/CloudflareAnalytics.astro"
    end

    Browser --> Search
    Browser --> Analytics
    StaticHost --> Browser
    Build --> StaticHost
    Content --> Build
    Frontend --> Build
    RubyPreprocess --> KramdownEngine
    KramdownEngine --> RenderEngine
    Components --> BaseLayout
    BaseLayout --> Pages
    SearchImpl --> Search
    GATracker --> Analytics
    CFTracker --> Analytics

    classDef hosting fill:#3498db,stroke:#2980b9,color:white
    classDef build fill:#2ecc71,stroke:#27ae60,color:white
    classDef ruby fill:#e74c3c,stroke:#c0392b,color:white
    classDef frontend fill:#9b59b6,stroke:#8e44ad,color:white
    classDef search fill:#f1c40f,stroke:#f39c12,color:black
    classDef analytics fill:#1abc9c,stroke:#16a085,color:white
    classDef styles fill:#e67e22,stroke:#d35400,color:white
    classDef seo fill:#95a5a6,stroke:#7f8c8d,color:white
```
