# karanpratapsingh/learn-go architecture

> Architecture diagram of the GitHub repository karanpratapsingh/learn-go, 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/karanpratapsingh/learn-go
- Repository: https://github.com/karanpratapsingh/learn-go

## Overview

##### Project Type and Purpose
- This is a self-contained “Learn Go” course repository. It holds:
- Course content (README.md with Markdown lessons)
- Code examples (main.go and chapters in the README)

##### Key Components
a. Content Layer
- README.md (master course text)
- Additional chapter material embedded in Markdown
b. Code Examples
- `main.go` (demo program)
- Go toolchain for building/running examples
- Outputs (PNG/SVG) generated for documentation
d. Configuration & CI
- `.github/` workflows (issue templates, funding, stale bot)
- GitHub Actions or Pages config for build/deploy
e. Distribution Channels (External Services)
- GitHub (source & Pages)
- Leanpub (ebook)
- Personal website (karanpratapsingh.com)

##### Relationships & Data Flows
- Upon push to GitHub:
- CI pipeline runs “go build” / “go fmt” on code examples
- Static site generator (or simple Jekyll/GitHub Pages) transforms Markdown + images into HTML
- Ebook (Leanpub) built from Markdown and asset bundle
- Learner accesses content via: GitHub website, personal site, or ebook

##### Architectural Patterns & Principles
- Single-repository content management (monorepo for all teaching assets)
- Content–build–deploy pipeline (similar to “docs as code”)
- Immutable artifacts: generated site and ebook are reproducible from source

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Authoring Environment
    subgraph "Authoring Environment"
        Markdown["README.md"]:::source
        Code["main.go"]:::source
        DiagramsSource["diagrams/*.drawio"]:::source
        DiagramsReadme["diagrams/README.md"]:::source
        CIConfig[".github/"]:::source
        VSCode["VS Code + Go CLI + Draw.io"]:::external
    end

    %% GitHub Repository
    Repo["GitHub Repository"]:::storage

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        Build["Go build & fmt"]:::build
        Export["Draw.io export"]:::build
        SiteGen["Site generator"]:::build
        Publish["Publish Artifacts"]:::build
    end

    %% Outputs
    Site["GitHub Pages (HTML Site)"]:::output
    Leanpub["Leanpub (ebook/PDF)"]:::external
    Personal["Personal Website Hosting"]:::external

    %% Learner
    Learner["Learner"]:::external

    %% Connections
    Markdown -->|edits & git push| Repo
    Code --> Repo
    DiagramsSource --> Repo
    DiagramsReadme --> Repo
    CIConfig --> Repo
    VSCode --> Markdown
    VSCode --> Code
    VSCode --> DiagramsSource
    Repo -->|trigger CI| Build
    Build --> Export
    Export --> SiteGen
    SiteGen --> Publish
    Publish --> Site
    Publish --> Leanpub
    Publish --> Personal
    Learner -->|reads| Site
    Learner -->|reads| Leanpub
    Learner -->|visits| Personal

    %% Click Events
    click Markdown "https://github.com/karanpratapsingh/learn-go/blob/main/README.md"
    click Code "https://github.com/karanpratapsingh/learn-go/blob/main/main.go"
    click DiagramsSource "https://github.com/karanpratapsingh/learn-go/tree/main/diagrams/"
    click DiagramsReadme "https://github.com/karanpratapsingh/learn-go/blob/main/diagrams/README.md"
    click CIConfig "https://github.com/karanpratapsingh/learn-go/tree/main/.github/"

    %% Styles
    classDef source fill:#e6ffe6,stroke:#339933,stroke-width:1px
    classDef build fill:#ffe6cc,stroke:#cc6600,stroke-width:1px
    classDef output fill:#cce6ff,stroke:#0066cc,stroke-width:1px
    classDef external fill:#e6ccff,stroke:#663399,stroke-width:1px
    classDef storage fill:#f2f2f2,stroke:#333333,stroke-width:1px
```
