# iamkirillnb/avtodom architecture

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

- Interactive diagram: https://gitdiagram.com/iamkirillnb/avtodom
- Repository: https://github.com/iamkirillnb/avtodom

## Overview

AvtoDom looks like a URL-redirect lookup service: its configured entry point builds a PostgreSQL repository and gRPC handler, then an HTTP client asks the handler for a URL and follows the returned destination. The sampled main function calls the gRPC method directly; it does not start a gRPC server. The README documents PostgreSQL setup and migrations, but the migration SQL was not sampled, so the graph does not infer schema details.

Main entry points: [`cmd/main.go`](https://github.com/iamkirillnb/avtodom/blob/main/cmd/main.go) (Service wiring), [`internal/handlers/http.go`](https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/http.go) (Link follower), [`internal/handlers/grpc.go`](https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/grpc.go) (Redirect API), [`internal/repos/db.go`](https://github.com/iamkirillnb/avtodom/blob/main/internal/repos/db.go) (URL repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_config["Config loader<br/>[config.go]"]
  node_main["Service wiring<br/>[main.go]"]
end

subgraph group_redirect["Redirect lookup"]
  node_grpc["Redirect API<br/>[grpc.go]"]
  node_repo["URL repository<br/>[db.go]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_follow["HTTP following"]
  node_httpclient["Link follower<br/>[http.go]"]
end

node_caller(("Application entry"))
node_destination(("Destination site"))

node_caller -->|"starts"| node_main
node_main -->|"loads config"| node_config
node_main -->|"creates repository"| node_repo
node_main -->|"creates API"| node_grpc
node_main -->|"calls follower"| node_httpclient
node_grpc -->|"looks up URL"| node_repo
node_repo -->|"queries"| node_postgres
node_httpclient -->|"requests destination"| node_grpc
node_httpclient -->|"sends GET"| node_destination

click node_config "https://github.com/iamkirillnb/avtodom/blob/main/internal/config.go"
click node_main "https://github.com/iamkirillnb/avtodom/blob/main/cmd/main.go"
click node_grpc "https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/grpc.go"
click node_repo "https://github.com/iamkirillnb/avtodom/blob/main/internal/repos/db.go"
click node_httpclient "https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/http.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_config,node_main toneBlue
class node_grpc,node_repo,node_postgres toneAmber
class node_httpclient toneMint
class node_caller,node_destination toneIndigo
```

## Components

### Startup and configuration

- [Config loader](https://github.com/iamkirillnb/avtodom/blob/main/internal/config.go): `internal/config.go`
- [Service wiring](https://github.com/iamkirillnb/avtodom/blob/main/cmd/main.go): `cmd/main.go`

### Redirect lookup

- [Redirect API](https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/grpc.go): `internal/handlers/grpc.go`
- [URL repository](https://github.com/iamkirillnb/avtodom/blob/main/internal/repos/db.go): `internal/repos/db.go`
- **PostgreSQL**

### HTTP following

- [Link follower](https://github.com/iamkirillnb/avtodom/blob/main/internal/handlers/http.go): `internal/handlers/http.go`

### Other components

- **Application entry**
- **Destination site**

## Connections

- Application entry → Service wiring: starts (evidence: `cmd/main.go`)
- Service wiring → Config loader: loads config (evidence: `cmd/main.go`)
- Service wiring → URL repository: creates repository (evidence: `cmd/main.go`)
- Service wiring → Redirect API: creates API (evidence: `cmd/main.go`)
- Service wiring → Link follower: calls follower (evidence: `cmd/main.go`)
- Redirect API → URL repository: looks up URL (evidence: `internal/handlers/grpc.go`)
- URL repository → PostgreSQL: queries (evidence: `internal/repos/db.go`)
- Link follower → Redirect API: requests destination (evidence: `internal/handlers/http.go`)
- Link follower → Destination site: sends GET (evidence: `internal/handlers/http.go`)
