# mohamedahmed2005/skillmatcher architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedahmed2005/skillmatcher
- Repository: https://github.com/mohamedahmed2005/skillmatcher

## Overview

#### 1. Purpose and runtime entry point
SkillMatch is a .NET 8 ASP.NET Core REST API for recruitment: candidates manage profiles/CVs, employers manage job postings, and matching combines skills with AI CV analysis. Startup, dependency injection, middleware, authentication, EF Core, and API documentation are composed in `SkillMatch.API/SkillMatch.API/Program.cs`; HTTP entry points are in `SkillMatch.API/SkillMatch.API/Controllers/`.

#### 2. HTTP and application boundary
Controllers are the API boundary and should remain thin, delegating work to service contracts and exchanging DTOs rather than entities:
- Authentication: `Controllers/AuthController.cs`
- Candidate profile/CV workflows: `Controllers/ProfilesController.cs`
- Job search and employer job management: `Controllers/JobsController.cs`
- Recommendations and CV-vs-job analysis: `Controllers/MatchingController.cs`

DTOs separate request/response payloads from the domain, notably `Core/DTOs/Auth/`, `Core/DTOs/Jobs/`, and `Core/DTOs/Matching/`. Global error translation is centralized in `Middlewares/ExceptionHandlingMiddleware.cs`.

#### 3. Domain model
Core recruitment state is modeled independently of infrastructure. All entities share ID and audit fields through `Core/Entities/Base/BaseEntity.cs`. Principal aggregates are users/profiles, jobs, skills, resumes, and applications:
- `Core/Entities/ApplicationUser.cs`
- `Core/Entities/CandidateProfile.cs`
- `Core/Entities/CompanyProfile.cs`
- `Core/Entities/JobPosting.cs`
- `Core/Entities/ResumeDocument.cs`
- `Core/Entities/Skill.cs`
- `Core/Entities/JobApplication.cs`

Roles, application state, and experience levels are explicit domain enums under `Core/Enums/`.

#### 4. Authentication and authorization
The API uses custom JWT access/refresh tokens rather than ASP.NET Core Identity. `Infrastructure/Services/AuthService.cs` implements the authentication workflow behind `Core/Interfaces/Services/IAuthService.cs`; token construction/validation support is in `Helpers/JwtHelper.cs`. Role-based authorization distinguishes Candidate, Employer, and Admin via `Core/Enums/UserRole.cs`. Auth configuration and signing secrets are runtime configuration in `appsettings.json`.

#### 5. Business services and matching pipeline
Service contracts isolate controller workflows from persistence and provider details:
- Candidate/profile and CV upload: `Core/Interfaces/Services/ICandidateService.cs`, implemented by `Infrastructure/Services/CandidateService.cs`.
- Job creation, updates, listings, and filtering: `Core/Interfaces/Services/IJobService.cs`, implemented by `Infrastructure/Services/JobService.cs`.
- Resume ingestion: uploaded document → storage → PDF text/skill extraction via `Infrastructure/Services/PdfCvParserService.cs`.
- Matching: candidate skills support recommendations; CV text plus job description is sent through `Core/Interfaces/Services/IAiMatchingService.cs` to yield `Core/DTOs/Matching/MatchResultDto.cs`.

#### 6. Persistence architecture
EF Core persists the domain to SQL Server through `Infrastructure/Data/ApplicationDbContext.cs`, with schema history under `Migrations/`. Services access persistence through repository and unit-of-work abstractions, not the DbContext directly:
- Contracts: `Core/Interfaces/Repositories/IGenericRepository.cs`, `Core/Interfaces/Repositories/IUnitOfWork.cs`
- Generic and specialized query implementations: `Infrastructure/Repositories/GenericRepository.cs`, `Infrastructure/Repositories/CandidateRepository.cs`, `Infrastructure/Repositories/JobRepository.cs`
- Transaction/save boundary: `Infrastructure/Repositories/UnitOfWork.cs`

This creates the key boundary: controllers → services → repository interfaces/unit of work → EF Core/SQL Server.

#### 7. External-provider adapters and deployment dependencies
Files are stored behind `Core/Interfaces/Services/IFileStorageService.cs`; implementations permit local filesystem or Azure Blob Storage: `Infrastructure/Services/LocalFileStorageService.cs` and `Infrastructure/Services/AzureBlobStorageService.cs`. AI matching is similarly replaceable between Google Gemini and OpenAI: `Infrastructure/Services/GeminiAiService.cs` and `Infrastructure/Services/OpenAiService.cs`. These providers use configured credentials/endpoints and are selected through DI at startup. Material runtime dependencies are .NET 8, SQL Server, configured JWT keys, AI API credentials, and optionally Azure Blob Storage.

Main entry points: [`SkillMatch.API/SkillMatch.API/Program.cs`](https://github.com/mohamedahmed2005/skillmatcher/blob/main/SkillMatch.API/SkillMatch.API/Program.cs) (Startup & DI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Host"]
  node_startup["Startup &amp; DI<br/>ASP.NET Core host<br/>[Program.cs]"]
  node_controllers["REST Controllers<br/>HTTP boundary"]
  node_errors["Exception Middleware<br/>global error handling"]
end

subgraph group_core["Core Domain"]
  node_dto["API DTOs<br/>request/response models"]
  node_domain["Recruitment Aggregates<br/>domain entities"]
  node_roles["Roles &amp; States<br/>domain enums"]
  node_repositories["Repository Contracts<br/>IGenericRepository + IUnitOfWork"]
end

subgraph group_app["Application Services"]
  node_auth["Authentication Service<br/>IAuthService + implementation"]
  node_candidate["Candidate &amp; CV Service<br/>ICandidateService + implementation"]
  node_jobs["Job Service<br/>IJobService + implementation"]
  node_matching["Matching Service Contract<br/>IAiMatchingService"]
end

subgraph group_infra["Infrastructure"]
  node_pdf["PDF CV Parser<br/>resume ingestion"]
  node_storage["File Storage Adapter<br/>IFileStorageService"]
  node_uow["Repositories &amp; Unit of Work<br/>persistence implementation"]
  node_dbcontext[("EF Core DbContext<br/>ApplicationDbContext")]
end

subgraph group_external["External Dependencies"]
  node_sql[("SQL Server<br/>database")]
  node_ai{{"AI Provider<br/>Gemini or OpenAI"}}
  node_blob[("Azure Blob Storage<br/>optional object storage")]
end

node_startup -->|"hosts"| node_controllers
node_startup -->|"registers"| node_errors
node_startup -->|"wires"| node_auth
node_startup -->|"wires"| node_candidate
node_startup -->|"wires"| node_jobs
node_startup -->|"selects implementation"| node_matching
node_controllers -->|"exchanges"| node_dto
node_controllers -->|"auth workflows"| node_auth
node_controllers -->|"profile and CV workflows"| node_candidate
node_controllers -->|"job workflows"| node_jobs
node_controllers -->|"recommendations and analysis"| node_matching
node_auth -->|"authorizes by"| node_roles
node_candidate -->|"parses uploaded CV"| node_pdf
node_candidate -->|"stores document"| node_storage
node_candidate -->|"persists through"| node_repositories
node_jobs -->|"persists through"| node_repositories
node_matching -->|"sends CV text and job description"| node_ai
node_matching -->|"reads skills and jobs"| node_repositories
node_repositories -->|"implemented by"| node_uow
node_uow -->|"uses"| node_dbcontext
node_dbcontext -->|"maps"| node_domain
node_dbcontext -->|"persists to"| node_sql
node_storage -.->|"optional backend"| node_blob

click node_startup "https://github.com/mohamedahmed2005/skillmatcher/blob/main/SkillMatch.API/SkillMatch.API/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_startup,node_controllers,node_errors toneBlue
class node_dto,node_domain,node_roles,node_repositories toneAmber
class node_auth,node_candidate,node_jobs,node_matching toneMint
class node_pdf,node_storage,node_uow,node_dbcontext toneRose
class node_sql,node_ai,node_blob toneIndigo
```

## Components

### API Host

- [Startup & DI](https://github.com/mohamedahmed2005/skillmatcher/blob/main/SkillMatch.API/SkillMatch.API/Program.cs): ASP.NET Core host · Composes middleware, auth, EF Core, services, and provider implementations. · `SkillMatch.API/SkillMatch.API/Program.cs`
- **REST Controllers**: HTTP boundary · Auth, profiles, jobs, and matching endpoints delegate to service contracts.
- **Exception Middleware**: global error handling

### Core Domain

- **API DTOs**: request/response models
- **Recruitment Aggregates**: domain entities · Users, profiles, jobs, resumes, skills, and applications share audited base state.
- **Roles & States**: domain enums · Candidate, Employer, and Admin authorization roles plus recruitment states.
- **Repository Contracts**: IGenericRepository + IUnitOfWork · Service-facing persistence and transaction boundary.

### Application Services

- **Authentication Service**: IAuthService + implementation · Authenticates users and issues custom JWT access and refresh tokens.
- **Candidate & CV Service**: ICandidateService + implementation · Manages candidate profiles and CV upload workflows.
- **Job Service**: IJobService + implementation · Creates, updates, lists, and filters job postings.
- **Matching Service Contract**: IAiMatchingService · Produces CV-versus-job analysis and match results through a replaceable AI adapter.

### Infrastructure

- **PDF CV Parser**: resume ingestion · Extracts text and skills from uploaded PDF CVs.
- **File Storage Adapter**: IFileStorageService · DI selects local filesystem or Azure Blob Storage.
- **Repositories & Unit of Work**: persistence implementation · Generic and specialized repositories execute queries and commits.
- **EF Core DbContext**: ApplicationDbContext · Maps domain state and migrations to SQL Server.

### External Dependencies

- **SQL Server**: database
- **AI Provider**: Gemini or OpenAI · DI selects the configured AI matching implementation.
- **Azure Blob Storage**: optional object storage

## Connections

- Startup & DI → REST Controllers: hosts
- Startup & DI → Exception Middleware: registers
- Startup & DI → Authentication Service: wires
- Startup & DI → Candidate & CV Service: wires
- Startup & DI → Job Service: wires
- Startup & DI → Matching Service Contract: selects implementation
- REST Controllers → API DTOs: exchanges
- REST Controllers → Authentication Service: auth workflows
- REST Controllers → Candidate & CV Service: profile and CV workflows
- REST Controllers → Job Service: job workflows
- REST Controllers → Matching Service Contract: recommendations and analysis
- Authentication Service → Roles & States: authorizes by
- Candidate & CV Service → PDF CV Parser: parses uploaded CV
- Candidate & CV Service → File Storage Adapter: stores document
- Candidate & CV Service → Repository Contracts: persists through
- Job Service → Repository Contracts: persists through
- Matching Service Contract → AI Provider: sends CV text and job description
- Matching Service Contract → Repository Contracts: reads skills and jobs
- Repository Contracts → Repositories & Unit of Work: implemented by
- Repositories & Unit of Work → EF Core DbContext: uses
- EF Core DbContext → Recruitment Aggregates: maps
- EF Core DbContext → SQL Server: persists to
- File Storage Adapter → Azure Blob Storage: optional backend
