# mvoggu/cms2 architecture

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

- Interactive diagram: https://gitdiagram.com/mvoggu/cms2
- Repository: https://github.com/mvoggu/cms2

## Overview

##### Main Components Identification

a) Client Layer (Mobile Applications)
- iOS Application
- Android Application
- Flutter Framework (Cross-platform layer)

b) Application Layer
- Screens/UI Components
- Models
- Services
- Navigation/Routing

c) External Systems
- Moodle Integration (indicated by moodle_client.dart)

##### Component Organization

a) Mobile Clients (Top Layer)
- Both iOS and Android platforms connected to the Flutter framework

b) Flutter Framework Layer
- Main application structure:
- Screens Module (courses, login, sections)
- Models Module (course, user)
- Services Module (moodle_client)
- Routes Module

c) External Services Layer
- Moodle LMS Server
- Any API endpoints or services

##### Specific Implementation Details

Architectural patterns and relationships:

a) UI Flow
- Login Screen → Courses Screen → Sections Screen

b) Data Flow
- How the MoodleClient service interacts with:
- External Moodle server
- Local models (Course and User)
- UI components

##### Key Relationships to Highlight

- Flutter Framework → Native Platforms
- Screens → Services
- Services → External Moodle System
- Models ↔ Services
- Routes → Screens

**┌─ Client Layer ─────────────────────┐**
- iOS App         Android App       │
- ↘           ↙                │
- Flutter Framework              │
- Application Layer ─────────────────┤
- ┌─ Screens ─┐  ┌─ Services ─┐     │
- Login   │  │ - Moodle   │     │
- Courses │  └───────────┘      │
- Sections│  ┌─ Models ──┐      │
- ┘  │ - Course   │      │
- User     │      │
- ┘      │
- External Layer ──────────────────┤
- Moodle LMS Server          │
- ┘

##### Documentation Notes

- Component relationships
- Any abbreviations used

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Client Layer"
        iOS["iOS Application"]
        Android["Android Application"]
        Flutter["Flutter Framework"]
        iOS --> Flutter
        Android --> Flutter
    end

    subgraph "Application Layer"
        direction TB
        Main["Main Application"]
        
        subgraph "Screens"
            direction TB
            Login["Login Screen"]
            Courses["Courses Screen"]
            Sections["Sections Screen"]
            Login --> Courses
            Courses --> Sections
        end

        subgraph "Models"
            direction TB
            CourseModel["Course Model"]
            UserModel["User Model"]
        end

        subgraph "Services"
            MoodleClient["Moodle Client"]
        end

        Router["Navigation Router"]
        
        Main --> Router
        Router --> Login
        Router --> Courses
        Router --> Sections
    end

    subgraph "External Layer"
        MoodleLMS["Moodle LMS Server"]
    end

    %% Service Interactions
    MoodleClient <--> MoodleLMS
    MoodleClient --> CourseModel
    MoodleClient --> UserModel

    %% Component Interactions
    Flutter --> Main
    Login --> MoodleClient
    Courses --> MoodleClient
    Sections --> MoodleClient

    %% Styling
    classDef client fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef screens fill:#ffcca8,stroke:#333,stroke-width:2px
    classDef models fill:#a8ffb3,stroke:#333,stroke-width:2px
    classDef services fill:#ffa8a8,stroke:#333,stroke-width:2px
    classDef external fill:#e6e6e6,stroke:#333,stroke-width:2px
    classDef router fill:#d9a8ff,stroke:#333,stroke-width:2px

    class iOS,Android,Flutter client
    class Login,Courses,Sections screens
    class CourseModel,UserModel models
    class MoodleClient services
    class MoodleLMS external
    class Router,Main router

    %% Click Events
    click iOS "https://github.com/mvoggu/cms2/tree/master/ios/Runner"
    click Android "https://github.com/mvoggu/cms2/tree/master/android/app"
    click Login "https://github.com/mvoggu/cms2/blob/master/lib/screens/login/login.dart"
    click Courses "https://github.com/mvoggu/cms2/blob/master/lib/screens/courses/courses.dart"
    click Sections "https://github.com/mvoggu/cms2/blob/master/lib/screens/sections/sections.dart"
    click CourseModel "https://github.com/mvoggu/cms2/blob/master/lib/models/course.dart"
    click UserModel "https://github.com/mvoggu/cms2/blob/master/lib/models/user.dart"
    click MoodleClient "https://github.com/mvoggu/cms2/blob/master/lib/services/moodle_client.dart"
    click Router "https://github.com/mvoggu/cms2/blob/master/lib/routes.dart"
    click Main "https://github.com/mvoggu/cms2/blob/master/lib/main.dart"
```
