# mhgffqwoer/educationalplatform architecture

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

- Interactive diagram: https://gitdiagram.com/mhgffqwoer/educationalplatform
- Repository: https://github.com/mhgffqwoer/educationalplatform

## Overview

##### Main Components
- Entrance Point – Represent the main package (cmd/main.go) that bootstraps the application.
- Domain Layer – Highlight the core entities that the system manages:
- Users: Based on the files in internal/User (UserBase, UserStudent, UserTeacher). Mark this component as handling user identification and author attribution.
- Subjects: Show a clear “Subject” group which includes:
- Base definition of a subject (internal/Subject/SubjectBase.go)
- Variants defined as ExamSubject and CreditSubject.
- Subject Components – further divided into Labwork and LectureMaterials (inside internal/Subject/Components). Note that each component carries its own specific attributes.
- Utility/Service Components:
- GeneratorID: Handles the generation of unique identifiers (internal/GeneratorID/GeneratorID.go). This is essential for creating and maintaining entity identity.
- Repository: Encapsulates storage and retrieval operations (internal/Repository/Repository.go), implementing a repository pattern to manage the lifetime and querying of the different entities.
- Testing – Although not part of the deployment architecture, mark tests as validating the above behaviors (tests/Subject_test.go and tests/User_test.go).

##### Relationships and Interactions
- Directional flows from the main execution (cmd/main.go) to various domain entity constructors.
- That whenever a new entity (user, subject, labwork, lecture material) is created, an ID is generated through the GeneratorID component.
- That the Repository component is used to store, search, and manage domain objects.
- That Users are authors of Subjects and their related components; this is a critical relationship in the design.

##### Architectural Patterns and Design Principles
- Mention that the project leverages generative patterns (as clarified in the README) to dynamically create or derive new labworks, programming materials, or subjects.

##### Recap
- Interaction with the ID Generator and Repository.
- Design principles (OOP, SOLID, GRASP) that justify the modular separation and dependency management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application/Core Domain Layer
    subgraph "Application/Core Domain Layer"
        MP["cmd/main.go"]:::entry

        subgraph "Users Module"
            UBase["UserBase"]:::domain
            UStudent["UserStudent"]:::domain
            UTeacher["UserTeacher"]:::domain
        end

        subgraph "Subjects Module"
            SBase["SubjectBase"]:::domain
            Exam["ExamSubject"]:::domain
            Credit["CreditSubject"]:::domain

            subgraph "Subject Components"
                Lab["Labwork Component"]:::domain
                Lecture["LectureMaterials Component"]:::domain
            end
        end
    end

    %% Infrastructure/Utility Layer
    subgraph "Infrastructure/Utility Layer"
        GenID["GeneratorID Utility"]:::utility
        Repo["Repository Service"]:::utility
    end

    %% Testing
    subgraph "Testing"
        TestSub["Subject Tests"]:::testing
        TestUser["User Tests"]:::testing
    end

    %% Relationships and Interactions

    %% Entry point creates domain entities
    MP -->|"creates"| UBase
    MP -->|"creates"| SBase

    %% Inheritance relationships within Users
    UBase -->|"is_base_for"| UStudent
    UBase -->|"is_base_for"| UTeacher

    %% Subject variants and composition
    SBase -->|"has_variant"| Exam
    SBase -->|"has_variant"| Credit
    SBase -->|"composed_of"| Lab
    SBase -->|"composed_of"| Lecture

    %% Interaction with Infrastructure components from main entry
    MP -->|"invokes"| GenID
    MP -->|"invokes"| Repo

    %% Persistence flows from domain entities to Repository
    UBase -->|"stored_in"| Repo
    UStudent -->|"stored_in"| Repo
    UTeacher -->|"stored_in"| Repo
    SBase -->|"stored_in"| Repo
    Exam -->|"stored_in"| Repo
    Credit -->|"stored_in"| Repo
    Lab -->|"stored_in"| Repo
    Lecture -->|"stored_in"| Repo

    %% ID Generation relationships
    GenID -->|"generates_ID_for"| UBase
    GenID -->|"generates_ID_for"| SBase

    %% Testing validations
    TestUser -->|"validates"| UBase
    TestUser -->|"validates"| UStudent
    TestUser -->|"validates"| UTeacher
    TestSub -->|"validates"| SBase
    TestSub -->|"validates"| Exam
    TestSub -->|"validates"| Credit
    TestSub -->|"validates"| Lab
    TestSub -->|"validates"| Lecture

    %% Click Events
    click MP "https://github.com/mhgffqwoer/educationalplatform/blob/main/cmd/main.go"
    click UBase "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/User/UserBase.go"
    click UStudent "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/User/UserStudent.go"
    click UTeacher "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/User/UserTeacher.go"
    click SBase "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Subject/SubjectBase.go"
    click Exam "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Subject/ExamSubject.go"
    click Credit "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Subject/CreditSubject.go"
    click Lab "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Subject/Components/Labwork.go"
    click Lecture "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Subject/Components/LectureMaterials.go"
    click GenID "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/GeneratorID/GeneratorID.go"
    click Repo "https://github.com/mhgffqwoer/educationalplatform/blob/main/internal/Repository/Repository.go"
    click TestSub "https://github.com/mhgffqwoer/educationalplatform/blob/main/tests/Subject_test.go"
    click TestUser "https://github.com/mhgffqwoer/educationalplatform/blob/main/tests/User_test.go"

    %% Styles
    classDef entry fill:#f9f,stroke:#333,stroke-width:2px;
    classDef domain fill:#ccf,stroke:#333,stroke-width:1px;
    classDef utility fill:#cfc,stroke:#333,stroke-width:1px;
    classDef testing fill:#ffc,stroke:#333,stroke-width:1px;
```
