# belalyasin/gemmanagementproject architecture

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

- Interactive diagram: https://gitdiagram.com/belalyasin/gemmanagementproject
- Repository: https://github.com/belalyasin/gemmanagementproject

## Overview

1. **Project shape**
   - This is a Laravel monolith for a gym management system.
   - The architecture follows the standard Laravel split: HTTP controllers, Eloquent models, form requests, policies, middleware, Blade views, migrations/seeders, and static assets under `public/`.

2. **User-facing surfaces**
   - There are two major UI surfaces:
     - A public/guest marketing site under `resources/views/gest/*` with pages like home, service, pricing, blog, join/login.
     - An authenticated admin/member area with dashboard, users, coaches, packages, sessions, attendance, payments, and revenue screens.
   - The front end is server-rendered Blade, not a SPA.

3. **Domain modules**
   - The core business areas are:
     - **Training packages** (`Package`, `BuyPackage`, `TrainingPackageController`)
     - **Coaches** (`Coach`, `CoachController`)
     - **Training sessions** (`TrainingSession`, `Session`, `CoachSession`, `TrainingSessionController`)
     - **Attendance** (`Attendance`, `Attendee`, `SessionAttendence`, `AttendanceController`)
     - **Payments/revenue** (`PaymentController`, `RevenueController`)
     - **Blogs/content** (`Blog`, `BlogController`)
     - **Users/profile management** (`User`, `UserController`)
   - These modules are separated at the controller/model/view level, but still share the same database and request pipeline.

4. **Data model and relationships**
   - The schema is centered on users, coaches, packages, sessions, and attendance.
   - Several join/association tables indicate many-to-many style relationships:
     - bought packages connecting users and packages
     - coach-sessions connecting coaches and sessions
     - attendance connecting users and sessions
     - user_sessions for user-to-session tracking/history
   - Migrations and factories show the domain was designed with relational reporting in mind.

5. **Authorization and roles**
   - Access control is a key boundary.
   - `config/permission.php`, `AuthServiceProvider`, and policies for `TrainingSession` and `User` indicate role/permission-based authorization.
   - Seeders include roles, permissions, and an admin assignment flow, so admin vs. non-admin behavior is a first-class architectural concern.

6. **HTTP layer**
   - Controllers are grouped by feature, with separate auth controllers for login/register/password reset/verification.
   - Form request classes enforce validation boundaries before domain actions:
     - create/update user, coach, package, and training session flows
   - Middleware handles standard Laravel concerns like auth, CSRF, maintenance, and cookie/session handling.

7. **Presentation layer**
   - Views are organized by feature folders matching controllers, which makes the route-to-view mapping straightforward.
   - Reusable layout shells live in `resources/views/layouts/*`.
   - Some views are duplicated in alternate versions such as `dashboardCopyEn.blade.php` and `masterCopyEn.blade.php`, suggesting localized or variant page rendering.

8. **Notifications and email**
   - The app sends email/notification-driven messages for operational workflows.
   - Examples include:
     - `CoachPassword` mail for coach onboarding/password delivery
     - `WelcomeEmailNotification`
     - `WeMissYou` notification, likely for inactivity/retention nudges
     - `NotifyUsers` console command for batch messaging
   - Email is configured through Laravel’s mail subsystem, making notification delivery an external integration point.

9. **Scheduling / background work**
   - `app/Console/Kernel.php` and the `NotifyUsers` command indicate scheduled or batch jobs.
   - This suggests some gym operations are automated outside the request/response cycle, likely for reminders or engagement follow-ups.

10. **API and resource shaping**
   - `routes/api.php` exists alongside web routes, so the app exposes at least some JSON endpoints.
   - API responses are normalized with Laravel resources such as `UserResource`, `PackageResource`, and `TrainingSessionResouce`.
   - This means the architecture supports both server-rendered pages and structured API payloads.

11. **Storage and media**
   - User and content images are stored under `public/imgs`, `public/userImage`, and related asset folders.
   - This is mostly file-system backed, not a separate media service.
   - The `storage/` directories and public asset hierarchy suggest the app manages its own uploaded content and static branding files.

12. **Tooling and runtime**
   - Composer/npm/webpack mix are present, so the app uses Laravel PHP on the backend and a traditional asset pipeline for JS/CSS.
   - Admin/UI assets are heavy and include packaged frontend libraries in `public/plugins`, `public/dist`, and `public/coustom`.
   - The repo includes standard Laravel testing scaffolding, seeders, factories, and environment config, which supports local setup and seeded demo data.

13. **What to draw in an architecture diagram**
   - A good diagram would show:
     - Browser users hitting Laravel web routes
     - Authenticated/admin users entering the dashboard
     - Controllers calling Eloquent models and policies
     - Validation through form requests
     - Persistence in the relational database via migrations/models
     - Notifications/mail and console commands as side flows
     - Static assets/images served from public storage
     - Optional JSON/API responses via resource classes

Main entry points: [`app/Http/Controllers`](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Controllers) (Feature controllers), [`database`](https://github.com/belalyasin/gemmanagementproject/tree/master/database) (Database), [`routes/web.php`](https://github.com/belalyasin/gemmanagementproject/blob/master/routes/web.php) (Web routes), [`app/Http/Resources`](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Resources) (API resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_http["HTTP layer"]
  node_routes_web["Web routes<br/>routing<br/>[web.php]"]
  node_routes_api["API routes<br/>routing<br/>[api.php]"]
  node_auth_controllers["Auth flow<br/>controllers"]
  node_feature_controllers["Feature controllers"]
  node_form_requests["Form requests<br/>validation"]
  node_policies["Policies<br/>authorization"]
  node_resources["API resources<br/>response shaping"]
end

subgraph group_g_domain["Domain model"]
  node_users[("Users<br/>model<br/>[User.php]")]
  node_coaches[("Coaches<br/>model<br/>[Coach.php]")]
  node_packages[("Packages<br/>model<br/>[Package.php]")]
  node_sessions[("Sessions<br/>model")]
  node_attendance[("Attendance<br/>model<br/>[Attendance.php]")]
  node_blogs["Blogs<br/>model<br/>[Blog.php]"]
  node_database_layer[("Database<br/>relational persistence")]
end

subgraph group_g_presentation["Presentation"]
  node_dashboard_views["Dashboard UI<br/>blade views"]
  node_guest_views["Guest site<br/>blade views"]
  node_module_views["Feature views<br/>blade views"]
end

subgraph group_g_ops["Ops & integration"]
  node_mail_notify["Mail & notify<br/>notifications"]
  node_scheduler["Scheduler<br/>console"]
  node_public_assets["Public assets<br/>static delivery"]
end

node_routes_web -->|"auth pages"| node_auth_controllers
node_routes_web -->|"feature pages"| node_feature_controllers
node_routes_web -->|"renders"| node_dashboard_views
node_routes_web -->|"renders"| node_guest_views
node_routes_api -->|"JSON output"| node_resources
node_feature_controllers -->|"validates with"| node_form_requests
node_feature_controllers -->|"authorizes with"| node_policies
node_feature_controllers -->|"reads/writes"| node_users
node_feature_controllers -->|"reads/writes"| node_coaches
node_feature_controllers -->|"reads/writes"| node_packages
node_feature_controllers -->|"reads/writes"| node_sessions
node_feature_controllers -->|"reads/writes"| node_attendance
node_feature_controllers -->|"reads/writes"| node_blogs
node_feature_controllers -->|"persists"| node_database_layer
node_sessions -->|"schema"| node_database_layer
node_packages -->|"schema"| node_database_layer
node_attendance -->|"schema"| node_database_layer
node_users -->|"schema"| node_database_layer
node_coaches -->|"schema"| node_database_layer
node_blogs -->|"schema"| node_database_layer
node_policies -->|"governs"| node_users
node_policies -->|"governs"| node_sessions
node_resources -->|"shapes"| node_users
node_resources -->|"shapes"| node_packages
node_resources -->|"shapes"| node_sessions
node_mail_notify -->|"email templates"| node_guest_views
node_scheduler -->|"triggers"| node_mail_notify
node_feature_controllers -->|"sends"| node_mail_notify
node_public_assets -.->|"static media"| node_guest_views
node_public_assets -.->|"admin UI assets"| node_dashboard_views

click node_routes_web "https://github.com/belalyasin/gemmanagementproject/blob/master/routes/web.php"
click node_routes_api "https://github.com/belalyasin/gemmanagementproject/blob/master/routes/api.php"
click node_auth_controllers "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Controllers/Auth"
click node_feature_controllers "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Controllers"
click node_form_requests "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Requests"
click node_policies "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Policies"
click node_resources "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Resources"
click node_users "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/User.php"
click node_coaches "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Coach.php"
click node_packages "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Package.php"
click node_sessions "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/TrainingSession.php"
click node_attendance "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Attendance.php"
click node_blogs "https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Blog.php"
click node_dashboard_views "https://github.com/belalyasin/gemmanagementproject/blob/master/resources/views/dashboard.blade.php"
click node_guest_views "https://github.com/belalyasin/gemmanagementproject/tree/master/resources/views/gest"
click node_module_views "https://github.com/belalyasin/gemmanagementproject/tree/master/resources/views"
click node_mail_notify "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Mail"
click node_scheduler "https://github.com/belalyasin/gemmanagementproject/tree/master/app/Console"
click node_public_assets "https://github.com/belalyasin/gemmanagementproject/tree/master/public"
click node_database_layer "https://github.com/belalyasin/gemmanagementproject/tree/master/database"

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_routes_web,node_routes_api,node_auth_controllers,node_feature_controllers,node_form_requests,node_policies,node_resources toneBlue
class node_users,node_coaches,node_packages,node_sessions,node_attendance,node_blogs,node_database_layer toneAmber
class node_dashboard_views,node_guest_views,node_module_views toneMint
class node_mail_notify,node_scheduler,node_public_assets toneRose
```

## Components

### HTTP layer

Web and API request handling, validation, and authorization boundaries.

- [Web routes](https://github.com/belalyasin/gemmanagementproject/blob/master/routes/web.php): routing · Main browser entrypoints for guest and authenticated flows. · `routes/web.php`
- [API routes](https://github.com/belalyasin/gemmanagementproject/blob/master/routes/api.php): routing · JSON endpoints alongside the server-rendered app. · `routes/api.php`
- [Auth flow](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Controllers/Auth): controllers · Login, register, password reset, and verification controllers. · `app/Http/Controllers/Auth`
- [Feature controllers](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Controllers): controllers · Gym feature endpoints for users, coaches, packages, sessions, attendance, payments, revenue, and blogs. · `app/Http/Controllers`
- [Form requests](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Requests): validation · Pre-controller validation for create and update operations. · `app/Http/Requests`
- [Policies](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Policies): authorization · Role- and ownership-aware authorization rules. · `app/Policies`
- [API resources](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Http/Resources): response shaping · Normalized API payloads for core entities. · `app/Http/Resources`

### Domain model

Core gym business entities and relational links.

- [Users](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/User.php): model · Member and admin accounts, profiles, and user-state workflows. · `app/Models/User.php`
- [Coaches](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Coach.php): model · Trainer profiles and onboarding credentials. · `app/Models/Coach.php`
- [Packages](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Package.php): model · Training package catalog and purchase records. · `app/Models/Package.php`
- [Sessions](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/TrainingSession.php): model · Training session definitions and coach assignments. · `app/Models/TrainingSession.php`
- [Attendance](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Attendance.php): model · Attendance tracking and session presence history. · `app/Models/Attendance.php`
- [Blogs](https://github.com/belalyasin/gemmanagementproject/blob/master/app/Models/Blog.php): model · Marketing and content posts. · `app/Models/Blog.php`
- [Database](https://github.com/belalyasin/gemmanagementproject/tree/master/database): relational persistence · Migrations, factories, seeders, and the shared relational schema. · `database`

### Presentation

Blade-rendered surfaces for guest and authenticated users.

- [Dashboard UI](https://github.com/belalyasin/gemmanagementproject/blob/master/resources/views/dashboard.blade.php): blade views · Authenticated admin/member screens for management and reporting. · `resources/views/dashboard.blade.php`
- [Guest site](https://github.com/belalyasin/gemmanagementproject/tree/master/resources/views/gest): blade views · Public marketing pages, join/login, and blog/service content. · `resources/views/gest`
- [Feature views](https://github.com/belalyasin/gemmanagementproject/tree/master/resources/views): blade views · Feature-specific CRUD and workflow screens for packages, coaches, sessions, users, attendance, revenue, and payments. · `resources/views`

### Ops & integration

Notifications, mail, scheduling, and public/static delivery.

- [Mail & notify](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Mail): notifications · Email templates and notifications for onboarding and retention messaging. · `app/Mail`
- [Scheduler](https://github.com/belalyasin/gemmanagementproject/tree/master/app/Console): console · Batch/scheduled commands that trigger outbound messages. · `app/Console`
- [Public assets](https://github.com/belalyasin/gemmanagementproject/tree/master/public): static delivery · Images, compiled assets, and vendor bundles served directly from public/ and storage-backed folders. · `public`

## Connections

- Web routes → Auth flow: auth pages · Web routes dispatch login/register/reset/verification flows.
- Web routes → Feature controllers: feature pages · Browser requests reach feature controllers.
- Web routes → Dashboard UI: renders · Authenticated pages render dashboard surfaces.
- Web routes → Guest site: renders · Public routes render marketing and guest pages.
- API routes → API resources: JSON output · API endpoints use resource classes for response shaping.
- Feature controllers → Form requests: validates with · Create/update flows use form request boundaries.
- Feature controllers → Policies: authorizes with · Sensitive operations are gated by policies and permissions.
- Feature controllers → Users: reads/writes · User management and profile operations.
- Feature controllers → Coaches: reads/writes · Coach management operations.
- Feature controllers → Packages: reads/writes · Package catalog and purchase workflows.
- Feature controllers → Sessions: reads/writes · Training session scheduling and assignment.
- Feature controllers → Attendance: reads/writes · Attendance tracking and reporting.
- Feature controllers → Blogs: reads/writes · Blog/content management.
- Feature controllers → Database: persists · Controllers operate through the shared relational schema.
- Sessions → Database: schema · Session tables, joins, and reporting structures.
- Packages → Database: schema · Package and bought-package tables.
- Attendance → Database: schema · Attendance and user-session tracking tables.
- Users → Database: schema · Users, roles, permissions, and profile data.
- Coaches → Database: schema · Coach records and associations.
- Blogs → Database: schema · Blog post storage.
- Policies → Users: governs · User policy controls profile and admin actions.
- Policies → Sessions: governs · Training session policy controls access and editing.
- API resources → Users: shapes · UserResource exposes user payloads.
- API resources → Packages: shapes · PackageResource exposes package payloads.
- API resources → Sessions: shapes · TrainingSession resource exposes session payloads.
- Mail & notify → Guest site: email templates · Notification/mail content is presented through Blade email views.
- Scheduler → Mail & notify: triggers · Console commands support batch notifications and reminders.
- Feature controllers → Mail & notify: sends · Operational workflows trigger mail and notifications.
- Public assets → Guest site: static media · Marketing pages use public images and scripts.
- Public assets → Dashboard UI: admin UI assets · Authenticated screens rely on compiled and vendor assets.
