# gologic-ca/exemple-netcore8-ghcopilot architecture

> Architecture diagram of the GitHub repository gologic-ca/exemple-netcore8-ghcopilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gologic-ca/exemple-netcore8-ghcopilot
- Repository: https://github.com/gologic-ca/exemple-netcore8-ghcopilot

## Overview

##### Main Components
- Client/Consumer Side: Although the client isn’t directly part of the repository, note that the application is intended to be accessed via a web client or tools like Postman and also supports Swagger at http://localhost:5000/swagger.
- API Layer: The ASP.NET Core application encapsulated in the “src/Conduit” project is the core of the system.
- Feature Modules: Inside “src/Conduit/Features”, you have discrete modules for:
- Articles (including creation, deletion, editing, listing, details)
- Comments
- Favorites
- Followers
- Profiles
- Tags
- Users
- Domain Layer: Located under “src/Conduit/Domain”, this includes the business entities (such as Article, Comment, Person, Tag, etc.) that represent the core domain objects.
- Infrastructure Layer: Found under “src/Conduit/Infrastructure”, this layer handles data persistence (via ConduitContext), security (JWT token generation, password hashing), error handling, validation, and other cross-cutting concerns.
- Database: The project includes a “realworld.db” file, suggesting usage of a local or file-based database for example/demo purposes.
- Build & CI/CD Components: Notice the build folder containing build scripts and the GitHub Actions workflows (.github/workflows) that drive automated builds and tests.

##### Mapping Relationships and Interactions
- The Clients (either browsers leveraging Swagger/Postman or a frontend application) trigger HTTP requests to the API controllers found in each feature folder.
- API Controllers then interact with the Domain models and Feature-layer classes to process these requests.
- The Infrastructure layer supports these interactions by offering data persistence (likely via an ORM and a DbContext), security (authentication via JWT tokens), and error handling middleware.
- Auxiliary components such as the “build” scripts and CI/CD configuration (GitHub Actions) are used to compile, test, and manage releases.

##### Architectural Patterns & Design Principles
- Feature-Oriented Organization: Each major feature (Articles, Users, etc.) is well encapsulated, with its relevant controllers, DTOs (envelopes), and domain logic, contributing to modularity.
- Layered Architecture and Separation of Concerns: The separation into Domain, Features, and Infrastructure ensures responsibilities are modular. For instance, error handling and security are modularized in the Infrastructure folder.
- Dependency Injection & Pipeline Behaviors: Look at components such as 'ValidationPipelineBehavior' and 'DBContextTransactionPipelineBehavior' which hint at middleware and pipeline processing (likely in conjunction with MediatR or similar libraries).

- Use clear labels such as “ArticlesController”, “ConduitContext”, “JwtTokenGenerator”, etc., to indicate precise responsibilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client / Swagger / Postman"]:::client

    subgraph "ASP.NET Core Backend (Conduit)"
        ApiCore["ASP.NET Core API"]:::api
        subgraph "Feature Modules"
            Articles["Articles Module"]:::api
            Comments["Comments Module"]:::api
            Favorites["Favorites Module"]:::api
            Followers["Followers Module"]:::api
            Profiles["Profiles Module"]:::api
            Tags["Tags Module"]:::api
            Users["Users Module"]:::api
        end
        subgraph "Domain Layer"
            DomainEntities["Domain Entities"]:::domain
        end
        subgraph "Infrastructure Layer"
            Infrastructure["Infrastructure Services"]:::infra
            Db["realworld.db"]:::db
        end
    end

    Build["Build & CI/CD"]:::build

    Client -->|"HTTP_Request"| ApiCore

    ApiCore -->|"routes_to"| Articles
    ApiCore -->|"routes_to"| Comments
    ApiCore -->|"routes_to"| Favorites
    ApiCore -->|"routes_to"| Followers
    ApiCore -->|"routes_to"| Profiles
    ApiCore -->|"routes_to"| Tags
    ApiCore -->|"routes_to"| Users

    Articles -->|"calls"| DomainEntities
    Comments -->|"calls"| DomainEntities
    Favorites -->|"calls"| DomainEntities
    Followers -->|"calls"| DomainEntities
    Profiles -->|"calls"| DomainEntities
    Tags -->|"calls"| DomainEntities
    Users -->|"calls"| DomainEntities

    Articles -->|"uses"| Infrastructure
    Comments -->|"uses"| Infrastructure
    Favorites -->|"uses"| Infrastructure
    Followers -->|"uses"| Infrastructure
    Profiles -->|"uses"| Infrastructure
    Tags -->|"uses"| Infrastructure
    Users -->|"uses"| Infrastructure

    DomainEntities -->|"accesses"| Infrastructure

    Infrastructure -->|"persists_to"| Db

    Build -- "triggers_build" --> ApiCore

    click ApiCore "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/blob/master/src/Conduit/Conduit.csproj"
    click ApiCore "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/blob/master/src/Conduit/Program.cs"
    click ApiCore "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/blob/master/src/Conduit/ServicesExtensions.cs"
    click Articles "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Articles"
    click Comments "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Comments"
    click Favorites "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Favorites"
    click Followers "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Followers"
    click Profiles "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Profiles"
    click Tags "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Tags"
    click Users "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Features/Users"
    click DomainEntities "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Domain"
    click Infrastructure "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/src/Conduit/Infrastructure"
    click Db "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/blob/master/src/Conduit/realworld.db"
    click Build "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/build"
    click Build "https://github.com/gologic-ca/exemple-netcore8-ghcopilot/tree/master/.github/workflows"

    classDef client fill:#c9daf8,stroke:#000,stroke-width:2px;
    classDef api fill:#aqua,stroke:#000,stroke-width:2px;
    classDef domain fill:#f9e79f,stroke:#000,stroke-width:2px;
    classDef infra fill:#ffd699,stroke:#000,stroke-width:2px;
    classDef db fill:#b6d7a8,stroke:#000,stroke-width:2px;
    classDef build fill:#d5a6bd,stroke:#000,stroke-width:2px;
```
