# mattiasaan/grademate architecture

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

- Interactive diagram: https://gitdiagram.com/mattiasaan/grademate
- Repository: https://github.com/mattiasaan/grademate

## Overview

##### Project type and purpose
- This is a React Native mobile application (built with Expo/EAS) named GRADEMATE.
- Its primary purpose is to let students record grades, compute averages (using Galileo Galilei school rules), and display subject details on a mobile device.

##### File structure
- Top-level files and folders:
- App.js & index.js – application entry points
- Screens/ – UI components for each screen (WelcomePage, HomeScreen, AggiungiVoti, DettagliMateria)
- app.json & eas.json – Expo configuration & build settings
- package.json & package-lock.json – dependency definitions
- No dedicated backend folder: all data storage and business logic live in the mobile client, likely using local storage (AsyncStorage or SQLite).

##### Extract insights from the README
- Sole focus on local grade management and average calculation
- No external APIs or backend services mentioned
- Core feature: grade entry and average computation

##### Main components
a. Mobile Client – React Native application
- UI Layer: Screens folder (WelcomePage, HomeScreen, AggiungiVoti, DettagliMateria)
- Business Logic Layer: functions in App.js (grade aggregation, average formulas)
- Data Layer: local storage module (e.g., AsyncStorage or SQLite abstraction)
b. Development & Build Pipeline
- Code repository (Git)
- Local development (Metro bundler)
- Expo Application Services (EAS Build) for iOS/Android binary generation
c. External Services (optional)
- If in future you integrate a cloud backup or authentication, these would sit outside the mobile client

##### Relationships and interactions
- UI → Business Logic: user taps “Add Grade,” UI calls logic functions in App.js
- Business Logic ↔ Data Layer: logic reads/writes grades to AsyncStorage or SQLite
- Development Workflow:
- Developer machine pushes code to Git
- EAS Build pulls from Git, runs build pipeline → generates mobile binaries
- Metro serves JS bundle to running simulator/device

##### Architectural patterns & design principles
- Component-based architecture (one React component per screen)
- Layered separation: UI layer vs. business logic vs. data storage
- Single codebase for both Android and iOS via React Native / Expo
- Configuration-as-code for build (eas.json, app.json)

- Arrowheads showing data-flow direction (user action → function call → storage)
- Annotations for technology choices (React Native, Expo, EAS)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Client Modules
    subgraph "Mobile Client"
        direction TB
        subgraph "Entry Points"
            direction TB
            AppJS["App.js"]:::logic
            IndexJS["index.js"]:::logic
        end
        subgraph "UI Layer"
            direction TB
            WP["WelcomePage Screen"]:::ui
            HS["HomeScreen"]:::ui
            AV["AggiungiVoti Screen"]:::ui
            DM["DettagliMateria Screen"]:::ui
        end
        subgraph "Logic Layer"
            direction TB
            GC["GradeCalculator Module"]:::logic
        end
        subgraph "Data Layer"
            direction TB
            LS["LocalStorage (AsyncStorage/SQLite)"]:::data
        end
    end

    %% Build & Deployment Pipeline
    subgraph "Build & Deployment"
        direction TB
        Git["Git Repository"]:::deployment
        Metro["Metro Bundler"]:::deployment
        EAS["EAS Build (Expo)"]:::deployment
        MobileApp["Mobile Binary (iOS/Android)"]:::deployment
        AppJSON["app.json"]:::deployment
        EASJSON["eas.json"]:::deployment
        PackageJSON["package.json"]:::deployment
        PackageLock["package-lock.json"]:::deployment
        Assets["assets/"]:::deployment
    end

    %% Data & Control Flows
    WP -->|"calls"| GC
    HS -->|"calls"| GC
    AV -->|"calls"| GC
    DM -->|"calls"| GC
    GC -->|"writes/reads"| LS
    LS -->|"provides data to"| GC

    %% Deployment Flows
    Git -->|push code| EAS
    Git -->|start dev server| Metro
    EAS -->|produces| MobileApp
    Metro -->|serves bundle to| MobileApp

    %% Click Events
    click AppJS "https://github.com/mattiasaan/grademate/blob/main/App.js"
    click IndexJS "https://github.com/mattiasaan/grademate/blob/main/index.js"
    click WP "https://github.com/mattiasaan/grademate/blob/main/Screens/WelcomePage.js"
    click HS "https://github.com/mattiasaan/grademate/blob/main/Screens/HomeScreen.js"
    click AV "https://github.com/mattiasaan/grademate/blob/main/Screens/AggiungiVoti.js"
    click DM "https://github.com/mattiasaan/grademate/blob/main/Screens/DettagliMateria.js"
    click GC "https://github.com/mattiasaan/grademate/blob/main/App.js"
    click LS "https://github.com/mattiasaan/grademate/blob/main/App.js"
    click AppJSON "https://github.com/mattiasaan/grademate/blob/main/app.json"
    click EASJSON "https://github.com/mattiasaan/grademate/blob/main/eas.json"
    click PackageJSON "https://github.com/mattiasaan/grademate/blob/main/package.json"
    click PackageLock "https://github.com/mattiasaan/grademate/blob/main/package-lock.json"
    click Assets "https://github.com/mattiasaan/grademate/tree/main/assets/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#026AA7,color:#026AA7;
    classDef logic fill:#D5F5E3,stroke:#27AE60,color:#145A32;
    classDef data fill:#FEF5E7,stroke:#F39C12,color:#7E5109;
    classDef deployment fill:#E5E7E9,stroke:#ABB2B9,color:#566573;
```
