# tejas-2232/golang architecture

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

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

## Overview

##### Project type and purpose
- This is primarily a Go “learning” repository that contains:
a. A set of Go example files at the root illustrating core language features (arrays, pointers, interfaces, etc.).
b. Two self-contained sample applications under the `project/` directory:
- `simple_web_page` – a minimal HTTP server that renders a dynamic web page.
- `students_api` – a small RESTful service exposing CRUD operations on student records backed by SQLite.

##### File structure
- Top-level Go examples (e.g., `arrays/`, `interfaces/`, `pointers.go`) are standalone demos; they do not participate in a single unified runtime.
- Under `project/` you have two sub-projects, each with its own entry point(s):
`simple_web_page/`
- `web-server.go` – HTTP server setup
- `dynamicWebPage.go` – template generation or dynamic content assembly
`students_api/`
- `cmd/students_api/main.go` – application entry point
- `config/` + `internal/config` – configuration loading (YAML)
- `internal/http/handlers` – REST handlers for student entities
- `internal/storage/sqlite` – SQLite storage implementation behind a storage interface
- `internal/types` – domain types (e.g., Student struct)
- `internal/utils/response` – helper to format HTTP responses

##### README for additional insights
- The README is an overview of Go’s language features, not specific to either sample app’s architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Simple Web Page Application
    subgraph "Simple Web Page"
        SWP_App["Simple Web Page App"]
        SWP_Server["HTTP Server"]:::transport
        SWP_Dyn["Dynamic Content Generator"]:::business
        SWP_App --> SWP_Server
        SWP_Server --> SWP_Dyn
    end

    %% Students API Application
    subgraph "Students API"
        ConfigFile["Config File (local.yml)"]:::config
        ConfigLoader["Config Loader"]:::config
        GoMod["Module Definition (go.mod)"]:::config

        Server["HTTP Server"]:::transport
        Router["Router"]:::transport
        Handler["Student Handler"]:::business

        Types["Domain Types"]:::data
        Utils["Response Utility"]:::utils

        StorageIface["Storage Interface"]:::data
        SQLite["SQLite Implementation"]:::data
        DB[(SQLite DB File)]:::data

        Assets["Static Assets"]:::transport

        ConfigFile --> ConfigLoader
        ConfigLoader --> Server
        ConfigLoader --> SQLite

        Server --> Router
        Router --> Handler

        Handler --> ConfigLoader
        Handler --> StorageIface
        Handler --> Utils

        StorageIface --> SQLite
        SQLite --> DB

        Assets -.-> Server
        GoMod -.-> ConfigLoader
    end

    %% Click Events
    click SWP_App "https://github.com/tejas-2232/golang/tree/main/project/simple_web_page"
    click SWP_Server "https://github.com/tejas-2232/golang/blob/main/project/simple_web_page/web-server.go"
    click SWP_Dyn "https://github.com/tejas-2232/golang/blob/main/project/simple_web_page/dynamicWebPage.go"

    click Server "https://github.com/tejas-2232/golang/blob/main/project/students_api/cmd/students_api/main.go"
    click ConfigFile "https://github.com/tejas-2232/golang/blob/main/project/students_api/config/local.yml"
    click ConfigLoader "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/config/config.go"
    click Handler "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/http/handlers/student/student.go"
    click StorageIface "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/storage/storage.go"
    click SQLite "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/storage/sqlite/sqlite.go"
    click Types "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/types/types.go"
    click Utils "https://github.com/tejas-2232/golang/blob/main/project/students_api/internal/utils/response/response.go"
    click Assets "https://github.com/tejas-2232/golang/tree/main/project/students_api/assets"
    click GoMod "https://github.com/tejas-2232/golang/blob/main/project/students_api/go.mod"

    %% Styles
    classDef transport fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef business fill:#90EE90,stroke:#000,stroke-width:1px
    classDef data fill:#FFA500,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef utils fill:#D3D3D3,stroke:#000,stroke-width:1px
```
