# markfdez/gym_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/markfdez/gym_tracker
- Repository: https://github.com/markfdez/gym_tracker

## Overview

##### Project type and purpose
- This is a cross-platform Flutter application (“gym_tracker”) that runs on Android, iOS, Linux, macOS, Windows and web.
- Purpose: let users register/login, create and view workout routines, log sessions, track progress. Data is persisted in Firebase.

##### File structure
- Top-level platform folders: android/, ios/, linux/, macos/, windows/, web/. These contain the native shell projects generated by Flutter.
- Core application code is in lib/:
- lib/main.dart – entry point
- lib/models/ – domain models (UserProfile, WorkoutRoutine, WorkoutSession, ExerciseProgress)
- lib/providers/ – state-management (AuthProvider)
- lib/service/firebase_service.dart – data layer to Firebase Auth/Firestore
- lib/screens/ – UI screens (auth, home, routines, sessions, profile)
- lib/widgets/ – reusable UI widgets organized by feature
- lib/theme/ & lib/utils/ – theming & utility helpers
- Tests mirror the structure under test/: models, services, widgets, with mocks in test/mocks.

##### README
- It is the default Flutter starter README with no custom architecture description.
- We infer architecture from the code layout and presence of Firebase config files (android/app/google-services.json, iOS Config).

##### Elements
- UI → Providers (“state requests & events”)
- Providers → FirebaseService (“API calls”)
- FirebaseService → Firebase (“REST/Websocket”)
- Firebase → FirebaseService (“data response”)
- FirebaseService → Providers → UI (“state updates”)
- UI (blue), state management (green), data layer (orange), external services (purple)

##### Detailed capturing of essential elements
- Models: UserProfile, WorkoutRoutine, WorkoutSession flowing between Service and Providers

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Platforms"
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        Linux["Linux"]:::platform
        macOS["macOS"]:::platform
        Windows["Windows"]:::platform
        Web["Web"]:::platform
        Android --> GoogleConfig["android/app/google-services.json"]:::platform
    end

    subgraph "Client App"
        AuthGate["AuthGate Widget"]:::ui
        UI_Screens["Screens"]:::ui
        UI_Widgets["Widgets"]:::ui
        Providers["State Management\n(AuthProvider)"]:::state
        DomainModels["Domain Models"]:::model
        Service["FirebaseService"]:::data
    end

    subgraph "Cloud Backend"
        Auth["Firebase Auth"]:::backend
        Firestore["Firestore DB"]:::backend
    end

    %% Data Flows
    Android -->|"hosts"| UI_Screens
    iOS -->|"hosts"| UI_Screens
    Linux -->|"hosts"| UI_Screens
    macOS -->|"hosts"| UI_Screens
    Windows -->|"hosts"| UI_Screens
    Web -->|"hosts"| UI_Screens

    AuthGate -->|"guards access to"| UI_Screens
    UI_Screens -->|"user events & state requests"| Providers
    UI_Widgets -->|"user events & state requests"| Providers

    Providers -->|"calls API"| Service
    Service -->|"REST/Websocket"| Auth
    Service -->|"REST/Websocket"| Firestore
    Auth -->|"auth responses"| Service
    Firestore -->|"data responses"| Service
    Service -->|"state updates"| Providers
    Providers -->|"state updates"| UI_Screens
    Providers -->|"state updates"| UI_Widgets

    %% Domain Models usage
    Providers -->|"uses"| DomainModels
    Service -->|"maps to/from"| DomainModels

    %% Click Events
    click UI_Screens "https://github.com/markfdez/gym_tracker/tree/master/lib/screens/"
    click UI_Widgets "https://github.com/markfdez/gym_tracker/tree/master/lib/widgets/"
    click AuthGate "https://github.com/markfdez/gym_tracker/blob/master/lib/screens/auth/auth_gate.dart"
    click Providers "https://github.com/markfdez/gym_tracker/blob/master/lib/providers/auth_provider.dart"
    click Service "https://github.com/markfdez/gym_tracker/blob/master/lib/service/firebase_service.dart"
    click DomainModels "https://github.com/markfdez/gym_tracker/tree/master/lib/models/"
    click Android "https://github.com/markfdez/gym_tracker/tree/master/android/"
    click iOS "https://github.com/markfdez/gym_tracker/tree/master/ios/"
    click Linux "https://github.com/markfdez/gym_tracker/tree/master/linux/"
    click macOS "https://github.com/markfdez/gym_tracker/tree/master/macos/"
    click Windows "https://github.com/markfdez/gym_tracker/tree/master/windows/"
    click Web "https://github.com/markfdez/gym_tracker/tree/master/web/"
    click GoogleConfig "https://github.com/markfdez/gym_tracker/blob/master/android/app/google-services.json"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef state fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef backend fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef platform fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef model fill:#F0E68C,stroke:#333,stroke-width:1px
```
