# pkouzou/catcollector architecture

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

- Interactive diagram: https://gitdiagram.com/pkouzou/catcollector
- Repository: https://github.com/pkouzou/catcollector

## Overview

Cat Collector imports images from TheCatAPI, stores image files and cat metadata, and exposes retrieval/filtering through an API plus a Blazor UI for triggering imports and viewing recent cats. The principal flow runs through import jobs, application services, external download/API clients, local storage, and SQL-backed repositories; retrieval follows a separate query path. Relationships among sampled modules are supported by the source index, while broader product capabilities are documented in the README; unsampled implementation details are not inferred.

Main entry points: [`CatCollector.Application/Services/CatImportService.cs`](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Application/Services/CatImportService.cs) (Import jobs), [`CatCollector.Blazor/Program.cs`](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Program.cs) (Blazor web app), [`CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs`](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs) (Cat repository), [`CatCollector.Infrastructure/Data/CatCollectorDbContext.cs`](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Data/CatCollectorDbContext.cs) (SQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_imports_controller["Import endpoints"]
  node_cats_controller["Cat endpoints<br/>[CatsController.cs]"]
end

subgraph group_application["Application workflows"]
  node_import_service["Import jobs"]
  node_cat_service["Cat queries<br/>[CatService.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_cat_api_client["TheCatAPI client<br/>[CatApiClient.cs]"]
  node_file_download["Image downloader"]
  node_file_storage["Local image storage"]
  node_filesystem["Filesystem access"]
  node_cat_repository["Cat repository"]
  node_tag_repository["Tag repository"]
  node_job_repository["Import-job repository"]
  node_database[("SQL database")]
end

subgraph group_web["Blazor UI"]
  node_blazor_import["Import UI service"]
  node_blazor_cats["Cat-view UI service<br/>[CatService.cs]"]
  node_blazor_app["Blazor web app<br/>[Program.cs]"]
end

node_user(("User"))
node_api_client(("API consumer"))
node_catapi{{"TheCatAPI"}}

node_api_client -->|"requests imports"| node_imports_controller
node_api_client -->|"requests cats"| node_cats_controller
node_imports_controller -->|"dispatches"| node_import_service
node_cats_controller -->|"dispatches"| node_cat_service
node_import_service -->|"fetches cat data"| node_cat_api_client
node_import_service -->|"downloads images"| node_file_download
node_import_service -->|"stores images"| node_file_storage
node_import_service -->|"persists cats"| node_cat_repository
node_import_service -->|"uses tags"| node_tag_repository
node_import_service -->|"tracks jobs"| node_job_repository
node_cat_service -.->|"queries cats"| node_cat_repository
node_cat_api_client -.->|"calls API"| node_catapi
node_file_storage -->|"reads and writes"| node_filesystem
node_cat_repository -->|"queries and saves"| node_database
node_tag_repository -.->|"queries and saves"| node_database
node_job_repository -.->|"queries and saves"| node_database
node_user -->|"uses UI"| node_blazor_app
node_blazor_app -.->|"triggers imports"| node_blazor_import
node_blazor_app -.->|"views cats"| node_blazor_cats
node_user -.->|"import source"| node_catapi

click node_imports_controller "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Api/Controllers/CatImportsController.cs"
click node_cats_controller "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Api/Controllers/CatsController.cs"
click node_import_service "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Application/Services/CatImportService.cs"
click node_cat_service "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Application/Services/CatService.cs"
click node_cat_api_client "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Clients/CatApiClient.cs"
click node_file_download "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/HttpFileDownloadService.cs"
click node_file_storage "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/LocalFileStorageService.cs"
click node_filesystem "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/FileSystemService.cs"
click node_cat_repository "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs"
click node_tag_repository "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreTagRepository.cs"
click node_job_repository "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreCatImportRepository.cs"
click node_database "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Data/CatCollectorDbContext.cs"
click node_blazor_import "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Services/CatImportService.cs"
click node_blazor_cats "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Services/CatService.cs"
click node_blazor_app "https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Program.cs"

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_imports_controller,node_cats_controller,node_user toneBlue
class node_import_service,node_cat_service toneAmber
class node_cat_api_client,node_file_download,node_file_storage,node_filesystem,node_cat_repository,node_tag_repository,node_job_repository,node_database,node_api_client,node_catapi toneMint
class node_blazor_import,node_blazor_cats,node_blazor_app toneRose
```

## Components

### API surface

- [Import endpoints](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Api/Controllers/CatImportsController.cs): `CatCollector.Api/Controllers/CatImportsController.cs`
- [Cat endpoints](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Api/Controllers/CatsController.cs): `CatCollector.Api/Controllers/CatsController.cs`

### Application workflows

- [Import jobs](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Application/Services/CatImportService.cs): `CatCollector.Application/Services/CatImportService.cs`
- [Cat queries](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Application/Services/CatService.cs): `CatCollector.Application/Services/CatService.cs`

### Infrastructure

- [TheCatAPI client](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Clients/CatApiClient.cs): `CatCollector.Infrastructure/Clients/CatApiClient.cs`
- [Image downloader](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/HttpFileDownloadService.cs): `CatCollector.Infrastructure/Services/HttpFileDownloadService.cs`
- [Local image storage](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/LocalFileStorageService.cs): `CatCollector.Infrastructure/Services/LocalFileStorageService.cs`
- [Filesystem access](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Services/FileSystemService.cs): `CatCollector.Infrastructure/Services/FileSystemService.cs`
- [Cat repository](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs): `CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs`
- [Tag repository](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreTagRepository.cs): `CatCollector.Infrastructure/Repositories/EFCoreTagRepository.cs`
- [Import-job repository](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Repositories/EFCoreCatImportRepository.cs): `CatCollector.Infrastructure/Repositories/EFCoreCatImportRepository.cs`
- [SQL database](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Infrastructure/Data/CatCollectorDbContext.cs): `CatCollector.Infrastructure/Data/CatCollectorDbContext.cs`

### Blazor UI

- [Import UI service](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Services/CatImportService.cs): `CatCollector.Blazor/Services/CatImportService.cs`
- [Cat-view UI service](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Services/CatService.cs): `CatCollector.Blazor/Services/CatService.cs`
- [Blazor web app](https://github.com/pkouzou/catcollector/blob/main/CatCollector.Blazor/Program.cs): `CatCollector.Blazor/Program.cs`

### Other components

- **User**
- **API consumer**
- **TheCatAPI**

## Connections

- API consumer → Import endpoints: requests imports (evidence: `CatCollector.Api/Controllers/CatImportsController.cs`)
- API consumer → Cat endpoints: requests cats (evidence: `CatCollector.Api/Controllers/CatsController.cs`)
- Import endpoints → Import jobs: dispatches (evidence: `CatCollector.Api/Controllers/CatImportsController.cs`)
- Cat endpoints → Cat queries: dispatches (evidence: `CatCollector.Api/Controllers/CatsController.cs`)
- Import jobs → TheCatAPI client: fetches cat data (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Import jobs → Image downloader: downloads images (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Import jobs → Local image storage: stores images (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Import jobs → Cat repository: persists cats (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Import jobs → Tag repository: uses tags (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Import jobs → Import-job repository: tracks jobs (evidence: `CatCollector.Application/Services/CatImportService.cs`)
- Cat queries → Cat repository: queries cats
- TheCatAPI client → TheCatAPI: calls API
- Local image storage → Filesystem access: reads and writes (evidence: `CatCollector.Infrastructure/Services/LocalFileStorageService.cs`)
- Cat repository → SQL database: queries and saves (evidence: `CatCollector.Infrastructure/Repositories/EFCoreCatRepository.cs`)
- Tag repository → SQL database: queries and saves
- Import-job repository → SQL database: queries and saves
- User → Blazor web app: uses UI (evidence: `README.md`)
- Blazor web app → Import UI service: triggers imports
- Blazor web app → Cat-view UI service: views cats
- User → TheCatAPI: import source (evidence: `README.md`)
