# silentcoder52626/commonportfolio-server architecture

> Architecture diagram of the GitHub repository silentcoder52626/commonportfolio-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silentcoder52626/commonportfolio-server
- Repository: https://github.com/silentcoder52626/commonportfolio-server

## Overview

##### Main Components
- API Layer (CommonPortfolio.Api):
– Contains HTTP endpoints organized by feature (Account, Education, Experience, Skill, etc.).
– Contains configurations (e.g., Dockerfile, launchSettings, and .NET tooling setups), seeding, and extension methods.

- Domain Layer (CommonPortfolio.Domain):
– Contains the core business models (entities, enums, exceptions, constants).
– Holds service interfaces and domain-level helper utilities.
– This is where business rules and validations live.

- Infrastructure Layer(s):
– CommonPortfolio.Infrastructure.Sql and CommonPortfolio.Infrastructure:
▪ They handle database interactions using Entity Framework with migrations, mappings, and database context configurations.
▪ Include configurations for dependency injection, external services (Cloudinary for image upload), and email services.

##### Relationships and Interactions
- The API Layer (controllers/endpoints) acts as the entry point of the system. Requests hit REST endpoints which are then routed to the corresponding service in the Domain Layer.
- The Domain Layer contains business logic and orchestrates operations using its service implementations.
- The Infrastructure Layer implements the interfaces defined in the Domain. It handles data persistence, external API integrations (such as email or cloud storage), and data migrations.
- Optional components include DB seeding (under the API project) to initialize data and helper extensions.

##### Architectural Patterns and Technologies
- Layered (or Clean) Architecture: Separation into API (presentation), Domain (business logic), and Infrastructure (data access, integrations).
- Dependency Injection: Likely used to inject Domain service implementations from the Infrastructure into the API controllers.
- RESTful API Design: Notice endpoints split by feature with HTTP verbs/actions.
- ORM/Entity Framework: Evident from the mapping files and migrations in the Infrastructure SQL project.
- External Services Integration: For instance, Cloudinary for image handling and possibly an email sender service.
- .NET Core project structure with .csproj files for dependency and build management.

- Within the API section, illustrate individual controllers or endpoint groups (Account, Education, Experience, etc.) that all point to the Domain layer.
- In the Domain section, include blocks for Core Business Logic, Models/Entities, Service Interfaces, and Domain-level Utilities.
- In the Infrastructure section, break out the SQL/EF part (mappings, migrations, DB context) and a separate block for other external integrations (Cloudinary, Email Services).
- Optionally, add a side note for cross-cutting concerns such as configuration (Docker files, appsettings.json) and testing components.

Be sure to include clear labels, directional data flows, and a distinction between the different layers and components to make it easily readable by both team members and stakeholders.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "API Layer"
        A1["Endpoints & Feature Modules"]:::api
        A2["Dockerfile Configuration"]:::api
        A3["Appsettings Configuration"]:::api
        A4[".config Files"]:::api
        A5["Database Seeding"]:::api
        A6["Extension Methods"]:::api
    end

    subgraph "Domain Layer"
        D1["Business Models & Domain Services"]:::domain
    end

    subgraph "Infrastructure Layer"
        I1["SQL/EF Infrastructure (DbContext, Migrations, Mappings)"]:::infra
        I2["General Infrastructure (Email, Cloudinary)"]:::infra
    end

    A1 -->|"calls"| D1
    D1 -->|"persistsTo"| I1
    D1 -->|"integratesWith"| I2

    click A1 "https://github.com/silentcoder52626/commonportfolio-server/tree/master/CommonPortfolio.Api/Features"
    click A2 "https://github.com/silentcoder52626/commonportfolio-server/tree/master/CommonPortfolio.Api/Dockerfile"
    click A3 "https://github.com/silentcoder52626/commonportfolio-server/blob/master/CommonPortfolio.Api/appsettings.json"
    click A4 "https://github.com/silentcoder52626/commonportfolio-server/blob/master/CommonPortfolio.Api/.config"
    click A5 "https://github.com/silentcoder52626/commonportfolio-server/tree/master/CommonPortfolio.Api/DBSeeder"
    click A6 "https://github.com/silentcoder52626/commonportfolio-server/tree/master/CommonPortfolio.Api/Extensions"
    click D1 "https://github.com/silentcoder52626/commonportfolio-server/blob/master/CommonPortfolio.Domain"
    click I1 "https://github.com/silentcoder52626/commonportfolio-server/blob/master/CommonPortfolio.Infrastructure.Sql"
    click I2 "https://github.com/silentcoder52626/commonportfolio-server/blob/master/CommonPortfolio.Infrastructure"

    classDef api fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef domain fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef infra fill:#ffeeba,stroke:#856404,stroke-width:2px;
```
