# ergali-zhansugurov/my_manga architecture

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

- Interactive diagram: https://gitdiagram.com/ergali-zhansugurov/my_manga
- Repository: https://github.com/ergali-zhansugurov/my_manga

## Overview

This appears to be a manga-catalog service with HTTP resources for titles, categories, users, and publishers, backed by PostgreSQL and a cache-broker integration. The intended request path is client → HTTP server → resource handler → store interface → PostgreSQL repository → database. The README provides no product detail, and sampled code does not show category/title handlers, the aggregate broker implementation, or publisher mounting; those links are omitted where wiring is uncertain.

Main entry points: [`internal/massage_broker/broker/cache_broker.go`](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/massage_broker/broker/cache_broker.go) (Cache broker), [`internal/http/server.go`](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/server.go) (HTTP server), [`internal/store/store (2).go`](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/store/store%20(2).go) (Store interfaces), [`internal/models`](https://github.com/ergali-zhansugurov/my_manga/tree/main/internal/models) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["HTTP server<br/>[server.go]"]
  node_categories["Category resource<br/>[categories.go]"]
  node_titles["Title resource<br/>[title.go]"]
  node_users["User resource<br/>[users.go]"]
  node_publishers["Publisher resource<br/>[publishers.go]"]
end

subgraph group_data["Data layer"]
  node_store["Store interfaces<br/>[store &#40;2&#41;.go]"]
  node_postgres["Postgres repositories"]
  node_models["Domain models"]
end

subgraph group_messaging["Cache messaging"]
  node_cache[("LRU cache<br/>[cache.go]")]
  node_broker["Cache broker<br/>[cache_broker.go]"]
end

node_client(("API client"))
node_database[("PostgreSQL")]
node_kafka["Kafka"]
node_app["Application setup<br/>[main.go]"]

node_client -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_categories
node_server -->|"mounts routes"| node_titles
node_server -->|"mounts routes"| node_users
node_categories -->|"calls repositories"| node_store
node_titles -->|"calls repositories"| node_store
node_users -->|"calls repositories"| node_store
node_publishers -->|"calls repositories"| node_store
node_store -->|"implemented by"| node_postgres
node_postgres -->|"queries"| node_database
node_postgres -->|"maps records"| node_models
node_categories -->|"uses types"| node_models
node_titles -->|"uses types"| node_models
node_users -->|"uses types"| node_models
node_publishers -->|"uses types"| node_models
node_app -->|"configures"| node_server
node_app -->|"connects"| node_postgres
node_app -->|"connects"| node_broker
node_broker -->|"publishes and consumes"| node_kafka
node_broker -->|"applies commands"| node_cache
node_categories -.->|"invalidates cache"| node_broker
node_titles -.->|"invalidates cache"| node_broker
node_users -.->|"invalidates cache"| node_broker
node_publishers -->|"invalidates cache"| node_broker

click node_server "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/server.go"
click node_categories "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/categories.go"
click node_titles "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/title.go"
click node_users "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/users.go"
click node_publishers "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/publishers.go"
click node_store "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/store/store%20(2).go"
click node_postgres "https://github.com/ergali-zhansugurov/my_manga/tree/main/internal/store/postgres"
click node_models "https://github.com/ergali-zhansugurov/my_manga/tree/main/internal/models"
click node_cache "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/models/cache.go"
click node_broker "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/massage_broker/broker/cache_broker.go"
click node_app "https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/app/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_server,node_categories,node_titles,node_users,node_publishers,node_client toneBlue
class node_store,node_postgres,node_models,node_database toneAmber
class node_cache,node_broker toneMint
class node_kafka toneIndigo
class node_app toneTeal
```

## Components

### HTTP API

- [HTTP server](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/server.go): `internal/http/server.go`
- [Category resource](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/categories.go): `internal/http/categories.go`
- [Title resource](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/title.go): `internal/http/title.go`
- [User resource](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/users.go): `internal/http/users.go`
- [Publisher resource](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/http/publishers.go): `internal/http/publishers.go`

### Data layer

- [Store interfaces](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/store/store%20(2).go): `internal/store/store (2).go`
- [Postgres repositories](https://github.com/ergali-zhansugurov/my_manga/tree/main/internal/store/postgres): `internal/store/postgres`
- [Domain models](https://github.com/ergali-zhansugurov/my_manga/tree/main/internal/models): `internal/models`

### Cache messaging

- [LRU cache](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/models/cache.go): `internal/models/cache.go`
- [Cache broker](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/massage_broker/broker/cache_broker.go): `internal/massage_broker/broker/cache_broker.go`

### Other components

- **API client**
- **PostgreSQL**
- **Kafka**
- [Application setup](https://github.com/ergali-zhansugurov/my_manga/blob/main/internal/app/main.go): `internal/app/main.go`

## Connections

- API client → HTTP server: sends requests
- HTTP server → Category resource: mounts routes
- HTTP server → Title resource: mounts routes
- HTTP server → User resource: mounts routes
- Category resource → Store interfaces: calls repositories
- Title resource → Store interfaces: calls repositories
- User resource → Store interfaces: calls repositories
- Publisher resource → Store interfaces: calls repositories
- Store interfaces → Postgres repositories: implemented by
- Postgres repositories → PostgreSQL: queries
- Postgres repositories → Domain models: maps records
- Category resource → Domain models: uses types
- Title resource → Domain models: uses types
- User resource → Domain models: uses types
- Publisher resource → Domain models: uses types
- Application setup → HTTP server: configures
- Application setup → Postgres repositories: connects
- Application setup → Cache broker: connects
- Cache broker → Kafka: publishes and consumes
- Cache broker → LRU cache: applies commands
- Category resource → Cache broker: invalidates cache
- Title resource → Cache broker: invalidates cache
- User resource → Cache broker: invalidates cache
- Publisher resource → Cache broker: invalidates cache
