# mikhailmasny/qr-animal architecture

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

- Interactive diagram: https://gitdiagram.com/mikhailmasny/qr-animal
- Repository: https://github.com/mikhailmasny/qr-animal

## Overview

QR Animal is an ASP.NET animal-registration application: users register and confirm accounts, create/manage animal records, and share public animal details through QR codes; it also provides profiles, chat, and administrative maintenance. The web controllers dispatch CQRS requests, application handlers query the persistence abstraction, and infrastructure supplies identity, QR generation, messaging, and storage. The README documents capabilities not fully represented in sampled code; those branches are shown without inferring unobserved call wiring.

Main entry points: [`src/Web/Controllers/AnimalController.cs`](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/AnimalController.cs) (Animal workflows), [`src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs`](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs) (Animal queries), [`src/Infrastructure/Persistence/ApplicationContext.cs`](https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Persistence/ApplicationContext.cs) (Application database), [`src/Worker/Jobs/ClearDatabaseJob.cs`](https://github.com/mikhailmasny/qr-animal/blob/master/src/Worker/Jobs/ClearDatabaseJob.cs) (Cleanup job)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_account["Account access"]
  node_animalweb["Animal workflows"]
  node_profile["Animal profiles"]
  node_animalapi["Animal API"]
  node_chat["Realtime chat<br/>[ChatHub.cs]"]
end

subgraph group_application["Application workflows"]
  node_animalcmd["Animal commands"]
  node_animalquery["Animal queries<br/>[GetAnimalQuery.cs]"]
  node_qrcodecmd["QR commands"]
  node_qrcodequery["QR lookup<br/>[GetQRCodeQuery.cs]"]
  node_context["Application context"]
end

subgraph group_domain["Animal domain"]
  node_animal["Animal records<br/>[Animal.cs]"]
  node_qrcode["QR records<br/>[QRCode.cs]"]
end

subgraph group_infrastructure["Infrastructure services"]
  node_identity["Identity service<br/>[IdentityService.cs]"]
  node_email["Email delivery"]
  node_database[("Application database")]
  node_qrservice["QR generation"]
end

subgraph group_operations["Background maintenance"]
  node_worker["Cleanup job"]
end

node_visitor(("User"))
node_admin(("Administrator"))

node_visitor -->|"registers / signs in"| node_account
node_account -->|"manages identity"| node_identity
node_account -->|"sends confirmation"| node_email
node_visitor -->|"manages animals"| node_animalweb
node_animalweb -->|"resolves user"| node_identity
node_animalweb -->|"dispatches commands"| node_animalcmd
node_animalweb -->|"dispatches queries"| node_animalquery
node_animalweb -->|"creates QR record"| node_qrcodecmd
node_animalweb -->|"loads QR record"| node_qrcodequery
node_animalweb -->|"renders QR code"| node_qrservice
node_animalweb -->|"presents details"| node_animal
node_visitor -->|"views registered animals"| node_profile
node_profile -->|"dispatches user query"| node_animalquery
node_visitor -->|"requests animal data"| node_animalapi
node_animalapi -->|"dispatches query"| node_animalquery
node_visitor -->|"chats"| node_chat
node_animalquery -->|"reads animal records"| node_context
node_qrcodequery -->|"reads QR records"| node_context
node_context -->|"implemented by"| node_database
node_database -->|"persists"| node_animal
node_database -->|"persists"| node_qrcode
node_animal -->|"has QR association"| node_qrcode
node_worker -->|"finds deleted records"| node_animalquery
node_worker -->|"removes QR records"| node_qrcodecmd
node_worker -->|"removes animal records"| node_animalcmd
node_admin -->|"edits profiles and records"| node_database

click node_account "https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/AccountController.cs"
click node_identity "https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/IdentityService.cs"
click node_email "https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/EmailSenderService.cs"
click node_animalweb "https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/AnimalController.cs"
click node_profile "https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/ProfileController.cs"
click node_animalapi "https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/WebAPI/AnimalsController.cs"
click node_chat "https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Hubs/ChatHub.cs"
click node_animalcmd "https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Commands/Create/CreateAnimalCommand.cs"
click node_animalquery "https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs"
click node_qrcodecmd "https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Commands/Create/CreateQRCodeCommand.cs"
click node_qrcodequery "https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Queries/GetQRCode/GetQRCodeQuery.cs"
click node_animal "https://github.com/mikhailmasny/qr-animal/blob/master/src/Domain/Entities/Animal.cs"
click node_qrcode "https://github.com/mikhailmasny/qr-animal/blob/master/src/Domain/Entities/QRCode.cs"
click node_context "https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/Interfaces/IApplicationContext.cs"
click node_database "https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Persistence/ApplicationContext.cs"
click node_qrservice "https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/QRCodeGeneratorService.cs"
click node_worker "https://github.com/mikhailmasny/qr-animal/blob/master/src/Worker/Jobs/ClearDatabaseJob.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_account,node_animalweb,node_profile,node_animalapi,node_chat,node_visitor toneBlue
class node_animalcmd,node_animalquery,node_qrcodecmd,node_qrcodequery,node_context toneAmber
class node_animal,node_qrcode toneMint
class node_identity,node_email,node_database,node_qrservice toneRose
class node_worker,node_admin toneIndigo
```

## Components

### Web experience

- [Account access](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/AccountController.cs): `src/Web/Controllers/AccountController.cs`
- [Animal workflows](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/AnimalController.cs): `src/Web/Controllers/AnimalController.cs`
- [Animal profiles](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/ProfileController.cs): `src/Web/Controllers/ProfileController.cs`
- [Animal API](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Controllers/WebAPI/AnimalsController.cs): `src/Web/Controllers/WebAPI/AnimalsController.cs`
- [Realtime chat](https://github.com/mikhailmasny/qr-animal/blob/master/src/Web/Hubs/ChatHub.cs): `src/Web/Hubs/ChatHub.cs`

### Application workflows

- [Animal commands](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Commands/Create/CreateAnimalCommand.cs): `src/Application/CQRS/Commands/Create/CreateAnimalCommand.cs`
- [Animal queries](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs): `src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs`
- [QR commands](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Commands/Create/CreateQRCodeCommand.cs): `src/Application/CQRS/Commands/Create/CreateQRCodeCommand.cs`
- [QR lookup](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/CQRS/Queries/GetQRCode/GetQRCodeQuery.cs): `src/Application/CQRS/Queries/GetQRCode/GetQRCodeQuery.cs`
- [Application context](https://github.com/mikhailmasny/qr-animal/blob/master/src/Application/Interfaces/IApplicationContext.cs): `src/Application/Interfaces/IApplicationContext.cs`

### Animal domain

- [Animal records](https://github.com/mikhailmasny/qr-animal/blob/master/src/Domain/Entities/Animal.cs): `src/Domain/Entities/Animal.cs`
- [QR records](https://github.com/mikhailmasny/qr-animal/blob/master/src/Domain/Entities/QRCode.cs): `src/Domain/Entities/QRCode.cs`

### Infrastructure services

- [Identity service](https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/IdentityService.cs): `src/Infrastructure/Services/IdentityService.cs`
- [Email delivery](https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/EmailSenderService.cs): `src/Infrastructure/Services/EmailSenderService.cs`
- [Application database](https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Persistence/ApplicationContext.cs): `src/Infrastructure/Persistence/ApplicationContext.cs`
- [QR generation](https://github.com/mikhailmasny/qr-animal/blob/master/src/Infrastructure/Services/QRCodeGeneratorService.cs): `src/Infrastructure/Services/QRCodeGeneratorService.cs`

### Background maintenance

- [Cleanup job](https://github.com/mikhailmasny/qr-animal/blob/master/src/Worker/Jobs/ClearDatabaseJob.cs): `src/Worker/Jobs/ClearDatabaseJob.cs`

### Other components

- **User**
- **Administrator**

## Connections

- User → Account access: registers / signs in (evidence: `README.md`)
- Account access → Identity service: manages identity (evidence: `src/Web/Controllers/AccountController.cs`)
- Account access → Email delivery: sends confirmation (evidence: `src/Web/Controllers/AccountController.cs`)
- User → Animal workflows: manages animals (evidence: `README.md`)
- Animal workflows → Identity service: resolves user (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → Animal commands: dispatches commands (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → Animal queries: dispatches queries (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → QR commands: creates QR record (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → QR lookup: loads QR record (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → QR generation: renders QR code (evidence: `src/Web/Controllers/AnimalController.cs`)
- Animal workflows → Animal records: presents details (evidence: `README.md`)
- User → Animal profiles: views registered animals (evidence: `README.md`)
- Animal profiles → Animal queries: dispatches user query (evidence: `src/Web/Controllers/ProfileController.cs`)
- User → Animal API: requests animal data (evidence: `README.md`)
- Animal API → Animal queries: dispatches query (evidence: `src/Web/Controllers/WebAPI/AnimalsController.cs`)
- User → Realtime chat: chats (evidence: `README.md`)
- Animal queries → Application context: reads animal records (evidence: `src/Application/CQRS/Queries/GetAnimal/GetAnimalQuery.cs`)
- QR lookup → Application context: reads QR records (evidence: `src/Application/CQRS/Queries/GetQRCode/GetQRCodeQuery.cs`)
- Application context → Application database: implemented by (evidence: `src/Infrastructure/Persistence/ApplicationContext.cs`)
- Application database → Animal records: persists (evidence: `src/Infrastructure/Persistence/ApplicationContext.cs`)
- Application database → QR records: persists (evidence: `src/Infrastructure/Persistence/ApplicationContext.cs`)
- Animal records → QR records: has QR association (evidence: `src/Domain/Entities/Animal.cs`)
- Cleanup job → Animal queries: finds deleted records (evidence: `src/Worker/Jobs/ClearDatabaseJob.cs`)
- Cleanup job → QR commands: removes QR records (evidence: `src/Worker/Jobs/ClearDatabaseJob.cs`)
- Cleanup job → Animal commands: removes animal records (evidence: `src/Worker/Jobs/ClearDatabaseJob.cs`)
- Administrator → Application database: edits profiles and records (evidence: `README.md`)
