# dasunmahesha/student_registration_system_api architecture

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

- Interactive diagram: https://gitdiagram.com/dasunmahesha/student_registration_system_api
- Repository: https://github.com/dasunmahesha/student_registration_system_api

## Overview

##### Project type and purpose
- This is a .NET Web API (“StudentRegApi”) that exposes endpoints for managing students (CRUD operations) and a sample weather‐forecast endpoint.
- It uses Entity Framework Core (see DB/ and Migrations/) for data persistence in a relational database and integrates with AWS S3 (Services/S3Service.cs) for object storage.

##### File structure
- Controllers/ – HTTP entry points: StudentController.cs (+ WeatherForecastController.cs).
- Services/ – Business‐logic and integration code: e.g. S3Service.cs.
- DB/ – Data‐access layer: StudentDb.cs (inherits DbContext).
- Migrations/ – EF Core schema migrations.
- Models/ – Domain entities: Student, Parent.
- Program.cs & Properties/launchSettings.json – hosting, configuration.
- appsettings.json(.Development) – environment settings (DB connection string, S3 credentials, etc.).

##### Missing README insights
- Although README.md is empty, the folder names and .csproj reveal that all logic resides server‐side—no separate frontend.
- Configuration files imply use of ASP.NET Core’s built‐in dependency injection, logging, and environment‐based settings.

a. Main components
- API Layer (ASP.NET Core Controller endpoints)
- Business Logic Layer (Service classes)
- Data Access Layer (Entity Framework Core DbContext + Migrations)
- Relational Database (e.g., SQL Server or PostgreSQL)
- External Object Store (AWS S3)
- Configuration Provider (appsettings.json, environment variables)
- Hosting/Runtime (Kestrel/IIS in Program.cs)
b. Relationships & interactions
- HTTP requests → Controllers (API Layer)
- Controllers inject and call Services
- Services use DbContext to query/update Database
- S3Service (in Services/) calls AWS S3 SDK to upload/download objects
- Configuration Provider supplies connection strings & AWS credentials to Program.cs, Services, DbContext
c. Architectural patterns & principles
- Layered architecture (Presentation / Business / Data)
- Dependency Injection (built‐in ASP.NET Core DI container)
- Repository/Unit of Work patterns via EF Core DbContext
- Configuration per environment (appsettings.json + appsettings.Development.json)
d. Key technologies
- ASP.NET Core (Program.cs hosting, Controllers)
- Entity Framework Core (DB/StudentDb.cs + Migrations)
- AWS SDK for .NET (S3Service.cs)
- JSON configuration (appsettings.json)

##### Important notes
- Middleware or hosting concerns (e.g., Kestrel, Program.cs) if relevant to deployment.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Client
    Client["API Consumer\n(Mobile/Web Client)"]:::external

    %% Hosting and Configuration
    subgraph "Hosting & Configuration"
        Program["Program.cs\n(Hosting/Routing)"]:::inProcess
        Csproj["StudentRegApi.csproj"]:::inProcess
        ConfigApp["appsettings.json"]:::config
        ConfigDev["appsettings.Development.json"]:::config
        LaunchSettings["Properties/launchSettings.json"]:::config
    end

    %% API Layer
    subgraph "API Layer"
        SC["StudentController"]:::inProcess
        WC["WeatherForecastController"]:::inProcess
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        S3["S3Service"]:::inProcess
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        DbContext["StudentDbContext"]:::inProcess
        subgraph "EF Core Migrations"
            M1["20231208045234_Initial.Designer.cs"]:::inProcess
            M2["20231208045234_Initial.cs"]:::inProcess
            M3["StudentDbModelSnapshot.cs"]:::inProcess
        end
    end

    %% Domain Models
    subgraph "Domain Models"
        Student["Student"]:::inProcess
        Parent["Parent"]:::inProcess
    end

    %% External Services
    Database[(Relational Database)]:::db
    S3Cloud[/"AWS S3"/]:::cloud

    %% Connections
    Client -->|HTTP Request| SC
    Client -->|HTTP Request| WC

    Program -->|uses| SC
    Program -->|uses| WC
    Program -->|configures DI| S3
    Program -->|configures DI| DbContext

    ConfigApp -->|provides settings| Program
    ConfigDev -->|provides settings| Program
    LaunchSettings -->|provides environment| Program

    SC -->|calls| S3
    SC -->|calls| DbContext
    WC -->|calls| DbContext

    S3 -->|uses SDK| S3Cloud
    S3 -->|reads settings| ConfigApp
    S3 -->|reads settings| ConfigDev

    DbContext -->|queries| Database
    DbContext -->|reads settings| ConfigApp
    DbContext -->|reads settings| ConfigDev

    Student -->|mapped in| DbContext
    Parent -->|mapped in| DbContext

    %% Click Events
    click SC "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Controllers/StudentController.cs"
    click WC "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Controllers/WeatherForecastController.cs"
    click S3 "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Services/S3Service.cs"
    click DbContext "https://github.com/dasunmahesha/student_registration_system_api/blob/main/DB/StudentDb.cs"
    click M1 "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Migrations/20231208045234_Initial.Designer.cs"
    click M2 "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Migrations/20231208045234_Initial.cs"
    click M3 "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Migrations/StudentDbModelSnapshot.cs"
    click Student "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Models/Student.cs"
    click Parent "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Models/Parent.cs"
    click ConfigApp "https://github.com/dasunmahesha/student_registration_system_api/blob/main/appsettings.json"
    click ConfigDev "https://github.com/dasunmahesha/student_registration_system_api/blob/main/appsettings.Development.json"
    click LaunchSettings "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Properties/launchSettings.json"
    click Program "https://github.com/dasunmahesha/student_registration_system_api/blob/main/Program.cs"
    click Csproj "https://github.com/dasunmahesha/student_registration_system_api/blob/main/StudentRegApi.csproj"

    %% Styles
    classDef inProcess fill:#ADD8E6,stroke:#000,color:#000
    classDef db fill:#9f6,stroke:#000,color:#000
    classDef cloud fill:#CEF6EF,stroke:#000,color:#000
    classDef config fill:#F2F5A9,stroke:#000,color:#000
    classDef external fill:#FFD2D2,stroke:#000,color:#000
```
