# karthick-216/forge---gpt architecture

> Architecture diagram of the GitHub repository karthick-216/forge---gpt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karthick-216/forge---gpt
- Repository: https://github.com/karthick-216/forge---gpt

## Overview

#### Purpose and Entry Points
This is a Python fitness/progression application with a Kivy-style screen/UI structure, covering onboarding, dashboard tracking, and training. The application starts in `main.py`; primary UI routes are implemented in `screens/splash.py`, `screens/onboarding.py`, `screens/dashboard.py`, and `screens/train.py`, with declarative layouts under `kv/`.

#### UI and Navigation Layer
Screen modules own presentation and user interactions, while `.kv` files define the corresponding visual structure. Splash and onboarding likely establish initial user state before routing to the dashboard; training is a dedicated workflow.
- `screens/splash.py`
- `screens/onboarding.py`
- `screens/dashboard.py`
- `screens/train.py`
- `kv/splash.kv`
- `kv/onboarding.kv`
- `kv/dashboard.kv`
- `kv/train.kv`

#### Domain Models and Persistent State
The model layer is intentionally small: profile data is the central explicit domain model, backed by shared model foundations. Service modules use a storage/cache boundary rather than screens directly managing persisted data. Runtime-generated user data, logs, and progress are kept under `data/`.
- `models/base.py`
- `models/profile.py`
- `logic/storage.py`
- `logic/cache.py`
- `data/progress`
- `data/logs`

#### Fitness Planning and Training Execution
Workout and plan generation form the core training pipeline. The exercise library supplies candidate exercises; generators construct plans/workouts; the workout service coordinates active workout behavior. Validation is a boundary for checking generated or submitted fitness data.
- `logic/exercise_library.py`
- `logic/plan_generator.py`
- `logic/workout_generator.py`
- `logic/workout_service.py`
- `logic/validator.py`

#### Progression and Gamification
Progress is translated into user-facing advancement through XP, levels, streaks, quests, achievements, and game mechanics. These services should remain domain-level and be invoked from workflow/UI orchestration rather than coupled to Kivy widgets.
- `logic/progress_service.py`
- `logic/xp_service.py`
- `logic/level_service.py`
- `logic/streak_service.py`
- `logic/quest_service.py`
- `logic/achievement_service.py`
- `logic/game_engine.py`

#### Health Tracking and Analytics
Profile, weight, BMI, nutrition, sleep, and statistics services represent health inputs and derived metrics. Analytics aggregates this information for dashboard presentation and coaching; the AI coach is a separate recommendation boundary whose provider/runtime is not identifiable from the repository tree.
- `logic/profile_service.py`
- `logic/weight_service.py`
- `logic/bmi_service.py`
- `logic/nutrition_service.py`
- `logic/sleep_service.py`
- `logic/stat_service.py`
- `logic/analytics_service.py`
- `logic/ai_coach.py`

#### Cross-Cutting Runtime Services
An event bus and scheduler support decoupled coordination and timed work such as daily resets and notifications. Import/export, backup, and sync define data portability and remote-integration boundaries; no specific external API, database, or cloud provider is evidenced. Settings and themes provide application-wide user preferences.
- `logic/event_bus.py`
- `logic/scheduler.py`
- `logic/daily_reset_service.py`
- `logic/notification_service.py`
- `logic/import_service.py`
- `logic/export_service.py`
- `logic/backup_service.py`
- `logic/sync_service.py`
- `logic/settings_service.py`
- `logic/theme_service.py`

Main entry points: [`logic/storage.py`](https://github.com/karthick-216/forge---gpt/blob/main/logic/storage.py) (Storage & cache), [`logic/workout_service.py`](https://github.com/karthick-216/forge---gpt/blob/main/logic/workout_service.py) (Workout service), [`screens/dashboard.py`](https://github.com/karthick-216/forge---gpt/blob/main/screens/dashboard.py) (Dashboard screen), [`logic/progress_service.py`](https://github.com/karthick-216/forge---gpt/blob/main/logic/progress_service.py) (Progress service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI &amp; Navigation"]
  node_app["Application entry<br/>Python app<br/>[main.py]"]
  node_splash["Splash screen<br/>[splash.py]"]
  node_onboarding["Onboarding screen<br/>[onboarding.py]"]
  node_dashboard["Dashboard screen<br/>[dashboard.py]"]
  node_training_screen["Training screen<br/>[train.py]"]
end

subgraph group_state["State &amp; Persistence"]
  node_profile_model["Profile model<br/>domain model<br/>[profile.py]"]
  node_model_base["Model foundations<br/>model base<br/>[base.py]"]
  node_storage[("Storage &amp; cache<br/>persistence boundary<br/>[storage.py]")]
  node_user_data[("User data<br/>runtime data")]
end

subgraph group_training["Training Pipeline"]
  node_exercise_library["Exercise library<br/>exercise source"]
  node_generators["Plan &amp; workout generators<br/>generation layer<br/>[plan_generator.py]"]
  node_workout_service["Workout service<br/>workflow service<br/>[workout_service.py]"]
  node_validator["Fitness validator<br/>validation service<br/>[validator.py]"]
end

subgraph group_progression["Progression"]
  node_progress_service["Progress service<br/>progress workflow"]
  node_game_mechanics{{"Game mechanics<br/>gamification services<br/>[game_engine.py]"}}
end

subgraph group_health["Health &amp; Analytics"]
  node_profile_service["Profile service<br/>health service<br/>[profile_service.py]"]
  node_health_metrics["Health inputs &amp; metrics<br/>health services<br/>[weight_service.py]"]
  node_analytics["Analytics service<br/>aggregation service"]
  node_ai_coach{{"AI coach<br/>recommendation boundary<br/>[ai_coach.py]"}}
end

subgraph group_runtime["Runtime Services"]
  node_events["Event bus &amp; scheduler<br/>runtime coordination<br/>[event_bus.py]"]
  node_daily_operations["Daily operations<br/>scheduled services"]
  node_portability["Portability &amp; sync<br/>integration boundary<br/>[import_service.py]"]
  node_preferences["Settings &amp; themes<br/>preference services"]
end

node_app -->|"starts"| node_splash
node_splash -->|"new user flow"| node_onboarding
node_splash -->|"returning user"| node_dashboard
node_onboarding -->|"creates profile"| node_profile_service
node_onboarding -->|"completes"| node_dashboard
node_dashboard -->|"starts training"| node_training_screen
node_dashboard -->|"shows insights"| node_analytics
node_dashboard -.->|"applies preferences"| node_preferences
node_training_screen -->|"drives workout"| node_workout_service
node_workout_service -->|"requests workout"| node_generators
node_generators -->|"selects exercises"| node_exercise_library
node_workout_service -->|"validates activity"| node_validator
node_workout_service -->|"records completion"| node_progress_service
node_progress_service -->|"awards advancement"| node_game_mechanics
node_profile_service -->|"manages"| node_profile_model
node_profile_model -->|"extends"| node_model_base
node_profile_service -->|"persists"| node_storage
node_health_metrics -->|"persists inputs"| node_storage
node_progress_service -->|"persists progress"| node_storage
node_storage -->|"reads and writes"| node_user_data
node_analytics -->|"aggregates"| node_health_metrics
node_analytics -->|"uses progress"| node_progress_service
node_ai_coach -->|"uses insights"| node_analytics
node_events -->|"schedules"| node_daily_operations
node_daily_operations -->|"runs resets"| node_progress_service
node_portability -->|"moves data"| node_storage
node_preferences -->|"persists"| node_storage
node_workout_service -.->|"publishes updates"| node_events

click node_app "https://github.com/karthick-216/forge---gpt/blob/main/main.py"
click node_splash "https://github.com/karthick-216/forge---gpt/blob/main/screens/splash.py"
click node_onboarding "https://github.com/karthick-216/forge---gpt/blob/main/screens/onboarding.py"
click node_dashboard "https://github.com/karthick-216/forge---gpt/blob/main/screens/dashboard.py"
click node_training_screen "https://github.com/karthick-216/forge---gpt/blob/main/screens/train.py"
click node_profile_model "https://github.com/karthick-216/forge---gpt/blob/main/models/profile.py"
click node_model_base "https://github.com/karthick-216/forge---gpt/blob/main/models/base.py"
click node_storage "https://github.com/karthick-216/forge---gpt/blob/main/logic/storage.py"
click node_user_data "https://github.com/karthick-216/forge---gpt/tree/main/data/progress"
click node_exercise_library "https://github.com/karthick-216/forge---gpt/blob/main/logic/exercise_library.py"
click node_generators "https://github.com/karthick-216/forge---gpt/blob/main/logic/plan_generator.py"
click node_workout_service "https://github.com/karthick-216/forge---gpt/blob/main/logic/workout_service.py"
click node_validator "https://github.com/karthick-216/forge---gpt/blob/main/logic/validator.py"
click node_progress_service "https://github.com/karthick-216/forge---gpt/blob/main/logic/progress_service.py"
click node_game_mechanics "https://github.com/karthick-216/forge---gpt/blob/main/logic/game_engine.py"
click node_profile_service "https://github.com/karthick-216/forge---gpt/blob/main/logic/profile_service.py"
click node_health_metrics "https://github.com/karthick-216/forge---gpt/blob/main/logic/weight_service.py"
click node_analytics "https://github.com/karthick-216/forge---gpt/blob/main/logic/analytics_service.py"
click node_ai_coach "https://github.com/karthick-216/forge---gpt/blob/main/logic/ai_coach.py"
click node_events "https://github.com/karthick-216/forge---gpt/blob/main/logic/event_bus.py"
click node_daily_operations "https://github.com/karthick-216/forge---gpt/blob/main/logic/daily_reset_service.py"
click node_portability "https://github.com/karthick-216/forge---gpt/blob/main/logic/import_service.py"
click node_preferences "https://github.com/karthick-216/forge---gpt/blob/main/logic/settings_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_splash,node_onboarding,node_dashboard,node_training_screen toneBlue
class node_profile_model,node_model_base,node_storage,node_user_data toneAmber
class node_exercise_library,node_generators,node_workout_service,node_validator toneMint
class node_progress_service,node_game_mechanics toneRose
class node_profile_service,node_health_metrics,node_analytics,node_ai_coach toneIndigo
class node_events,node_daily_operations,node_portability,node_preferences toneTeal
```

## Components

### UI & Navigation

- [Application entry](https://github.com/karthick-216/forge---gpt/blob/main/main.py): Python app · `main.py`
- [Splash screen](https://github.com/karthick-216/forge---gpt/blob/main/screens/splash.py): screen · `screens/splash.py`
- [Onboarding screen](https://github.com/karthick-216/forge---gpt/blob/main/screens/onboarding.py): screen · `screens/onboarding.py`
- [Dashboard screen](https://github.com/karthick-216/forge---gpt/blob/main/screens/dashboard.py): screen · `screens/dashboard.py`
- [Training screen](https://github.com/karthick-216/forge---gpt/blob/main/screens/train.py): screen · `screens/train.py`

### State & Persistence

- [Profile model](https://github.com/karthick-216/forge---gpt/blob/main/models/profile.py): domain model · `models/profile.py`
- [Model foundations](https://github.com/karthick-216/forge---gpt/blob/main/models/base.py): model base · `models/base.py`
- [Storage & cache](https://github.com/karthick-216/forge---gpt/blob/main/logic/storage.py): persistence boundary · Services persist shared application state through this boundary. · `logic/storage.py`
- [User data](https://github.com/karthick-216/forge---gpt/tree/main/data/progress): runtime data · Generated progress and logs are stored locally. · `data/progress`

### Training Pipeline

- [Exercise library](https://github.com/karthick-216/forge---gpt/blob/main/logic/exercise_library.py): exercise source · `logic/exercise_library.py`
- [Plan & workout generators](https://github.com/karthick-216/forge---gpt/blob/main/logic/plan_generator.py): generation layer · Builds plans and workouts from available exercises. · `logic/plan_generator.py`
- [Workout service](https://github.com/karthick-216/forge---gpt/blob/main/logic/workout_service.py): workflow service · Coordinates the active training workflow. · `logic/workout_service.py`
- [Fitness validator](https://github.com/karthick-216/forge---gpt/blob/main/logic/validator.py): validation service · `logic/validator.py`

### Progression

- [Progress service](https://github.com/karthick-216/forge---gpt/blob/main/logic/progress_service.py): progress workflow · `logic/progress_service.py`
- [Game mechanics](https://github.com/karthick-216/forge---gpt/blob/main/logic/game_engine.py): gamification services · XP, levels, streaks, quests, and achievements translate progress into advancement. · `logic/game_engine.py`

### Health & Analytics

- [Profile service](https://github.com/karthick-216/forge---gpt/blob/main/logic/profile_service.py): health service · `logic/profile_service.py`
- [Health inputs & metrics](https://github.com/karthick-216/forge---gpt/blob/main/logic/weight_service.py): health services · Weight, BMI, nutrition, sleep, and statistics services manage health signals. · `logic/weight_service.py`
- [Analytics service](https://github.com/karthick-216/forge---gpt/blob/main/logic/analytics_service.py): aggregation service · Aggregates health and progress for dashboard insight. · `logic/analytics_service.py`
- [AI coach](https://github.com/karthick-216/forge---gpt/blob/main/logic/ai_coach.py): recommendation boundary · Provider implementation is not identified. · `logic/ai_coach.py`

### Runtime Services

- [Event bus & scheduler](https://github.com/karthick-216/forge---gpt/blob/main/logic/event_bus.py): runtime coordination · Decouples workflows and schedules timed work. · `logic/event_bus.py`
- [Daily operations](https://github.com/karthick-216/forge---gpt/blob/main/logic/daily_reset_service.py): scheduled services · Daily resets and notifications run through runtime coordination. · `logic/daily_reset_service.py`
- [Portability & sync](https://github.com/karthick-216/forge---gpt/blob/main/logic/import_service.py): integration boundary · Import, export, backup, and sync manage data movement. · `logic/import_service.py`
- [Settings & themes](https://github.com/karthick-216/forge---gpt/blob/main/logic/settings_service.py): preference services · `logic/settings_service.py`

## Connections

- Application entry → Splash screen: starts
- Splash screen → Onboarding screen: new user flow
- Splash screen → Dashboard screen: returning user
- Onboarding screen → Profile service: creates profile
- Onboarding screen → Dashboard screen: completes
- Dashboard screen → Training screen: starts training
- Dashboard screen → Analytics service: shows insights
- Dashboard screen → Settings & themes: applies preferences
- Training screen → Workout service: drives workout
- Workout service → Plan & workout generators: requests workout
- Plan & workout generators → Exercise library: selects exercises
- Workout service → Fitness validator: validates activity
- Workout service → Progress service: records completion
- Progress service → Game mechanics: awards advancement
- Profile service → Profile model: manages
- Profile model → Model foundations: extends
- Profile service → Storage & cache: persists
- Health inputs & metrics → Storage & cache: persists inputs
- Progress service → Storage & cache: persists progress
- Storage & cache → User data: reads and writes
- Analytics service → Health inputs & metrics: aggregates
- Analytics service → Progress service: uses progress
- AI coach → Analytics service: uses insights
- Event bus & scheduler → Daily operations: schedules
- Daily operations → Progress service: runs resets
- Portability & sync → Storage & cache: moves data
- Settings & themes → Storage & cache: persists
- Workout service → Event bus & scheduler: publishes updates
