# rmsddd/gym-weight-tracker-backend architecture

> Architecture diagram of the GitHub repository rmsddd/gym-weight-tracker-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rmsddd/gym-weight-tracker-backend
- Repository: https://github.com/rmsddd/gym-weight-tracker-backend

## Overview

This is a Laravel API for tracking workouts, exercise catalogs, sets, personal records, user avatars, and token-based authentication. The main workflow is a client request routed to an API controller, which validates and authorizes it, delegates domain operations to a service, and works with Eloquent models. The graph emphasizes those domain stages and model relationships. Several service/controller links are supported by the SOURCE INDEX; unsampled implementation details and response-resource links are omitted rather than inferred.

Main entry points: [`routes/api.php`](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/routes/api.php) (API routes), [`app/Models/WorkoutExercise.php`](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/WorkoutExercise.php) (Workout exercises), [`app/Models/Workout.php`](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Workout.php) (Workout records), [`app/Http/Controllers/Api/AuthController.php`](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/AuthController.php) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api_routes["API routes<br/>[api.php]"]
end

subgraph group_identity["Identity"]
  node_auth_controller["Authentication API<br/>[AuthController.php]"]
  node_auth_service["Token service<br/>[AuthService.php]"]
  node_user_model[("User account<br/>[User.php]")]
  node_avatar_controller["Avatar API"]
  node_user_service["User service<br/>[UserService.php]"]
end

subgraph group_catalog["Exercise catalog"]
  node_category_controller["Category API"]
  node_category_service["Category service"]
  node_category_model[("Category catalog<br/>[Category.php]")]
  node_exercise_controller["Exercise API"]
  node_exercise_service["Exercise service"]
  node_exercise_model[("Exercise catalog<br/>[Exercise.php]")]
end

subgraph group_training["Workout tracking"]
  node_workout_controller["Workout API"]
  node_workout_service["Workout service<br/>[WorkoutService.php]"]
  node_workout_model[("Workout records<br/>[Workout.php]")]
  node_workout_exercise_controller["Workout exercise API"]
  node_workout_exercise_service["Workout exercise service"]
  node_workout_exercise_model[("Workout exercises")]
  node_workout_set_controller["Workout set API"]
  node_workout_set_service["Workout set service"]
  node_workout_set_model[("Workout sets<br/>[WorkoutSet.php]")]
  node_record_controller["Personal record API"]
  node_record_service["Personal record service"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_api_routes
node_api_routes -->|"routes to"| node_auth_controller
node_api_routes -->|"routes to"| node_avatar_controller
node_api_routes -->|"routes to"| node_category_controller
node_api_routes -->|"routes to"| node_exercise_controller
node_api_routes -->|"routes to"| node_workout_controller
node_api_routes -->|"routes to"| node_workout_exercise_controller
node_api_routes -->|"routes to"| node_workout_set_controller
node_api_routes -->|"routes to"| node_record_controller
node_auth_controller -->|"requests tokens"| node_auth_service
node_auth_controller -->|"creates account"| node_user_model
node_auth_service -->|"issues tokens"| node_user_model
node_avatar_controller -->|"delegates"| node_user_service
node_category_controller -->|"delegates"| node_category_service
node_category_service -.->|"accesses catalog"| node_category_model
node_exercise_controller -->|"delegates"| node_exercise_service
node_exercise_service -->|"queries catalog"| node_exercise_model
node_workout_controller -->|"delegates"| node_workout_service
node_workout_service -->|"manages workouts"| node_workout_model
node_workout_exercise_controller -->|"delegates"| node_workout_exercise_service
node_workout_exercise_service -->|"uses workout"| node_workout_model
node_workout_exercise_service -->|"manages entries"| node_workout_exercise_model
node_workout_set_controller -->|"delegates"| node_workout_set_service
node_workout_set_service -->|"uses exercise entry"| node_workout_exercise_model
node_workout_set_service -->|"manages sets"| node_workout_set_model
node_record_controller -->|"delegates"| node_record_service
node_record_service -->|"reads set data"| node_workout_set_model
node_workout_model -->|"belongs to"| node_user_model
node_workout_model -->|"has entries"| node_workout_exercise_model
node_workout_exercise_model -->|"references exercise"| node_exercise_model
node_workout_exercise_model -->|"has sets"| node_workout_set_model
node_exercise_model -->|"belongs to"| node_category_model

click node_api_routes "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/routes/api.php"
click node_auth_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/AuthController.php"
click node_auth_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/AuthService.php"
click node_user_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/User.php"
click node_avatar_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/UserAvatarController.php"
click node_user_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/UserService.php"
click node_category_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/CategoryController.php"
click node_category_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/CategoryService.php"
click node_category_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Category.php"
click node_exercise_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/ExerciseController.php"
click node_exercise_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/ExerciseService.php"
click node_exercise_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Exercise.php"
click node_workout_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutController.php"
click node_workout_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutService.php"
click node_workout_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Workout.php"
click node_workout_exercise_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutExerciseController.php"
click node_workout_exercise_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutExerciseService.php"
click node_workout_exercise_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/WorkoutExercise.php"
click node_workout_set_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutSetController.php"
click node_workout_set_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutSetService.php"
click node_workout_set_model "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/WorkoutSet.php"
click node_record_controller "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/PersonalRecordController.php"
click node_record_service "https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/PersonalRecordService.php"

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_api_routes,node_client toneBlue
class node_auth_controller,node_auth_service,node_user_model,node_avatar_controller,node_user_service toneAmber
class node_category_controller,node_category_service,node_category_model,node_exercise_controller,node_exercise_service,node_exercise_model toneMint
class node_workout_controller,node_workout_service,node_workout_model,node_workout_exercise_controller,node_workout_exercise_service,node_workout_exercise_model,node_workout_set_controller,node_workout_set_service,node_workout_set_model,node_record_controller,node_record_service toneRose
```

## Components

### API entry

- [API routes](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/routes/api.php): `routes/api.php`

### Identity

- [Authentication API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/AuthController.php): `app/Http/Controllers/Api/AuthController.php`
- [Token service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/AuthService.php): `app/Services/AuthService.php`
- [User account](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/User.php): `app/Models/User.php`
- [Avatar API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/UserAvatarController.php): `app/Http/Controllers/Api/UserAvatarController.php`
- [User service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/UserService.php): `app/Services/UserService.php`

### Exercise catalog

- [Category API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/CategoryController.php): `app/Http/Controllers/Api/CategoryController.php`
- [Category service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/CategoryService.php): `app/Services/CategoryService.php`
- [Category catalog](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Exercise API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/ExerciseController.php): `app/Http/Controllers/Api/ExerciseController.php`
- [Exercise service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/ExerciseService.php): `app/Services/ExerciseService.php`
- [Exercise catalog](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Exercise.php): `app/Models/Exercise.php`

### Workout tracking

- [Workout API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutController.php): `app/Http/Controllers/Api/WorkoutController.php`
- [Workout service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutService.php): `app/Services/WorkoutService.php`
- [Workout records](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/Workout.php): `app/Models/Workout.php`
- [Workout exercise API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutExerciseController.php): `app/Http/Controllers/Api/WorkoutExerciseController.php`
- [Workout exercise service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutExerciseService.php): `app/Services/WorkoutExerciseService.php`
- [Workout exercises](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/WorkoutExercise.php): `app/Models/WorkoutExercise.php`
- [Workout set API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/WorkoutSetController.php): `app/Http/Controllers/Api/WorkoutSetController.php`
- [Workout set service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/WorkoutSetService.php): `app/Services/WorkoutSetService.php`
- [Workout sets](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Models/WorkoutSet.php): `app/Models/WorkoutSet.php`
- [Personal record API](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Http/Controllers/Api/PersonalRecordController.php): `app/Http/Controllers/Api/PersonalRecordController.php`
- [Personal record service](https://github.com/rmsddd/gym-weight-tracker-backend/blob/main/app/Services/PersonalRecordService.php): `app/Services/PersonalRecordService.php`

### Other components

- **API client**

## Connections

- API client → API routes: sends requests
- API routes → Authentication API: routes to (evidence: `routes/api.php`)
- API routes → Avatar API: routes to (evidence: `routes/api.php`)
- API routes → Category API: routes to (evidence: `routes/api.php`)
- API routes → Exercise API: routes to (evidence: `routes/api.php`)
- API routes → Workout API: routes to (evidence: `routes/api.php`)
- API routes → Workout exercise API: routes to (evidence: `routes/api.php`)
- API routes → Workout set API: routes to (evidence: `routes/api.php`)
- API routes → Personal record API: routes to (evidence: `routes/api.php`)
- Authentication API → Token service: requests tokens (evidence: `app/Http/Controllers/Api/AuthController.php`)
- Authentication API → User account: creates account (evidence: `app/Http/Controllers/Api/AuthController.php`)
- Token service → User account: issues tokens (evidence: `app/Services/AuthService.php`)
- Avatar API → User service: delegates (evidence: `app/Http/Controllers/Api/UserAvatarController.php`)
- Category API → Category service: delegates (evidence: `app/Http/Controllers/Api/CategoryController.php`)
- Category service → Category catalog: accesses catalog
- Exercise API → Exercise service: delegates (evidence: `app/Http/Controllers/Api/ExerciseController.php`)
- Exercise service → Exercise catalog: queries catalog (evidence: `app/Services/ExerciseService.php`)
- Workout API → Workout service: delegates (evidence: `app/Http/Controllers/Api/WorkoutController.php`)
- Workout service → Workout records: manages workouts (evidence: `app/Services/WorkoutService.php`)
- Workout exercise API → Workout exercise service: delegates (evidence: `app/Http/Controllers/Api/WorkoutExerciseController.php`)
- Workout exercise service → Workout records: uses workout (evidence: `app/Services/WorkoutExerciseService.php`)
- Workout exercise service → Workout exercises: manages entries (evidence: `app/Services/WorkoutExerciseService.php`)
- Workout set API → Workout set service: delegates (evidence: `app/Http/Controllers/Api/WorkoutSetController.php`)
- Workout set service → Workout exercises: uses exercise entry (evidence: `app/Services/WorkoutSetService.php`)
- Workout set service → Workout sets: manages sets (evidence: `app/Services/WorkoutSetService.php`)
- Personal record API → Personal record service: delegates (evidence: `app/Http/Controllers/Api/PersonalRecordController.php`)
- Personal record service → Workout sets: reads set data (evidence: `app/Services/PersonalRecordService.php`)
- Workout records → User account: belongs to (evidence: `app/Models/Workout.php`)
- Workout records → Workout exercises: has entries (evidence: `app/Models/Workout.php`)
- Workout exercises → Exercise catalog: references exercise (evidence: `app/Models/WorkoutExercise.php`)
- Workout exercises → Workout sets: has sets (evidence: `app/Models/WorkoutExercise.php`)
- Exercise catalog → Category catalog: belongs to (evidence: `app/Models/Exercise.php`)
