# indikamadhushan/http_router_in_go architecture

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

- Interactive diagram: https://gitdiagram.com/indikamadhushan/http_router_in_go
- Repository: https://github.com/indikamadhushan/http_router_in_go

## Overview

This is a small YAML-configured HTTP reverse-proxy gateway, accompanied by a standalone mock HTTP backend. The main workflow is a client request entering the gateway, which reads api.yaml at startup, registers method/path routes, and forwards matching requests to their configured upstreams. The mock backend independently serves a JSON response. The README is empty, and api.yaml was not excerpted, so the gateway’s configured upstreams and any connection to the mock backend cannot be confirmed.

Main entry points: [`main.go`](https://github.com/indikamadhushan/http_router_in_go/blob/master/main.go) (Route and proxy server), [`api.yaml`](https://github.com/indikamadhushan/http_router_in_go/blob/master/api.yaml) (API configuration), [`cmd/mock-backend/main.go`](https://github.com/indikamadhushan/http_router_in_go/blob/master/cmd/mock-backend/main.go) (JSON HTTP service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Gateway"]
  node_gateway_runtime["Route and proxy server<br/>[main.go]"]
  node_api_config["API configuration<br/>[api.yaml]"]
end

subgraph group_mock["Mock backend"]
  node_mock_service["JSON HTTP service<br/>[main.go]"]
end

node_client(("HTTP client"))
node_upstream["Configured upstream"]

node_client -->|"sends requests"| node_gateway_runtime
node_gateway_runtime -->|"reads at startup"| node_api_config
node_gateway_runtime -->|"proxies requests"| node_upstream
node_client -->|"sends requests"| node_mock_service

click node_gateway_runtime "https://github.com/indikamadhushan/http_router_in_go/blob/master/main.go"
click node_api_config "https://github.com/indikamadhushan/http_router_in_go/blob/master/api.yaml"
click node_mock_service "https://github.com/indikamadhushan/http_router_in_go/blob/master/cmd/mock-backend/main.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_gateway_runtime,node_api_config,node_client toneBlue
class node_mock_service toneAmber
class node_upstream toneIndigo
```

## Components

### Gateway

- [Route and proxy server](https://github.com/indikamadhushan/http_router_in_go/blob/master/main.go): `main.go`
- [API configuration](https://github.com/indikamadhushan/http_router_in_go/blob/master/api.yaml): `api.yaml`

### Mock backend

- [JSON HTTP service](https://github.com/indikamadhushan/http_router_in_go/blob/master/cmd/mock-backend/main.go): `cmd/mock-backend/main.go`

### Other components

- **HTTP client**
- **Configured upstream**

## Connections

- HTTP client → Route and proxy server: sends requests (evidence: `main.go`)
- Route and proxy server → API configuration: reads at startup (evidence: `main.go`)
- Route and proxy server → Configured upstream: proxies requests (evidence: `main.go`)
- HTTP client → JSON HTTP service: sends requests (evidence: `cmd/mock-backend/main.go`)
