# debottam2003/go architecture

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

- Interactive diagram: https://gitdiagram.com/debottam2003/go
- Repository: https://github.com/debottam2003/go

## Overview

1. **Repo shape:** This is not one monolithic application. It is a collection of mostly independent Go modules, each in its own folder with its own `go.mod`. The root also contains a few standalone files, but the architectural pattern is “many small isolated programs,” not a shared platform.

2. **Learning/demo track:** The numbered folders (`01_variable` through `14_network`) are sequential Go lessons. Each one is a self-contained executable that demonstrates a specific language/runtime concept: variables, conditionals, loops, functions, pointers, input, errors, structs, interfaces, goroutines, channels, mutexes, file handling, and networking.

3. **Primary runtime model:** Most of the repo runs as simple console programs. Their flow is usually: read from stdin, process in memory, print to stdout. The README’s todo example is representative: a local slice holds state, menu input drives branching, and the process exits when the user chooses to quit.

4. **Data-structure examples:** Several folders focus on in-memory state and basic composition: arrays/slices, structs, maps, embedding, and linked-list style examples. These are isolated algorithm/data-structure demos rather than shared domain models.

5. **Language feature examples:** There are dedicated modules for closures, enums, formatting, generics, pointers, internal packages, and package/export-import behavior. Architecturally these are teaching examples for Go’s module/package boundaries rather than services that collaborate at runtime.

6. **Concurrency subsystem:** `10_goroutines`, `11_channels`, and `12_mutexes` form the concurrency cluster. Their architectural boundary is the Go runtime itself: goroutines create parallel work, channels move data between workers, and mutexes guard shared state. `fetch.go` suggests a fan-out/fan-in style HTTP fetching demo.

7. **Local persistence and filesystem I/O:** `13_file_handling` and `static_files` are the main filesystem-oriented areas. The file-handling demo reads/writes text files, while `static_files/public` holds HTML/CSS assets served by a Go program. The data flow is local disk rather than a database.

8. **Networking examples:** `14_network`, `socket/client`, and `socket/httpfromtcp` are low-level network demos. They sit below the web framework layer and appear to demonstrate TCP/HTTP communication directly, including message files used as request/response payloads.

9. **Web/server samples:** `gin`, `middleware`, `Backend`, `fullstack/server1`, and `production` are the server-side web-oriented modules. They suggest progressively more realistic HTTP applications, with handlers, middleware, routing, and in some cases database access.

10. **Production app boundary:** `production` is the clearest “app-like” backend. It has a `db` package, a `handlers` package (`home`, `login`, `logout`, `profile`, `register`), a `utils` package for shared structures, and a `.env` file. This points to an HTTP server backed by persistent storage and organized around request handlers.

11. **Auth-oriented backend app:** `backend_project` is another server application with its own DB layer (`db.go`), request handlers (`homeHandler`, `loginHandler`, `handleWrite`), shared structs, and error utilities. The presence of `.air.toml` and `vendor` indicates a more production-like development workflow with hot reload and vendored dependencies.

12. **Fullstack todo app:** `project/project1_todo` is the only clearly split frontend/backend system. The backend is a Go module, while the frontend uses Bun plus TypeScript/React-style files (`src/App.tsx`, `frontend.tsx`, `APITester.tsx`). The architecture is a client-server boundary: the frontend calls the Go backend over HTTP.

13. **Build artifacts vs source:** Many folders contain `*.exe` files and temporary build outputs. These are not architectural components; they are compiled artifacts produced from the Go programs. The diagram should focus on source modules and their boundaries, not binaries.

14. **Overall architectural takeaway:** The repo is best diagrammed as a set of isolated learning and sample systems clustered by concern: core language, concurrency, filesystem/networking, and web applications. Shared runtime dependencies are minimal; most interaction happens only within each folder’s own package hierarchy or between the split frontend/backend todo app.

Main entry points: [`production/main.go`](https://github.com/debottam2003/go/blob/main/production/main.go) (Production app), [`02_conditional/main.go`](https://github.com/debottam2003/go/blob/main/02_conditional/main.go) (Conditionals), [`02_loops/main.go`](https://github.com/debottam2003/go/blob/main/02_loops/main.go) (Loops), [`04_function/main.go`](https://github.com/debottam2003/go/blob/main/04_function/main.go) (Functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lessons["Lessons"]
  node_n01["Variables<br/>lesson<br/>[main.go]"]
  node_n02["Conditionals<br/>lesson<br/>[main.go]"]
  node_n03["Loops<br/>lesson<br/>[main.go]"]
  node_n04["Functions<br/>lesson<br/>[main.go]"]
  node_n05["Pointers<br/>lesson<br/>[main.go]"]
  node_n06["Input<br/>lesson<br/>[main.go]"]
  node_n07["Errors<br/>lesson<br/>[main.go]"]
  node_n08["Structures<br/>lesson<br/>[main.go]"]
  node_n09["Interfaces<br/>lesson<br/>[main.go]"]
end

subgraph group_concurrency["Concurrency"]
  node_n10["Goroutines<br/>runtime<br/>[main.go]"]
  node_n11["Channels<br/>runtime<br/>[main.go]"]
  node_n12["Mutexes<br/>runtime<br/>[main.go]"]
end

subgraph group_io["I/O"]
  node_n13["Files<br/>io<br/>[main.go]"]
  node_n14["Static site<br/>http assets<br/>[main.go]"]
end

subgraph group_network["Networking"]
  node_n15["TCP network<br/>networking<br/>[network.go]"]
  node_n16["Socket client<br/>tcp client<br/>[main.go]"]
  node_n17["HTTP over TCP<br/>tcp/http demo<br/>[main.go]"]
end

subgraph group_web["Web apps"]
  node_n18["Gin server<br/>web server<br/>[main.go]"]
  node_n19["Middleware<br/>web server<br/>[main.go]"]
  node_n20["Backend<br/>web server<br/>[server.go]"]
  node_n21["Production app<br/>backend app<br/>[main.go]"]
  node_n22["Auth backend<br/>backend app<br/>[main.go]"]
end

subgraph group_split["Split app"]
  node_n23["Todo backend<br/>api server<br/>[main.go]"]
  node_n24["Todo frontend<br/>client app<br/>[App.tsx]"]
end

subgraph group_packages["Packages"]
  node_n25["Exports<br/>module demo<br/>[main.go]"]
  node_n26["Internal pkg<br/>module demo<br/>[main.go]"]
  node_n27["Top-level package<br/>module demo<br/>[package.go]"]
end

subgraph group_root["Root samples"]
  node_n28["Root sample<br/>standalone program<br/>[main.go]"]
  node_n29["Root start<br/>standalone program<br/>[start.go]"]
end

node_n01 -.->|"lesson sequence"| node_n02
node_n02 -.->|"lesson sequence"| node_n03
node_n03 -.->|"lesson sequence"| node_n04
node_n04 -.->|"lesson sequence"| node_n05
node_n05 -.->|"lesson sequence"| node_n06
node_n06 -.->|"lesson sequence"| node_n07
node_n07 -.->|"lesson sequence"| node_n08
node_n08 -.->|"lesson sequence"| node_n09
node_n10 -->|"concurrency flow"| node_n11
node_n11 -->|"shared state"| node_n12
node_n13 -->|"disk assets"| node_n14
node_n15 -->|"client/server"| node_n16
node_n17 -.->|"payloads"| node_n16
node_n18 -->|"web stack"| node_n19
node_n20 -->|"backend path"| node_n21
node_n21 -.->|"handlers"| node_n21
node_n22 -.->|"app modules"| node_n22
node_n23 -->|"http api"| node_n24
node_n25 -->|"package scope"| node_n27
node_n26 -->|"module boundary"| node_n25
node_n28 -.->|"top-level samples"| node_n29

click node_n01 "https://github.com/debottam2003/go/blob/main/01_variable/main.go"
click node_n02 "https://github.com/debottam2003/go/blob/main/02_conditional/main.go"
click node_n03 "https://github.com/debottam2003/go/blob/main/02_loops/main.go"
click node_n04 "https://github.com/debottam2003/go/blob/main/04_function/main.go"
click node_n05 "https://github.com/debottam2003/go/blob/main/05_pointer/main.go"
click node_n06 "https://github.com/debottam2003/go/blob/main/06_input/main.go"
click node_n07 "https://github.com/debottam2003/go/blob/main/07_error/main.go"
click node_n08 "https://github.com/debottam2003/go/blob/main/08_structure/main.go"
click node_n09 "https://github.com/debottam2003/go/blob/main/09_interface/main.go"
click node_n10 "https://github.com/debottam2003/go/blob/main/10_goroutines/main.go"
click node_n11 "https://github.com/debottam2003/go/blob/main/11_channels/main.go"
click node_n12 "https://github.com/debottam2003/go/blob/main/12_mutexes/main.go"
click node_n13 "https://github.com/debottam2003/go/blob/main/13_file_handling/main.go"
click node_n14 "https://github.com/debottam2003/go/blob/main/static_files/main.go"
click node_n15 "https://github.com/debottam2003/go/blob/main/14_network/network.go"
click node_n16 "https://github.com/debottam2003/go/blob/main/socket/client/main.go"
click node_n17 "https://github.com/debottam2003/go/blob/main/socket/httpfromtcp/main.go"
click node_n18 "https://github.com/debottam2003/go/blob/main/gin/main.go"
click node_n19 "https://github.com/debottam2003/go/blob/main/middleware/main.go"
click node_n20 "https://github.com/debottam2003/go/blob/main/Backend/server.go"
click node_n21 "https://github.com/debottam2003/go/blob/main/production/main.go"
click node_n22 "https://github.com/debottam2003/go/blob/main/backend_project/main.go"
click node_n23 "https://github.com/debottam2003/go/blob/main/project/project1_todo/backend/main.go"
click node_n24 "https://github.com/debottam2003/go/blob/main/project/project1_todo/frontend/src/App.tsx"
click node_n25 "https://github.com/debottam2003/go/blob/main/packagesLearn/export_import/main.go"
click node_n26 "https://github.com/debottam2003/go/blob/main/internal_packages/main.go"
click node_n27 "https://github.com/debottam2003/go/blob/main/packagesLearn/package.go"
click node_n28 "https://github.com/debottam2003/go/blob/main/main.go"
click node_n29 "https://github.com/debottam2003/go/blob/main/start.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n01,node_n02,node_n03,node_n04,node_n05,node_n06,node_n07,node_n08,node_n09,node_n25,node_n26,node_n27 toneBlue
class node_n10,node_n11,node_n12,node_n28,node_n29 toneAmber
class node_n13,node_n14 toneMint
class node_n15,node_n16,node_n17 toneRose
class node_n18,node_n19,node_n20,node_n21,node_n22 toneIndigo
class node_n23,node_n24 toneTeal
```

## Components

### Lessons

Sequential Go language and runtime demos

- [Variables](https://github.com/debottam2003/go/blob/main/01_variable/main.go): lesson · Basic variables and types demo · `01_variable/main.go`
- [Conditionals](https://github.com/debottam2003/go/blob/main/02_conditional/main.go): lesson · Branching and control flow demo · `02_conditional/main.go`
- [Loops](https://github.com/debottam2003/go/blob/main/02_loops/main.go): lesson · Looping and iteration demo · `02_loops/main.go`
- [Functions](https://github.com/debottam2003/go/blob/main/04_function/main.go): lesson · Functions, recursion, and variadics · `04_function/main.go`
- [Pointers](https://github.com/debottam2003/go/blob/main/05_pointer/main.go): lesson · Pointer semantics demo · `05_pointer/main.go`
- [Input](https://github.com/debottam2003/go/blob/main/06_input/main.go): lesson · stdin-driven console interaction · `06_input/main.go`
- [Errors](https://github.com/debottam2003/go/blob/main/07_error/main.go): lesson · Error handling demo · `07_error/main.go`
- [Structures](https://github.com/debottam2003/go/blob/main/08_structure/main.go): lesson · Structs, embedding, and linked-list style composition · `08_structure/main.go`
- [Interfaces](https://github.com/debottam2003/go/blob/main/09_interface/main.go): lesson · Interface-based polymorphism demo · `09_interface/main.go`

### Concurrency

Goroutines, channels, and shared-state examples

- [Goroutines](https://github.com/debottam2003/go/blob/main/10_goroutines/main.go): runtime · Parallel work and fan-out/fan-in demo · `10_goroutines/main.go`
- [Channels](https://github.com/debottam2003/go/blob/main/11_channels/main.go): runtime · Channel-based communication demo · `11_channels/main.go`
- [Mutexes](https://github.com/debottam2003/go/blob/main/12_mutexes/main.go): runtime · Shared-state synchronization demo · `12_mutexes/main.go`

### I/O

Filesystem and static asset demos

- [Files](https://github.com/debottam2003/go/blob/main/13_file_handling/main.go): io · Read/write local text files · `13_file_handling/main.go`
- [Static site](https://github.com/debottam2003/go/blob/main/static_files/main.go): http assets · Static files served from disk · `static_files/main.go`

### Networking

Low-level TCP and HTTP-over-TCP examples

- [TCP network](https://github.com/debottam2003/go/blob/main/14_network/network.go): networking · Low-level network programming demo · `14_network/network.go`
- [Socket client](https://github.com/debottam2003/go/blob/main/socket/client/main.go): tcp client · Client-side socket demo · `socket/client/main.go`
- [HTTP over TCP](https://github.com/debottam2003/go/blob/main/socket/httpfromtcp/main.go): tcp/http demo · Raw HTTP message exchange over TCP · `socket/httpfromtcp/main.go`

### Web apps

HTTP servers, middleware, and production-style backends

- [Gin server](https://github.com/debottam2003/go/blob/main/gin/main.go): web server · Framework-based HTTP example · `gin/main.go`
- [Middleware](https://github.com/debottam2003/go/blob/main/middleware/main.go): web server · HTTP middleware example · `middleware/main.go`
- [Backend](https://github.com/debottam2003/go/blob/main/Backend/server.go): web server · Server example in Backend module · `Backend/server.go`
- [Production app](https://github.com/debottam2003/go/blob/main/production/main.go): backend app · HTTP app with DB, handlers, and shared utils · `production/main.go`
- [Auth backend](https://github.com/debottam2003/go/blob/main/backend_project/main.go): backend app · App with handlers, DB access, and error utilities · `backend_project/main.go`

### Split app

Client-server todo application

- [Todo backend](https://github.com/debottam2003/go/blob/main/project/project1_todo/backend/main.go): api server · Go backend for the split todo app · `project/project1_todo/backend/main.go`
- [Todo frontend](https://github.com/debottam2003/go/blob/main/project/project1_todo/frontend/src/App.tsx): client app · Bun/TypeScript frontend for the todo app · `project/project1_todo/frontend/src/App.tsx`

### Packages

Module, import, and visibility teaching examples

- [Exports](https://github.com/debottam2003/go/blob/main/packagesLearn/export_import/main.go): module demo · Import/export and package visibility demo · `packagesLearn/export_import/main.go`
- [Internal pkg](https://github.com/debottam2003/go/blob/main/internal_packages/main.go): module demo · Internal packages and module boundaries · `internal_packages/main.go`
- [Top-level package](https://github.com/debottam2003/go/blob/main/packagesLearn/package.go): module demo · Package-level teaching example · `packagesLearn/package.go`

### Root samples

Standalone top-level programs

- [Root sample](https://github.com/debottam2003/go/blob/main/main.go): standalone program · Top-level repository sample program · `main.go`
- [Root start](https://github.com/debottam2003/go/blob/main/start.go): standalone program · Another top-level sample program · `start.go`

## Connections

- Variables → Conditionals: lesson sequence · Sequential teaching progression
- Conditionals → Loops: lesson sequence · Sequential teaching progression
- Loops → Functions: lesson sequence · Sequential teaching progression
- Functions → Pointers: lesson sequence · Sequential teaching progression
- Pointers → Input: lesson sequence · Sequential teaching progression
- Input → Errors: lesson sequence · Sequential teaching progression
- Errors → Structures: lesson sequence · Sequential teaching progression
- Structures → Interfaces: lesson sequence · Sequential teaching progression
- Goroutines → Channels: concurrency flow · Goroutines feed channels
- Channels → Mutexes: shared state · Channel-driven work protected by mutexes
- Files → Static site: disk assets · Filesystem-oriented examples
- TCP network → Socket client: client/server · Socket communication demo
- HTTP over TCP → Socket client: payloads · Message files used by the TCP/HTTP demo
- Gin server → Middleware: web stack · Framework and middleware examples
- Backend → Production app: backend path · Progression toward a production-style server
- Production app → Production app: handlers · Entry point coordinates DB and request handlers
- Auth backend → Auth backend: app modules · Main server wires DB, handlers, and error handling
- Todo backend → Todo frontend: http api · Frontend calls the Go backend over HTTP
- Exports → Top-level package: package scope · Import/export and package visibility example
- Internal pkg → Exports: module boundary · Internal package teaching example
- Root sample → Root start: top-level samples · Standalone root programs
