# noureddin94/dating-app architecture

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

- Interactive diagram: https://gitdiagram.com/noureddin94/dating-app
- Repository: https://github.com/noureddin94/dating-app

## Overview

1. **Overall shape**
   - This is a single ASP.NET Core monolith for a dating app called **LoveMatch**.
   - It combines **MVC views**, **Razor Pages Identity**, **API controllers**, and a small **Razor Components/Blazor-style** UI surface in one web host.

2. **Request entry points**
   - `Program.cs` is the composition root: it wires web hosting, authentication, EF Core, dependency injection, and endpoint routing.
   - The app exposes three main request surfaces:
     - `Controllers/Web` for standard site pages like `Home`
     - `Controllers/API` for JSON operations
     - `Areas/Identity` for built-in account management and login flows

3. **Presentation layer**
   - `Presentation/DTOs` and `Presentation/ViewModels` separate transport shapes from domain entities.
   - `Views` provides the server-rendered UI shell and shared layout.
   - `Components` contains the component-based UI pieces, including routing and a `CustomAuthStateProvider` for authenticated component state.

4. **Business logic layer**
   - `Application/Services` contains the use-case logic for the app’s major features:
     - `ProfileService`
     - `LikeService`
     - `MatchService`
     - `MessageService`
     - `ModerationService`
     - `AdminService`
     - `GameService`
     - `LocationService`
     - `RandomUserService`
   - API controllers appear to be thin wrappers over these services.

5. **Domain model**
   - `Domain/Entities` holds the core data model for dating and social interactions:
     - users and profiles
     - likes and matches
     - conversations and messages
     - blocks and reports
     - game invites/sessions
     - profile images and daily action counts
   - `Domain/Enums` captures lifecycle/status values such as account, report, invite, and session states.

6. **Persistence boundary**
   - `Infrastructure/Data/AppDbContext.cs` is the EF Core persistence gateway.
   - `Infrastructure/Repositories/Repository.cs` implements the repository abstraction defined by `Domain/Interfaces/IRepository.cs`.
   - The main data flow is: controller/component → application service → repository/DbContext → database.

7. **External service integration**
   - `Domain/ExternalModels` suggests integrations with outside APIs for:
     - location data
     - random user generation
   - These integrations are wrapped by `LocationService` and `RandomUserService`, keeping external schemas out of the rest of the app.

8. **Authentication and user management**
   - `Areas/Identity` is the scaffolded ASP.NET Core Identity area for registration, login, password reset, email confirmation, 2FA, and account management.
   - `CustomAuthStateProvider` bridges auth state into the component-based UI.
   - This makes identity a first-class subsystem rather than custom-built authentication.

9. **Feature domains**
   - The app’s functional center is a dating/social platform:
     - profiles and images
     - liking and matching
     - messaging and conversations
     - blocking and moderation/reporting
     - admin workflows
     - game/session interactions
   - These are likely the key boundaries to show in a diagram because each maps cleanly to a service and controller pair.

10. **Operational and delivery concerns**
   - `docker-compose.yml` and `WebApp/Dockerfile` indicate containerized deployment.
   - GitHub Actions workflows cover CI and Docker image creation.
   - EF Core migrations in `Infrastructure/Migrations` show schema evolution is managed in code.

11. **Tests**
   - `WebApp.Test` is a separate test project, currently with `UserTest.cs`.
   - It appears to target domain/service behavior rather than UI, so the most important test boundary is likely the application/domain layer.

12. **Architectural summary for diagramming**
   - The cleanest diagram is: **UI surfaces** and **API controllers** at the top, **application services** in the middle, **domain entities/interfaces** underneath, and **Infrastructure/EF Core + external APIs** at the bottom.
   - Identity runs alongside the main app as a separate framework-backed subsystem, but shares the same host and authentication context.

Main entry points: [`WebApp/Application/Services`](https://github.com/noureddin94/dating-app/tree/main/WebApp/Application/Services) (Services hub), [`WebApp/Program.cs`](https://github.com/noureddin94/dating-app/blob/main/WebApp/Program.cs) (Program.cs), [`WebApp/Domain/Interfaces`](https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Interfaces) (Service contracts), [`WebApp/Domain/Entities`](https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Entities) (Entities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Web host"]
  node_program["Program.cs<br/>composition root<br/>[Program.cs]"]
  node_mvc["MVC site<br/>web UI<br/>[HomeController.cs]"]
  node_api["API controllers<br/>json API"]
  node_identity["Identity area<br/>auth subsystem"]
  node_components["Components UI<br/>component UI"]
  node_presentation["DTOs & VMs<br/>presentation models"]
end

subgraph group_app["Application layer"]
  node_services["Services hub<br/>application services"]
  node_profiles(("Profiles<br/>service cluster<br/>[ProfileService.cs]"))
  node_matching(("Likes & matches<br/>service cluster<br/>[LikeService.cs]"))
  node_messages(("Messaging<br/>service cluster<br/>[MessageService.cs]"))
  node_moderation(("Moderation & admin<br/>service cluster"))
  node_games(("Game & location<br/>service cluster<br/>[GameService.cs]"))
end

subgraph group_domain["Domain model"]
  node_entities[("Entities<br/>domain model")]
  node_interfaces["Service contracts<br/>domain interfaces"]
  node_externals["External models<br/>integration contracts"]
end

subgraph group_infra["Infrastructure"]
  node_dbcontext[("AppDbContext<br/>ef core gateway<br/>[AppDbContext.cs]")]
  node_repository["Repository<br/>data access<br/>[Repository.cs]"]
  node_database[("Database<br/>sql store")]
end

node_program -->|"hosts"| node_mvc
node_program -->|"maps"| node_api
node_program -->|"enables"| node_identity
node_program -->|"serves"| node_components
node_program -->|"injects"| node_services
node_program -->|"configures"| node_dbcontext
node_mvc -->|"uses"| node_presentation
node_api -->|"calls"| node_services
node_components -->|"calls"| node_services
node_components -->|"binds"| node_presentation
node_services -->|"contains"| node_profiles
node_services -->|"contains"| node_matching
node_services -->|"contains"| node_messages
node_services -->|"contains"| node_moderation
node_services -->|"contains"| node_games
node_profiles -->|"depends on"| node_interfaces
node_matching -->|"depends on"| node_interfaces
node_messages -->|"depends on"| node_interfaces
node_moderation -->|"depends on"| node_interfaces
node_games -->|"depends on"| node_interfaces
node_profiles -->|"reads/writes"| node_entities
node_matching -->|"reads/writes"| node_entities
node_messages -->|"reads/writes"| node_entities
node_moderation -->|"reads/writes"| node_entities
node_games -->|"reads/writes"| node_entities
node_games -->|"maps"| node_externals
node_interfaces -->|"implemented by"| node_repository
node_repository -->|"uses"| node_dbcontext
node_dbcontext -->|"persists to"| node_database

click node_program "https://github.com/noureddin94/dating-app/blob/main/WebApp/Program.cs"
click node_mvc "https://github.com/noureddin94/dating-app/blob/main/WebApp/Controllers/Web/HomeController.cs"
click node_api "https://github.com/noureddin94/dating-app/tree/main/WebApp/Controllers/API"
click node_identity "https://github.com/noureddin94/dating-app/tree/main/WebApp/Areas/Identity"
click node_components "https://github.com/noureddin94/dating-app/tree/main/WebApp/Components"
click node_presentation "https://github.com/noureddin94/dating-app/tree/main/WebApp/Presentation"
click node_services "https://github.com/noureddin94/dating-app/tree/main/WebApp/Application/Services"
click node_profiles "https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/ProfileService.cs"
click node_matching "https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/LikeService.cs"
click node_messages "https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/MessageService.cs"
click node_moderation "https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/ModerationService.cs"
click node_games "https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/GameService.cs"
click node_entities "https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Entities"
click node_interfaces "https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Interfaces"
click node_externals "https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/ExternalModels"
click node_dbcontext "https://github.com/noureddin94/dating-app/blob/main/WebApp/Infrastructure/Data/AppDbContext.cs"
click node_repository "https://github.com/noureddin94/dating-app/blob/main/WebApp/Infrastructure/Repositories/Repository.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_program,node_mvc,node_api,node_identity,node_components,node_presentation toneBlue
class node_services,node_profiles,node_matching,node_messages,node_moderation,node_games toneAmber
class node_entities,node_interfaces,node_externals toneMint
class node_dbcontext,node_repository,node_database toneRose
```

## Components

### Web host

Single ASP.NET Core application entry points and UI surfaces

- [Program.cs](https://github.com/noureddin94/dating-app/blob/main/WebApp/Program.cs): composition root · Configures hosting, DI, auth, EF Core, and routing · `WebApp/Program.cs`
- [MVC site](https://github.com/noureddin94/dating-app/blob/main/WebApp/Controllers/Web/HomeController.cs): web UI · Server-rendered pages and home controller · `WebApp/Controllers/Web/HomeController.cs`
- [API controllers](https://github.com/noureddin94/dating-app/tree/main/WebApp/Controllers/API): json API · Thin controller layer for feature endpoints · `WebApp/Controllers/API`
- [Identity area](https://github.com/noureddin94/dating-app/tree/main/WebApp/Areas/Identity): auth subsystem · Scaffolded ASP.NET Core Identity pages for account flows · `WebApp/Areas/Identity`
- [Components UI](https://github.com/noureddin94/dating-app/tree/main/WebApp/Components): component UI · Razor component surface and custom auth state · `WebApp/Components`
- [DTOs & VMs](https://github.com/noureddin94/dating-app/tree/main/WebApp/Presentation): presentation models · Transport and view models that separate UI from domain entities · `WebApp/Presentation`

### Application layer

Use-case services that coordinate dating-app features

- [Services hub](https://github.com/noureddin94/dating-app/tree/main/WebApp/Application/Services): application services · Main orchestration layer for feature workflows · `WebApp/Application/Services`
- [Profiles](https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/ProfileService.cs): service cluster · Profile creation, updates, and profile images · `WebApp/Application/Services/ProfileService.cs`
- [Likes & matches](https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/LikeService.cs): service cluster · Like and match lifecycle logic · `WebApp/Application/Services/LikeService.cs`
- [Messaging](https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/MessageService.cs): service cluster · Conversations and message delivery logic · `WebApp/Application/Services/MessageService.cs`
- [Moderation & admin](https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/ModerationService.cs): service cluster · Reports, blocks, and admin workflows · `WebApp/Application/Services/ModerationService.cs`
- [Game & location](https://github.com/noureddin94/dating-app/blob/main/WebApp/Application/Services/GameService.cs): service cluster · Game sessions plus location and random-user integrations · `WebApp/Application/Services/GameService.cs`

### Domain model

Entities, interfaces, and external contracts

- [Entities](https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Entities): domain model · Core dating, social, and session entities · `WebApp/Domain/Entities`
- [Service contracts](https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/Interfaces): domain interfaces · Abstractions for services and repositories · `WebApp/Domain/Interfaces`
- [External models](https://github.com/noureddin94/dating-app/tree/main/WebApp/Domain/ExternalModels): integration contracts · Schemas for location and random-user APIs · `WebApp/Domain/ExternalModels`

### Infrastructure

EF Core persistence and repository implementation

- [AppDbContext](https://github.com/noureddin94/dating-app/blob/main/WebApp/Infrastructure/Data/AppDbContext.cs): ef core gateway · EF Core persistence gateway for the domain model · `WebApp/Infrastructure/Data/AppDbContext.cs`
- [Repository](https://github.com/noureddin94/dating-app/blob/main/WebApp/Infrastructure/Repositories/Repository.cs): data access · Implements the repository abstraction over the database · `WebApp/Infrastructure/Repositories/Repository.cs`
- **Database**: sql store · Persisted application data managed through EF Core

## Connections

- Program.cs → MVC site: hosts · Registers MVC routing and site pages
- Program.cs → API controllers: maps · Exposes API controllers
- Program.cs → Identity area: enables · Wires the Identity area into the same host
- Program.cs → Components UI: serves · Provides the component-based UI surface
- Program.cs → Services hub: injects · Registers application services in DI
- Program.cs → AppDbContext: configures · Sets up EF Core and persistence
- MVC site → DTOs & VMs: uses · Renders view models and DTO-adjacent shapes
- API controllers → Services hub: calls · Thin wrapper around application use cases
- Components UI → Services hub: calls · Component actions use the same application services
- Components UI → DTOs & VMs: binds · Uses presentation models for component state
- Services hub → Profiles: contains · Profile use-case logic
- Services hub → Likes & matches: contains · Like and match orchestration
- Services hub → Messaging: contains · Conversation and messaging orchestration
- Services hub → Moderation & admin: contains · Moderation and admin orchestration
- Services hub → Game & location: contains · Game, location, and external-user orchestration
- Profiles → Service contracts: depends on · Uses repository and service abstractions
- Likes & matches → Service contracts: depends on · Uses repository and service abstractions
- Messaging → Service contracts: depends on · Uses repository and service abstractions
- Moderation & admin → Service contracts: depends on · Uses repository and service abstractions
- Game & location → Service contracts: depends on · Uses repository and service abstractions
- Profiles → Entities: reads/writes · Works with user profiles and images
- Likes & matches → Entities: reads/writes · Works with likes and matches
- Messaging → Entities: reads/writes · Works with conversations and messages
- Moderation & admin → Entities: reads/writes · Works with blocks and reports
- Game & location → Entities: reads/writes · Works with game invites, sessions, and counters
- Game & location → External models: maps · Wraps external location and random-user schemas
- Service contracts → Repository: implemented by · Repository abstraction is implemented in infrastructure
- Repository → AppDbContext: uses · Persists through EF Core
- AppDbContext → Database: persists to · Stores application state in the backing database
