# belalbeb/graduation_project architecture

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

- Interactive diagram: https://gitdiagram.com/belalbeb/graduation_project
- Repository: https://github.com/belalbeb/graduation_project

## Overview

1. **Overall shape**
   - This repository is an **ASP.NET Core backend API** for a graduation project that looks like a **job/recruitment platform**.
   - The codebase follows a clear layered pattern: **Controllers → Services → Repositories → Entity models / EF Core DbContext**.
   - API contracts are separated into a large **Dtos** layer, which is used to keep request/response payloads distinct from persistence models.

2. **Primary business domains**
   - The main functional areas are:
     - **Auth / user management**
     - **Applicant profiles**
     - **Company profiles and settings**
     - **Job postings**
     - **Applications and saved jobs**
     - **Interviews**
     - **Subscriptions / plans / coupons**
     - **Admin analytics and moderation**
     - **Website settings**
   - The number of domain-specific controllers and services suggests the system supports both **applicant-facing** and **company-facing** workflows, plus an **admin** layer.

3. **HTTP API layer**
   - The `Controllers` folder contains the outward-facing endpoints.
   - Controllers are split by feature, such as `ApplicantController`, `CompanyController`, `JobPostingController`, `InterviewController`, `SubscriptionController`, `AdminController`, and `AuthController`.
   - This layer is likely thin: it receives requests, validates/forwards data, and delegates business logic to services.

4. **Application/service layer**
   - The `Services` folder contains the core business rules and orchestration.
   - There are feature services for applicants, companies, job postings, resumes, interviews, subscriptions, settings, and admin operations.
   - Several service interfaces exist alongside implementations, indicating explicit dependency injection and a maintainable separation between contract and implementation.
   - This layer is where workflows like “apply for a job”, “schedule interview”, “update company settings”, or “expire subscriptions” are coordinated.

5. **Persistence and data access**
   - The `Repositories` folder contains the data-access boundary.
   - Each major entity/domain has a repository interface and implementation, including applicants, applications, companies, interviews, jobs, resumes, saved jobs, subscriptions, settings, and website settings.
   - `Models/ApplicationDbContext.cs` is the EF Core database context, and the large `Migrations` folder confirms **Entity Framework Core** is the persistence engine.
   - The architecture is therefore: service logic does not talk to the database directly; it goes through repositories backed by EF Core.

6. **Domain model**
   - The `Models` folder contains the persistent entities used by EF Core.
   - Key entities include `Applicant`, `Company`, `Application`, `JobPosting`, `Interview`, `Resume`, `Project`, `Experience`, `Skill`, `SubscriptionPlan`, `CompanySubscription`, `Coupon`, `SavedJobs`, `WebsiteSettings`, and various supporting entities.
   - There is also an `ApplicationUser` model and `Roles`, indicating authentication/authorization is integrated into the domain model rather than being external.

7. **API contract and DTO design**
   - The `Dtos` folder is extensive and organized by feature and consumer.
   - There are dedicated DTOs for:
     - public job cards and profiles,
     - applicant/company details,
     - admin dashboards,
     - interview scheduling and updates,
     - subscription flows,
     - settings/profile editing,
     - filter/search operations.
   - This indicates the API is designed to serve multiple UI surfaces with tailored payloads rather than exposing entities directly.

8. **Cross-cutting concerns**
   - `Middlewares/ExceptionMiddleware.cs` provides centralized exception handling.
   - `Exceptions` contains custom exception types such as bad request, not found, unauthorized, and a base custom exception.
   - `Responses/ErrorResponse.cs` suggests standardized API error payloads.
   - This means error handling is handled as a platform concern, not repeated in each controller.

9. **Background processing**
   - `BackgroundJobs/SubscriptionExpirationJob.cs` shows the project includes an asynchronous maintenance task.
   - Its purpose appears to be subscription lifecycle management, likely checking and expiring company subscriptions on a schedule.
   - This is an important architectural boundary because it handles time-based business logic outside of request/response traffic.

10. **External integrations**
   - `Services/CloudinaryService.cs` and `Configurations/CloudinarySettings.cs` show integration with **Cloudinary** for file/image storage, likely for profile photos, resumes, logos, or documents.
   - `Services/EmailService.cs` indicates outbound email notifications, probably for verification, account actions, or interview/subscription events.
   - These are the main external service boundaries visible in the repository.

11. **Authentication, authorization, and identity**
   - The presence of `ApplicationUser`, `CustomClaims`, auth-related DTOs, and `AuthController` indicates the system likely uses ASP.NET Core Identity or a similar identity setup.
   - `Seeds/RoleSeeder.cs`, `UserSeeder.cs`, and `UserRoleSeeder.cs` imply roles and initial users are bootstrapped into the system.
   - Authorization is probably role-based, separating applicants, companies, and admins.

12. **Initialization and test data**
   - The `Seeds` folder contains seeders for applicants, companies, jobs, interviews, resumes, skills, applications, saved jobs, roles, and users.
   - `Seeds/SeederRunner.cs` suggests a coordinated startup seed process.
   - This is important for architecture because it means the application can initialize a realistic dataset and role structure on startup or during deployment.

13. **Admin and reporting subsystem**
   - `AdminController` plus admin-specific DTOs and `Services/AdminServices.cs` point to a distinct admin management plane.
   - The admin side appears to cover dashboards, applicant/company summaries, job overviews, statistics, and likely moderation or verification review.
   - This is a separate concern from the normal applicant/company workflows and should be shown as its own subsystem in a diagram.

14. **Runtime, deployment, and tooling**
   - The repo is a **.NET solution** (`Graduation_Project.sln`) with a Dockerfile and `.http` request file for local API testing.
   - `Program.cs` is the composition root where dependency injection, middleware, EF Core, and hosted/background services are likely wired together.
   - The migration history shows the database schema is managed through EF Core migrations rather than handcrafted SQL.

15. **Primary request/data flow to diagram**
   - Typical flow: **client → controller → service → repository → DbContext/SQL database**.
   - For file/email/async operations, the service layer branches out to **Cloudinary** and **EmailService**.
   - For scheduled lifecycle actions, the **background job** works against the same subscription data model.
   - For startup state, **seeders** populate the database before normal traffic begins.

Main entry points: [`Repositories`](https://github.com/belalbeb/graduation_project/tree/master/Repositories) (Repositories), [`Program.cs`](https://github.com/belalbeb/graduation_project/blob/master/Program.cs) (Program), [`Models/ApplicationDbContext.cs`](https://github.com/belalbeb/graduation_project/blob/master/Models/ApplicationDbContext.cs) (App DbContext), [`Services`](https://github.com/belalbeb/graduation_project/tree/master/Services) (Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API layer"]
  node_controllers["Controllers<br/>http api"]
  node_dtos["DTOs<br/>api contracts"]
end

subgraph group_app["Application layer"]
  node_services["Services<br/>business logic"]
  node_authsvc["Auth & users<br/>identity services"]
  node_profilesvc["Profiles<br/>profile services<br/>[ProfileService.cs]"]
  node_jobsvc["Jobs & apps<br/>recruitment services"]
  node_interviewsvc["Interviews<br/>scheduling services"]
  node_subscriptionsvc["Subscriptions<br/>billing services"]
  node_adminsvc["Admin<br/>[AdminServices.cs]"]
  node_settingssvc["Settings"]
end

subgraph group_data["Persistence layer"]
  node_dbcontext[("App DbContext<br/>ef core context")]
  node_models["Models<br/>domain entities"]
  node_migrations["Migrations<br/>schema history"]
  node_repos["Repositories<br/>data access"]
end

subgraph group_infra["Infrastructure"]
  node_program["Program<br/>composition root<br/>[Program.cs]"]
  node_middleware(("Exception middleware<br/>cross-cutting"))
  node_errors(("Custom errors<br/>exceptions"))
  node_external["External services<br/>integrations"]
  node_bgjob["Subscription job<br/>background job"]
  node_seeders["Seeders<br/>bootstrap data<br/>[SeederRunner.cs]"]
end

node_program -->|"hosts"| node_controllers
node_program -->|"adds"| node_middleware
node_program -->|"configures"| node_dbcontext
node_program -->|"injects"| node_services
node_program -->|"injects"| node_repos
node_program -->|"runs"| node_seeders
node_controllers -->|"uses"| node_dtos
node_controllers -->|"delegates"| node_services
node_middleware -->|"maps"| node_errors
node_services -->|"reads/writes"| node_repos
node_services -->|"integrates"| node_external
node_bgjob -->|"invokes"| node_subscriptionsvc
node_seeders -->|"populates"| node_dbcontext
node_repos -->|"queries"| node_dbcontext
node_dbcontext -->|"tracks"| node_models
node_dbcontext -->|"evolves"| node_migrations
node_authsvc -->|"auth data"| node_repos
node_profilesvc -->|"profile data"| node_repos
node_jobsvc -->|"job data"| node_repos
node_interviewsvc -->|"interview data"| node_repos
node_subscriptionsvc -->|"billing data"| node_repos
node_adminsvc -->|"admin data"| node_repos
node_settingssvc -->|"settings data"| node_repos

click node_program "https://github.com/belalbeb/graduation_project/blob/master/Program.cs"
click node_controllers "https://github.com/belalbeb/graduation_project/tree/master/Controllers"
click node_dtos "https://github.com/belalbeb/graduation_project/tree/master/Dtos"
click node_middleware "https://github.com/belalbeb/graduation_project/blob/master/Middlewares/ExceptionMiddleware.cs"
click node_errors "https://github.com/belalbeb/graduation_project/tree/master/Exceptions"
click node_services "https://github.com/belalbeb/graduation_project/tree/master/Services"
click node_external "https://github.com/belalbeb/graduation_project/blob/master/Services/CloudinaryService.cs"
click node_bgjob "https://github.com/belalbeb/graduation_project/blob/master/BackgroundJobs/SubscriptionExpirationJob.cs"
click node_seeders "https://github.com/belalbeb/graduation_project/blob/master/Seeds/SeederRunner.cs"
click node_dbcontext "https://github.com/belalbeb/graduation_project/blob/master/Models/ApplicationDbContext.cs"
click node_models "https://github.com/belalbeb/graduation_project/tree/master/Models"
click node_migrations "https://github.com/belalbeb/graduation_project/tree/master/Migrations"
click node_repos "https://github.com/belalbeb/graduation_project/tree/master/Repositories"
click node_authsvc "https://github.com/belalbeb/graduation_project/blob/master/Services/SubscriptionService.cs"
click node_profilesvc "https://github.com/belalbeb/graduation_project/blob/master/Services/ProfileService.cs"
click node_jobsvc "https://github.com/belalbeb/graduation_project/blob/master/Services/JobPostingService.cs"
click node_interviewsvc "https://github.com/belalbeb/graduation_project/blob/master/Services/InterviewService.cs"
click node_subscriptionsvc "https://github.com/belalbeb/graduation_project/blob/master/Services/SubscriptionService.cs"
click node_adminsvc "https://github.com/belalbeb/graduation_project/blob/master/Services/AdminServices.cs"
click node_settingssvc "https://github.com/belalbeb/graduation_project/blob/master/Services/SettingsServices.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_controllers,node_dtos toneBlue
class node_services,node_authsvc,node_profilesvc,node_jobsvc,node_interviewsvc,node_subscriptionsvc,node_adminsvc,node_settingssvc toneAmber
class node_dbcontext,node_models,node_migrations,node_repos toneMint
class node_program,node_middleware,node_errors,node_external,node_bgjob,node_seeders toneRose
```

## Components

### API layer

HTTP controllers and request/response contracts

- [Controllers](https://github.com/belalbeb/graduation_project/tree/master/Controllers): http api · Feature controllers for auth, applicants, companies, jobs, applications, interviews, subscriptions, admin, and settings · `Controllers`
- [DTOs](https://github.com/belalbeb/graduation_project/tree/master/Dtos): api contracts · Request/response shapes for public, company, applicant, interview, subscription, and admin flows · `Dtos`

### Application layer

Business services and orchestration

- [Services](https://github.com/belalbeb/graduation_project/tree/master/Services): business logic · Core workflows and orchestration for platform features · `Services`
- [Auth & users](https://github.com/belalbeb/graduation_project/blob/master/Services/SubscriptionService.cs): identity services · Authentication, registration, claims, and role-aware user flows · `Services/SubscriptionService.cs`
- [Profiles](https://github.com/belalbeb/graduation_project/blob/master/Services/ProfileService.cs): profile services · Applicant, company, resume, project, skill, and experience management · `Services/ProfileService.cs`
- [Jobs & apps](https://github.com/belalbeb/graduation_project/blob/master/Services/JobPostingService.cs): recruitment services · Job postings, applications, saved jobs, and matching workflows · `Services/JobPostingService.cs`
- [Interviews](https://github.com/belalbeb/graduation_project/blob/master/Services/InterviewService.cs): scheduling services · Interview creation, updates, and company interview workflows · `Services/InterviewService.cs`
- [Subscriptions](https://github.com/belalbeb/graduation_project/blob/master/Services/SubscriptionService.cs): billing services · Plans, company subscriptions, coupons, and lifecycle management · `Services/SubscriptionService.cs`
- [Admin](https://github.com/belalbeb/graduation_project/blob/master/Services/AdminServices.cs): admin services · Dashboards, moderation, statistics, and back-office operations · `Services/AdminServices.cs`
- [Settings](https://github.com/belalbeb/graduation_project/blob/master/Services/SettingsServices.cs): settings services · Website and company configuration plus profile settings · `Services/SettingsServices.cs`

### Persistence layer

EF Core models, repositories, and database context

- [App DbContext](https://github.com/belalbeb/graduation_project/blob/master/Models/ApplicationDbContext.cs): ef core context · EF Core unit of work over the application database · `Models/ApplicationDbContext.cs`
- [Models](https://github.com/belalbeb/graduation_project/tree/master/Models): domain entities · Persisted users, applicants, companies, jobs, applications, interviews, subscriptions, and settings · `Models`
- [Migrations](https://github.com/belalbeb/graduation_project/tree/master/Migrations): schema history · EF Core schema evolution and snapshot history · `Migrations`
- [Repositories](https://github.com/belalbeb/graduation_project/tree/master/Repositories): data access · Persistence boundary for applicants, jobs, interviews, subscriptions, settings, profiles, and admin data · `Repositories`

### Infrastructure

Cross-cutting concerns, integrations, background jobs, and startup

- [Program](https://github.com/belalbeb/graduation_project/blob/master/Program.cs): composition root · Wires DI, middleware, EF Core, and hosted services · `Program.cs`
- [Exception middleware](https://github.com/belalbeb/graduation_project/blob/master/Middlewares/ExceptionMiddleware.cs): cross-cutting · Centralized API error handling and response normalization · `Middlewares/ExceptionMiddleware.cs`
- [Custom errors](https://github.com/belalbeb/graduation_project/tree/master/Exceptions): exceptions · Domain and HTTP exception types plus standardized error payloads · `Exceptions`
- [External services](https://github.com/belalbeb/graduation_project/blob/master/Services/CloudinaryService.cs): integrations · Cloudinary file storage and email delivery · `Services/CloudinaryService.cs`
- [Subscription job](https://github.com/belalbeb/graduation_project/blob/master/BackgroundJobs/SubscriptionExpirationJob.cs): background job · Scheduled expiration processing for company subscriptions · `BackgroundJobs/SubscriptionExpirationJob.cs`
- [Seeders](https://github.com/belalbeb/graduation_project/blob/master/Seeds/SeederRunner.cs): bootstrap data · Initial users, roles, and sample domain data for startup and testing · `Seeds/SeederRunner.cs`

## Connections

- Program → Controllers: hosts · Registers controllers into the HTTP pipeline
- Program → Exception middleware: adds · Enables centralized exception handling
- Program → App DbContext: configures · Connects EF Core to the database
- Program → Services: injects · Registers application services for DI
- Program → Repositories: injects · Registers repositories for DI
- Program → Seeders: runs · Bootstraps initial data and roles
- Controllers → DTOs: uses · Accepts and returns feature-specific payloads
- Controllers → Services: delegates · Forwards feature requests to business services
- Exception middleware → Custom errors: maps · Converts exceptions to standardized API responses
- Services → Repositories: reads/writes · Uses repositories as the persistence boundary
- Services → External services: integrates · Uploads files and sends emails
- Subscription job → Subscriptions: invokes · Executes scheduled subscription-expiration logic
- Seeders → App DbContext: populates · Loads initial data into the database
- Repositories → App DbContext: queries · Implements EF Core data access through the context
- App DbContext → Models: tracks · Maps and persists domain entities
- App DbContext → Migrations: evolves · Schema changes are captured as EF Core migrations
- Auth & users → Repositories: auth data · Coordinates user and role persistence
- Profiles → Repositories: profile data · Manages applicant and company profile records
- Jobs & apps → Repositories: job data · Manages postings, applications, and saved jobs
- Interviews → Repositories: interview data · Schedules and updates interview records
- Subscriptions → Repositories: billing data · Manages plans, subscriptions, and coupons
- Admin → Repositories: admin data · Builds dashboards and moderation views from persisted data
- Settings → Repositories: settings data · Updates website and company configuration
