# trduc2712/choco-api architecture

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

- Interactive diagram: https://gitdiagram.com/trduc2712/choco-api
- Repository: https://github.com/trduc2712/choco-api

## Overview

Choco is an ASP.NET Core backend for a social platform. Its broad user-facing capabilities include profiles and follows, posts and feeds, comments and reactions, messaging, notifications, feedback, and moderation. The sampled code shows report-listing and audit-log query handlers assembling responses from domain repositories; the repository tree also identifies persistence and object-storage implementations. The available excerpts do not establish most controller-to-handler or infrastructure wiring, so those connections are omitted rather than inferred.

Main entry points: [`src/Choco.Application/Reports`](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Reports) (Report queues), [`src/Choco.Application/AuditLogs`](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/AuditLogs) (Audit logs), [`src/Choco.Domain/Users/IUserRepository.cs`](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Users/IUserRepository.cs) (User repository), [`src/Choco.Domain/Posts/IPostRepository.cs`](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Posts/IPostRepository.cs) (Post repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_api["HTTP API<br/>[ApiController.cs]"]
end

subgraph group_social["Social features"]
  node_profiles["Profiles and follows<br/>[Users]"]
  node_posts["Posts and feeds<br/>[Posts]"]
  node_comments["Comments<br/>[Comments]"]
  node_messaging["Conversations<br/>[Messages]"]
  node_notifications["Notifications<br/>[Notifications]"]
  node_feedback["Feedback<br/>[Feedback]"]
end

subgraph group_moderation["Trust and administration"]
  node_reports["Report queues<br/>[Reports]"]
  node_audit["Audit logs<br/>[AuditLogs]"]
  node_admin["Admin controls<br/>[Roles]"]
end

subgraph group_platform["Application and data"]
  node_userrepo["User repository<br/>[IUserRepository.cs]"]
  node_postrepo["Post repository<br/>[IPostRepository.cs]"]
  node_reportrepo["Report repository"]
  node_persistence[("EF persistence<br/>[ChocoDbContext.cs]")]
  node_storage["Object storage<br/>[S3ObjectStorage.cs]"]
end

node_client(("Social app"))

node_client -->|"uses backend"| node_api
node_reports -->|"queries reports"| node_reportrepo
node_reports -->|"loads posts"| node_postrepo
node_reports -->|"loads users"| node_userrepo
node_audit -->|"loads users"| node_userrepo
node_audit -->|"loads targets"| node_postrepo

click node_api "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Presentation/Abstractions/ApiController.cs"
click node_profiles "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Users"
click node_posts "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Posts"
click node_comments "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Comments"
click node_messaging "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Messages"
click node_notifications "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Notifications"
click node_feedback "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Feedback"
click node_reports "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Reports"
click node_audit "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/AuditLogs"
click node_admin "https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Roles"
click node_userrepo "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Users/IUserRepository.cs"
click node_postrepo "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Posts/IPostRepository.cs"
click node_reportrepo "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Reports/IReportRepository.cs"
click node_persistence "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Infrastructure/Persistence/ChocoDbContext.cs"
click node_storage "https://github.com/trduc2712/choco-api/blob/main/src/Choco.Infrastructure/Storage/S3ObjectStorage.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_api toneBlue
class node_profiles,node_posts,node_comments,node_messaging,node_notifications,node_feedback toneAmber
class node_reports,node_audit,node_admin toneMint
class node_userrepo,node_postrepo,node_reportrepo,node_persistence,node_storage toneRose
class node_client toneIndigo
```

## Components

### API surface

- [HTTP API](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Presentation/Abstractions/ApiController.cs): `src/Choco.Presentation/Abstractions/ApiController.cs`

### Social features

- [Profiles and follows](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Users): `src/Choco.Application/Users`
- [Posts and feeds](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Posts): `src/Choco.Application/Posts`
- [Comments](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Comments): `src/Choco.Application/Comments`
- [Conversations](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Messages): `src/Choco.Application/Messages`
- [Notifications](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Notifications): `src/Choco.Application/Notifications`
- [Feedback](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Feedback): `src/Choco.Application/Feedback`

### Trust and administration

- [Report queues](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Reports): `src/Choco.Application/Reports`
- [Audit logs](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/AuditLogs): `src/Choco.Application/AuditLogs`
- [Admin controls](https://github.com/trduc2712/choco-api/tree/main/src/Choco.Application/Roles): `src/Choco.Application/Roles`

### Application and data

- [User repository](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Users/IUserRepository.cs): `src/Choco.Domain/Users/IUserRepository.cs`
- [Post repository](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Posts/IPostRepository.cs): `src/Choco.Domain/Posts/IPostRepository.cs`
- [Report repository](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Domain/Reports/IReportRepository.cs): `src/Choco.Domain/Reports/IReportRepository.cs`
- [EF persistence](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Infrastructure/Persistence/ChocoDbContext.cs): `src/Choco.Infrastructure/Persistence/ChocoDbContext.cs`
- [Object storage](https://github.com/trduc2712/choco-api/blob/main/src/Choco.Infrastructure/Storage/S3ObjectStorage.cs): `src/Choco.Infrastructure/Storage/S3ObjectStorage.cs`

### Other components

- **Social app**

## Connections

- Social app → HTTP API: uses backend (evidence: `README.md`)
- Report queues → Report repository: queries reports (evidence: `src/Choco.Application/Reports/GetReports/GetReportsQueryHandler.cs`)
- Report queues → Post repository: loads posts (evidence: `src/Choco.Application/Reports/GetReports/GetReportsQueryHandler.cs`)
- Report queues → User repository: loads users (evidence: `src/Choco.Application/Reports/GetReports/GetReportsQueryHandler.cs`)
- Audit logs → User repository: loads users (evidence: `src/Choco.Application/AuditLogs/GetAuditLog/GetAuditLogQueryHandler.cs`)
- Audit logs → Post repository: loads targets (evidence: `src/Choco.Application/AuditLogs/GetAuditLog/GetAuditLogQueryHandler.cs`)
