# rafaelanacleto/cleanarchmvc architecture

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

- Interactive diagram: https://gitdiagram.com/rafaelanacleto/cleanarchmvc
- Repository: https://github.com/rafaelanacleto/cleanarchmvc

## Overview

CleanArchMvc is a layered product-management application with both an MVC web UI and a JSON API, plus user registration and authentication. The main workflow is a user request entering a controller, passing through an application service and request handler, and reaching a repository for category or product operations. Sampled handlers confirm repository calls; the README is empty and service, repository, and startup implementations were not sampled, so their internal wiring and persistence details are not asserted.

Main entry points: [`CleanArchMvc.Infra.Data/Context/ApplicationDbContext.cs`](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Context/ApplicationDbContext.cs) (Application Context), [`CleanArchMvc.Domain/Account/IAuthenticate.cs`](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Account/IAuthenticate.cs) (Authentication Contract), [`CleanArchMvc.Infra.Data/Repositories/CategoryRepository.cs`](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/CategoryRepository.cs) (Category Repository Impl), [`CleanArchMvc.Infra.Data/Repositories/ProdutctRepository.cs`](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/ProdutctRepository.cs) (Product Repository Impl)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_web_categories["Web Categories"]
  node_web_products["Web Products"]
  node_account_ui["Web Account"]
  node_api_categories["API Categories"]
  node_api_products["API Products"]
  node_tokens["Token API<br/>[TokenController.cs]"]
end

subgraph group_application["Application Operations"]
  node_category_service["Category Service<br/>[CategoryService.cs]"]
  node_product_service["Product Service<br/>[ProductService.cs]"]
  node_category_handlers["Category Handlers"]
  node_product_handlers["Product Handlers"]
end

subgraph group_domain["Domain Model"]
  node_category_repo["Category Repository"]
  node_product_repo["Product Repository"]
  node_category_entity["Category Entity<br/>[Category.cs]"]
  node_product_entity["Product Entity<br/>[Product.cs]"]
  node_auth_contract["Authentication Contract<br/>[IAuthenticate.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_category_repo_impl["Category Repository Impl"]
  node_product_repo_impl["Product Repository Impl"]
  node_db_context["Application Context"]
  node_database[("Application Database")]
  node_auth_service["Authentication Service"]
  node_identity[("ASP.NET Identity")]
end

node_user(("User"))

node_user -->|"requests pages"| node_web_categories
node_user -->|"requests pages"| node_web_products
node_user -->|"manages account"| node_account_ui
node_user -->|"sends requests"| node_api_categories
node_user -->|"sends requests"| node_api_products
node_user -->|"requests token"| node_tokens
node_web_categories -->|"calls"| node_category_service
node_web_products -->|"calls"| node_product_service
node_api_categories -->|"calls"| node_category_service
node_api_products -->|"calls"| node_product_service
node_tokens -->|"authenticates"| node_auth_contract
node_account_ui -->|"uses"| node_auth_contract
node_category_handlers -->|"queries"| node_category_repo
node_product_handlers -->|"queries"| node_product_repo
node_category_repo_impl -->|"implements"| node_category_repo
node_product_repo_impl -->|"implements"| node_product_repo
node_auth_service -->|"implements"| node_auth_contract
node_auth_service -->|"uses"| node_identity
node_category_repo_impl --> node_db_context
node_product_repo_impl --> node_db_context
node_db_context --> node_database

click node_web_categories "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/CategoriesController.cs"
click node_web_products "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/ProductsController.cs"
click node_account_ui "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/AccountController.cs"
click node_api_categories "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/CategoriesController.cs"
click node_api_products "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/ProductsController.cs"
click node_tokens "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/TokenController.cs"
click node_category_service "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Services/CategoryService.cs"
click node_product_service "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Services/ProductService.cs"
click node_category_handlers "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Categories/Handlers/GetCategoriesQueryHandler.cs"
click node_product_handlers "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Products/Handlers/GetProductsQueryHandler.cs"
click node_category_repo "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Interfaces/ICategoryRepository.cs"
click node_product_repo "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Interfaces/IProductRepository.cs"
click node_category_entity "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Entities/Category.cs"
click node_product_entity "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Entities/Product.cs"
click node_category_repo_impl "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/CategoryRepository.cs"
click node_product_repo_impl "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/ProdutctRepository.cs"
click node_db_context "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Context/ApplicationDbContext.cs"
click node_auth_service "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Identity/AuthenticateService.cs"
click node_auth_contract "https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Account/IAuthenticate.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_web_categories,node_web_products,node_account_ui,node_api_categories,node_api_products,node_tokens,node_user toneBlue
class node_category_service,node_product_service,node_category_handlers,node_product_handlers toneAmber
class node_category_repo,node_product_repo,node_category_entity,node_product_entity,node_auth_contract toneMint
class node_category_repo_impl,node_product_repo_impl,node_db_context,node_database,node_auth_service,node_identity toneRose
```

## Components

### User Interfaces

- [Web Categories](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/CategoriesController.cs): `CleanArchMvc.WebUI/Controllers/CategoriesController.cs`
- [Web Products](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/ProductsController.cs): `CleanArchMvc.WebUI/Controllers/ProductsController.cs`
- [Web Account](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.WebUI/Controllers/AccountController.cs): `CleanArchMvc.WebUI/Controllers/AccountController.cs`
- [API Categories](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/CategoriesController.cs): `CleanArchMvc.API/Controllers/CategoriesController.cs`
- [API Products](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/ProductsController.cs): `CleanArchMvc.API/Controllers/ProductsController.cs`
- [Token API](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.API/Controllers/TokenController.cs): `CleanArchMvc.API/Controllers/TokenController.cs`

### Application Operations

- [Category Service](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Services/CategoryService.cs): `CleanArchMvc.Application/Services/CategoryService.cs`
- [Product Service](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Services/ProductService.cs): `CleanArchMvc.Application/Services/ProductService.cs`
- [Category Handlers](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Categories/Handlers/GetCategoriesQueryHandler.cs): `CleanArchMvc.Application/Categories/Handlers/GetCategoriesQueryHandler.cs`
- [Product Handlers](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Application/Products/Handlers/GetProductsQueryHandler.cs): `CleanArchMvc.Application/Products/Handlers/GetProductsQueryHandler.cs`

### Domain Model

- [Category Repository](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Interfaces/ICategoryRepository.cs): `CleanArchMvc.Domain/Interfaces/ICategoryRepository.cs`
- [Product Repository](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Interfaces/IProductRepository.cs): `CleanArchMvc.Domain/Interfaces/IProductRepository.cs`
- [Category Entity](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Entities/Category.cs): `CleanArchMvc.Domain/Entities/Category.cs`
- [Product Entity](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Entities/Product.cs): `CleanArchMvc.Domain/Entities/Product.cs`
- [Authentication Contract](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Domain/Account/IAuthenticate.cs): `CleanArchMvc.Domain/Account/IAuthenticate.cs`

### Infrastructure

- [Category Repository Impl](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/CategoryRepository.cs): `CleanArchMvc.Infra.Data/Repositories/CategoryRepository.cs`
- [Product Repository Impl](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Repositories/ProdutctRepository.cs): `CleanArchMvc.Infra.Data/Repositories/ProdutctRepository.cs`
- [Application Context](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Context/ApplicationDbContext.cs): `CleanArchMvc.Infra.Data/Context/ApplicationDbContext.cs`
- **Application Database**
- [Authentication Service](https://github.com/rafaelanacleto/cleanarchmvc/blob/main/CleanArchMvc.Infra.Data/Identity/AuthenticateService.cs): `CleanArchMvc.Infra.Data/Identity/AuthenticateService.cs`
- **ASP.NET Identity**

### Other components

- **User**

## Connections

- User → Web Categories: requests pages
- User → Web Products: requests pages
- User → Web Account: manages account
- User → API Categories: sends requests
- User → API Products: sends requests
- User → Token API: requests token
- Web Categories → Category Service: calls
- Web Products → Product Service: calls
- API Categories → Category Service: calls
- API Products → Product Service: calls
- Token API → Authentication Contract: authenticates
- Web Account → Authentication Contract: uses
- Category Handlers → Category Repository: queries
- Product Handlers → Product Repository: queries
- Category Repository Impl → Category Repository: implements
- Product Repository Impl → Product Repository: implements
- Authentication Service → Authentication Contract: implements
- Authentication Service → ASP.NET Identity: uses
- Category Repository Impl → Application Context
- Product Repository Impl → Application Context
- Application Context → Application Database
