# fithub-team/laravel_backend architecture

> Architecture diagram of the GitHub repository fithub-team/laravel_backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fithub-team/laravel_backend
- Repository: https://github.com/fithub-team/laravel_backend

## Overview

This is a Laravel fitness-coaching platform: users create profiles, discover coaches, request coaching, and exchange plans and progress with coaches; administrators manage accounts and coaching data. The tree names additional capabilities such as availability, subscriptions, nutrition/workout plans, and chat. Sampled controllers show service-backed profile updates, authentication, and messaging; unsampled route and service implementations limit how much internal wiring can be asserted.

Main entry points: [`app/Http/Controllers/ChatController.php`](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/ChatController.php) (Chat API), [`app/Http/Controllers/Api/Auth/AuthController.php`](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/Auth/AuthController.php) (Authentication API), [`app/Services/Auth/AuthService.php`](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Auth/AuthService.php) (Authentication service), [`app/Repositories/UserRepository.php`](https://github.com/fithub-team/laravel_backend/blob/main/app/Repositories/UserRepository.php) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and profiles"]
  node_auth_api["Authentication API<br/>[AuthController.php]"]
  node_auth_service["Authentication service<br/>[AuthService.php]"]
  node_user_repository["User repository<br/>[UserRepository.php]"]
  node_user_profile_api["User profile API"]
  node_user_profile_service["Profile service<br/>[ProfileService.php]"]
  node_coach_profile_api["Coach profile API"]
  node_coach_service["Coach service<br/>[CoachService.php]"]
end

subgraph group_matching["Coach engagement"]
  node_browse_api["Coach browsing API"]
  node_browse_service["Coach discovery<br/>[BrowseCoach.php]"]
  node_subscription_api["Subscription request API"]
  node_subscription_service["Subscription requests"]
  node_coach_subscription["Coach subscriptions"]
end

subgraph group_coaching["Coaching tools"]
  node_plans_api["Plan APIs"]
  node_workout_service["Workout plans"]
  node_nutrition_api["Nutrition APIs"]
  node_nutrition_service["Nutrition plans"]
  node_progress_api["Progress APIs"]
  node_progress_service["Progress tracking"]
  node_chat_controller["Chat API<br/>[ChatController.php]"]
  node_chat_service["Chat service<br/>[ChatService.php]"]
end

subgraph group_operations["Administration"]
  node_admin_api["Admin APIs"]
  node_trainer_service["Trainer management<br/>[TrainerService.php]"]
  node_admin_dashboard["Admin dashboard"]
end

node_user_actor(("User"))
node_coach_actor(("Coach"))
node_admin_actor(("Administrator"))
node_database[("Application database<br/>[database.php]")]

node_user_actor -->|"authenticates"| node_auth_api
node_auth_api -->|"delegates"| node_auth_service
node_auth_service -->|"finds or creates"| node_user_repository
node_user_repository -->|"reads and writes"| node_database
node_user_actor -->|"updates profile"| node_user_profile_api
node_user_profile_api -->|"delegates"| node_user_profile_service
node_coach_actor -->|"manages profile"| node_coach_profile_api
node_coach_profile_api -->|"delegates"| node_coach_service
node_user_actor -->|"browses coaches"| node_browse_api
node_browse_api -->|"delegates"| node_browse_service
node_user_actor -->|"requests coaching"| node_subscription_api
node_subscription_api -->|"delegates"| node_subscription_service
node_coach_actor -->|"manages subscriptions"| node_coach_subscription
node_coach_actor -->|"manages workouts"| node_plans_api
node_plans_api -->|"delegates"| node_workout_service
node_coach_actor -->|"manages nutrition"| node_nutrition_api
node_nutrition_api -->|"delegates"| node_nutrition_service
node_coach_actor -->|"records progress"| node_progress_api
node_progress_api -->|"delegates"| node_progress_service
node_user_actor -->|"sends messages"| node_chat_controller
node_coach_actor -->|"sends messages"| node_chat_controller
node_chat_controller -->|"delegates"| node_chat_service
node_admin_actor -->|"manages coaches"| node_admin_api
node_admin_api -->|"delegates"| node_trainer_service
node_admin_actor -->|"views metrics"| node_admin_dashboard
node_admin_dashboard -->|"counts records"| node_database

click node_auth_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/Auth/AuthController.php"
click node_auth_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Auth/AuthService.php"
click node_user_repository "https://github.com/fithub-team/laravel_backend/blob/main/app/Repositories/UserRepository.php"
click node_user_profile_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/user/SettingProfileController.php"
click node_user_profile_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/User/ProfileService.php"
click node_coach_profile_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/SettingProfileController.php"
click node_coach_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/CoachService.php"
click node_browse_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/General/BrowseCoachController.php"
click node_browse_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/General/BrowseCoach.php"
click node_subscription_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/user/RequestSubscriptionController.php"
click node_subscription_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/User/RequestSubscription.php"
click node_coach_subscription "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/SubscriptionService.php"
click node_plans_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/WorkoutPlanController.php"
click node_workout_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/WorkoutPlanService.php"
click node_nutrition_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/NutritionPlanController.php"
click node_nutrition_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/NutritionPlanService.php"
click node_progress_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/ProgressController.php"
click node_progress_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/ProgressService.php"
click node_chat_controller "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/ChatController.php"
click node_chat_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Chat/ChatService.php"
click node_admin_api "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/Admin/TrainerController.php"
click node_trainer_service "https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Admin/TrainerService.php"
click node_admin_dashboard "https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Admin/DashboardController.php"
click node_database "https://github.com/fithub-team/laravel_backend/blob/main/config/database.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_auth_api,node_auth_service,node_user_repository,node_user_profile_api,node_user_profile_service,node_coach_profile_api,node_coach_service,node_user_actor toneBlue
class node_browse_api,node_browse_service,node_subscription_api,node_subscription_service,node_coach_subscription,node_database toneAmber
class node_plans_api,node_workout_service,node_nutrition_api,node_nutrition_service,node_progress_api,node_progress_service,node_chat_controller,node_chat_service toneMint
class node_admin_api,node_trainer_service,node_admin_dashboard toneRose
class node_coach_actor,node_admin_actor toneIndigo
```

## Components

### Identity and profiles

- [Authentication API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/Auth/AuthController.php): `app/Http/Controllers/Api/Auth/AuthController.php`
- [Authentication service](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Auth/AuthService.php): `app/Services/Auth/AuthService.php`
- [User repository](https://github.com/fithub-team/laravel_backend/blob/main/app/Repositories/UserRepository.php): `app/Repositories/UserRepository.php`
- [User profile API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/user/SettingProfileController.php): `app/Http/Controllers/Api/user/SettingProfileController.php`
- [Profile service](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/User/ProfileService.php): `app/Services/User/ProfileService.php`
- [Coach profile API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/SettingProfileController.php): `app/Http/Controllers/Api/coach/SettingProfileController.php`
- [Coach service](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/CoachService.php): `app/Services/Coach/CoachService.php`

### Coach engagement

- [Coach browsing API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/General/BrowseCoachController.php): `app/Http/Controllers/Api/General/BrowseCoachController.php`
- [Coach discovery](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/General/BrowseCoach.php): `app/Services/General/BrowseCoach.php`
- [Subscription request API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/user/RequestSubscriptionController.php): `app/Http/Controllers/Api/user/RequestSubscriptionController.php`
- [Subscription requests](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/User/RequestSubscription.php): `app/Services/User/RequestSubscription.php`
- [Coach subscriptions](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/SubscriptionService.php): `app/Services/Coach/SubscriptionService.php`

### Coaching tools

- [Plan APIs](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/WorkoutPlanController.php): `app/Http/Controllers/Api/coach/WorkoutPlanController.php`
- [Workout plans](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/WorkoutPlanService.php): `app/Services/Coach/WorkoutPlanService.php`
- [Nutrition APIs](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/NutritionPlanController.php): `app/Http/Controllers/Api/coach/NutritionPlanController.php`
- [Nutrition plans](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/NutritionPlanService.php): `app/Services/Coach/NutritionPlanService.php`
- [Progress APIs](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/coach/ProgressController.php): `app/Http/Controllers/Api/coach/ProgressController.php`
- [Progress tracking](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Coach/ProgressService.php): `app/Services/Coach/ProgressService.php`
- [Chat API](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/ChatController.php): `app/Http/Controllers/ChatController.php`
- [Chat service](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Chat/ChatService.php): `app/Services/Chat/ChatService.php`

### Administration

- [Admin APIs](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Api/Admin/TrainerController.php): `app/Http/Controllers/Api/Admin/TrainerController.php`
- [Trainer management](https://github.com/fithub-team/laravel_backend/blob/main/app/Services/Admin/TrainerService.php): `app/Services/Admin/TrainerService.php`
- [Admin dashboard](https://github.com/fithub-team/laravel_backend/blob/main/app/Http/Controllers/Admin/DashboardController.php): `app/Http/Controllers/Admin/DashboardController.php`

### Other components

- **User**
- **Coach**
- **Administrator**
- [Application database](https://github.com/fithub-team/laravel_backend/blob/main/config/database.php): `config/database.php`

## Connections

- User → Authentication API: authenticates
- Authentication API → Authentication service: delegates
- Authentication service → User repository: finds or creates
- User repository → Application database: reads and writes
- User → User profile API: updates profile
- User profile API → Profile service: delegates
- Coach → Coach profile API: manages profile
- Coach profile API → Coach service: delegates
- User → Coach browsing API: browses coaches
- Coach browsing API → Coach discovery: delegates
- User → Subscription request API: requests coaching
- Subscription request API → Subscription requests: delegates
- Coach → Coach subscriptions: manages subscriptions
- Coach → Plan APIs: manages workouts
- Plan APIs → Workout plans: delegates
- Coach → Nutrition APIs: manages nutrition
- Nutrition APIs → Nutrition plans: delegates
- Coach → Progress APIs: records progress
- Progress APIs → Progress tracking: delegates
- User → Chat API: sends messages
- Coach → Chat API: sends messages
- Chat API → Chat service: delegates
- Administrator → Admin APIs: manages coaches
- Admin APIs → Trainer management: delegates
- Administrator → Admin dashboard: views metrics
- Admin dashboard → Application database: counts records
