# andrewboldi/amc-trainer architecture

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

- Interactive diagram: https://gitdiagram.com/andrewboldi/amc-trainer
- Repository: https://github.com/andrewboldi/amc-trainer

## Overview

##### Main Components Identification
The system consists of three major components:

a. Web Application
- Frontend static website (root directory)
- HTML, CSS, and JavaScript files
- Problem generation interface

b. Mobile Applications
- Android app (amc-mobile-app/android)
- iOS app (amc-mobile-app/ios)
- Built using Capacitor/Cordova framework

c. Flutter Application
- Cross-platform mobile app (amc_flutter)
- Separate implementation using Flutter framework

- Client Layer                                          |

- Web Client  |  |    Android App     |  |      iOS App      |  |  Flutter App     | |
- (HTML/JS/CSS)|  | (Capacitor/Cordova)|  |(Capacitor/Cordova)|  |(Cross-platform)  | |

- v

- Core Logic Layer                                      |

- Problem Generator   |  |    Topic Classifier    |  |    User Progress Track |       |

- v

- Data Layer                                            |

- Problem Database   |  |    User Data Store     |  |    Analytics Storage  |       |

##### Component Relationships

- User interaction flows
- Data flow between components
- API calls and responses
- State management paths

##### Additional Elements

a. Infrastructure Components:
- Static file hosting
- Mobile app distribution
- API endpoints

b. Cross-cutting Concerns:
- Authentication
- Error handling
- Caching
- Analytics

##### Implementation Details

- Shared code between platforms
- Platform-specific implementations
- Build and deployment processes
- State management approach

- Export to common formats
- Collaboration features

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        WebClient["Web Client\n(HTML/JS/CSS)"]
        AndroidApp["Android App\n(Capacitor/Cordova)"]
        iOSApp["iOS App\n(Capacitor/Cordova)"]
        FlutterApp["Flutter App\n(Cross-platform)"]
    end

    %% Core Logic Layer
    subgraph CoreLayer["Core Logic Layer"]
        ProblemGen["Problem Generator"]
        TopicClass["Topic Classifier"]
        UserTrack["User Progress Track"]
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        ProblemDB[(Problem Database)]
        UserStore[(User Data Store)]
        Analytics[(Analytics Storage)]
    end

    %% Infrastructure Components
    subgraph Infrastructure["Infrastructure"]
        StaticHost["Static File Hosting"]
        AppDist["App Distribution"]
        APIEndpoints["API Endpoints"]
    end

    %% Cross-cutting Concerns
    subgraph CrossCutting["Cross-cutting Concerns"]
        Auth["Authentication"]
        ErrorHandle["Error Handling"]
        Cache["Caching"]
        AnalyticsEngine["Analytics"]
    end

    %% Relationships
    WebClient --> ProblemGen
    AndroidApp --> ProblemGen
    iOSApp --> ProblemGen
    FlutterApp --> ProblemGen

    ProblemGen --> ProblemDB
    TopicClass --> ProblemDB
    UserTrack --> UserStore
    
    ClientLayer --> Auth
    Auth --> APIEndpoints
    APIEndpoints --> CoreLayer
    CoreLayer --> DataLayer
    
    %% Click Events
    click WebClient "https://github.com/andrewboldi/AMC-Trainer/blob/main//index.html"
    click AndroidApp "https://github.com/andrewboldi/AMC-Trainer/tree/main//amc-mobile-app/android"
    click iOSApp "https://github.com/andrewboldi/AMC-Trainer/tree/main//amc-mobile-app/ios"
    click FlutterApp "https://github.com/andrewboldi/AMC-Trainer/tree/main//amc_flutter"
    
    %% Styling
    classDef client fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef data fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef infra fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef cross fill:#FFB6C1,stroke:#333,stroke-width:2px

    class WebClient,AndroidApp,iOSApp,FlutterApp client
    class ProblemGen,TopicClass,UserTrack core
    class ProblemDB,UserStore,Analytics data
    class StaticHost,AppDist,APIEndpoints infra
    class Auth,ErrorHandle,Cache,AnalyticsEngine cross

    %% Legend
    subgraph Legend["Legend"]
        Client["Client Component"]:::client
        Core["Core Logic"]:::core
        Data["Data Storage"]:::data
        Infra["Infrastructure"]:::infra
        Cross["Cross-cutting"]:::cross
    end
```
