# hiteshchoudhary/golang architecture

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

- Interactive diagram: https://gitdiagram.com/hiteshchoudhary/golang
- Repository: https://github.com/hiteshchoudhary/golang

## Overview

##### Project type and purpose
- This is not a single‐app codebase but an educational “Golang series” repository. It contains ~28 standalone Go examples (01hello → 28channels), two more elaborate Go web/API projects (buildapi and mongoapi), and a small Node.js demo server (lcowebserver).
- Purpose: teach Go basics (syntax, data types, control flow, functions, methods), web requests/JSON, modules, building REST APIs, MongoDB integration, and concurrency primitives.

##### File structure
- Top‐level numbered dirs (01hello … 28channels): each is an independent `go.mod` + `main.go` CLI demo.
- “mymodules” + “vendor”: demo publishing & consuming local modules.
- “buildapi”: simple Go REST API (single folder).
- “mongoapi”: MVC‐style Go API with three subpackages—controller, model, router—and external MongoDB.
- “lcowebserver”: Node.js Express server (static/demo front end).
- No monolithic build scripts: each subfolder is its own Go module or Node project.

##### Key README insights
- Sections 01–08 in the README map exactly to the numbered example folders and web/API demos.
- Emphasizes topics: Go fundamentals → modules & web → REST APIs → MongoDB → concurrency.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Go CLI Examples Cluster
    subgraph "Go CLI Examples" 
        direction TB
        D01["01hello"]:::cli
        D02["02variables"]:::cli
        D03["03types"]:::cli
        D04["04functions"]:::cli
        D05["05flowcontrol"]:::cli
        D06["06arrays"]:::cli
        D07["07slices"]:::cli
        D08["08maps"]:::cli
        D09["09structs"]:::cli
        D10["10pointers"]:::cli
        D11["11methods"]:::cli
        D12["12interfaces"]:::cli
        D13["13errors"]:::cli
        D14["14files"]:::cli
        D15["15json"]:::cli
        D16["16packages"]:::cli
        D17["17testing"]:::cli
        D18["18httpclient"]:::cli
        D19["19httphandlers"]:::cli
        D20["20templating"]:::cli
        D21["21concurrencyintro"]:::cli
        D22["22waitgroups"]:::cli
        D23["23channelsdemo"]:::cli
        D24["24mymodulesdemo"]:::cli
        D25["25vendoring"]:::cli
        D26["26goroutines"]:::cli
        D27["27mutexes"]:::cli
        D28["28channels"]:::cli
    end

    %% Go Module Demo
    subgraph "Go Module Demo" 
        direction TB
        MOD["23mymodules"]:::cli
    end

    %% Simple Go REST API
    subgraph "Go REST API - buildapi" 
        direction TB
        BUILD["buildapi"]:::api
    end

    %% MVC Go REST API with MongoDB
    subgraph "Go REST API - mongoapi" 
        direction TB
        ROUTER["Router"]:::api
        CONTROLLER["Controller"]:::api
        MODEL["Model"]:::api
    end

    %% Node.js Demo Server
    LCOWEB["lcowebserver"]:::node

    %% External MongoDB
    MONGO["MongoDB"]:::external

    %% Relationships
    LCOWEB -->|"HTTP call"| BUILD
    LCOWEB -->|"HTTP call"| ROUTER
    ROUTER -->|"routes to"| CONTROLLER
    CONTROLLER -->|"invokes"| MODEL
    MODEL -->|"reads/writes"| MONGO

    %% Click Events for CLI examples
    click D01 "https://github.com/hiteshchoudhary/golang/tree/main/01hello/"
    click D02 "https://github.com/hiteshchoudhary/golang/tree/main/02variables/"
    click D03 "https://github.com/hiteshchoudhary/golang/tree/main/03types/"
    click D04 "https://github.com/hiteshchoudhary/golang/tree/main/04functions/"
    click D05 "https://github.com/hiteshchoudhary/golang/tree/main/05flowcontrol/"
    click D06 "https://github.com/hiteshchoudhary/golang/tree/main/06arrays/"
    click D07 "https://github.com/hiteshchoudhary/golang/tree/main/07slices/"
    click D08 "https://github.com/hiteshchoudhary/golang/tree/main/08maps/"
    click D09 "https://github.com/hiteshchoudhary/golang/tree/main/09structs/"
    click D10 "https://github.com/hiteshchoudhary/golang/tree/main/10pointers/"
    click D11 "https://github.com/hiteshchoudhary/golang/tree/main/11methods/"
    click D12 "https://github.com/hiteshchoudhary/golang/tree/main/12interfaces/"
    click D13 "https://github.com/hiteshchoudhary/golang/tree/main/13errors/"
    click D14 "https://github.com/hiteshchoudhary/golang/tree/main/14files/"
    click D15 "https://github.com/hiteshchoudhary/golang/tree/main/15json/"
    click D16 "https://github.com/hiteshchoudhary/golang/tree/main/16packages/"
    click D17 "https://github.com/hiteshchoudhary/golang/tree/main/17testing/"
    click D18 "https://github.com/hiteshchoudhary/golang/tree/main/18httpclient/"
    click D19 "https://github.com/hiteshchoudhary/golang/tree/main/19httphandlers/"
    click D20 "https://github.com/hiteshchoudhary/golang/tree/main/20templating/"
    click D21 "https://github.com/hiteshchoudhary/golang/tree/main/21concurrencyintro/"
    click D22 "https://github.com/hiteshchoudhary/golang/tree/main/22waitgroups/"
    click D23 "https://github.com/hiteshchoudhary/golang/tree/main/23channelsdemo/"
    click D24 "https://github.com/hiteshchoudhary/golang/tree/main/24mymodulesdemo/"
    click D25 "https://github.com/hiteshchoudhary/golang/tree/main/25vendoring/"
    click D26 "https://github.com/hiteshchoudhary/golang/tree/main/26goroutines/"
    click D27 "https://github.com/hiteshchoudhary/golang/tree/main/27mutexes/"
    click D28 "https://github.com/hiteshchoudhary/golang/tree/main/28channels/"

    %% Click Events for Module Demo
    click MOD "https://github.com/hiteshchoudhary/golang/tree/main/23mymodules/"

    %% Click Events for buildapi
    click BUILD "https://github.com/hiteshchoudhary/golang/tree/main/24buildapi/"

    %% Click Events for mongoapi layers and files
    click ROUTER "https://github.com/hiteshchoudhary/golang/blob/main/25mongoapi/router/router.go"
    click CONTROLLER "https://github.com/hiteshchoudhary/golang/blob/main/25mongoapi/controller/controller.go"
    click MODEL "https://github.com/hiteshchoudhary/golang/blob/main/25mongoapi/model/models.go"

    %% Click Event for Node.js server
    click LCOWEB "https://github.com/hiteshchoudhary/golang/tree/main/lcowebserver/"

    %% Styles
    classDef cli fill:#cce5ff,stroke:#004085,color:#004085;
    classDef api fill:#d4edda,stroke:#155724,color:#155724;
    classDef node fill:#fff3cd,stroke:#856404,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
