# ma7moudkolib/sportsxbooking architecture

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

- Interactive diagram: https://gitdiagram.com/ma7moudkolib/sportsxbooking
- Repository: https://github.com/ma7moudkolib/sportsxbooking

## Overview

SportsXBooking is a multi-role sports-venue booking platform. Players browse venues, inspect details and reviews, then submit bookings; the backend validates availability and pricing, persists pending bookings, and owners manage bookings and analytics while admins manage users. Payment, authentication, reviews, and image storage are distinct supporting capabilities. The graph follows documented workflows and relationships shown in the supplied excerpts and SOURCE INDEX; unsampled implementation details are represented only where the README documents them.

Main entry points: [`Frontend/src/app/app.routes.ts`](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/app.routes.ts) (Role-based routes), [`Backend/Application/Services/ServiceManager.cs`](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/ServiceManager.cs) (Service manager), [`Backend/Infrastructure/Repositories/RepositoryManager.cs`](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Repositories/RepositoryManager.cs) (Repository unit of work), [`Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/DatabaseContext/RepositoryContext.cs) (SQL Server data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_frontend_routes["Role-based routes<br/>[app.routes.ts]"]
  node_gallery["Venue discovery"]
  node_venue_detail["Venue details"]
  node_booking_ui["Booking management"]
  node_owner_dashboard["Owner dashboard"]
  node_admin_users["Admin user tools"]
  node_auth_ui["Login and registration<br/>[login.component.ts]"]
  node_frontend_services["API client services"]
  node_auth_service_ui["Auth state and requests<br/>[auth.service.ts]"]
end

subgraph group_api["API and application"]
  node_api_controllers["REST controllers"]
  node_service_facade["Service manager<br/>[ServiceManager.cs]"]
  node_booking_logic["Booking rules<br/>[BookingService.cs]"]
  node_playground_logic["Venue management"]
  node_review_logic["Review handling<br/>[ReviewService.cs]"]
  node_payment_logic["Payment workflow<br/>[PaymentService.cs]"]
  node_auth_logic["Authentication and JWT"]
  node_user_logic["User administration<br/>[UserService.cs]"]
  node_middleware["Exception handling"]
end

subgraph group_persistence["Persistence and integrations"]
  node_file_storage["Image storage"]
  node_payment_gateway["PayPal gateway<br/>[PayPalGateway.cs]"]
  node_repository_manager["Repository unit of work"]
  node_repositories["Entity repositories"]
  node_database[("SQL Server data")]
end

subgraph group_domain["Domain model"]
  node_booking_entity["Booking records<br/>[Booking.cs]"]
  node_venue_entity["Playground records<br/>[Playground.cs]"]
  node_review_entity["Review records<br/>[Review.cs]"]
  node_payment_entity["Payment records<br/>[Payment.cs]"]
  node_user_entity["User and roles<br/>[User.cs]"]
end

node_player(("Player"))
node_owner(("Facility owner"))
node_admin(("Admin"))

node_player -->|"opens"| node_frontend_routes
node_owner -.->|"opens"| node_frontend_routes
node_admin -.->|"opens"| node_frontend_routes
node_frontend_routes -->|"routes to"| node_gallery
node_frontend_routes -->|"routes to"| node_venue_detail
node_frontend_routes -->|"routes to"| node_booking_ui
node_frontend_routes -->|"routes to"| node_owner_dashboard
node_frontend_routes -->|"routes to"| node_admin_users
node_frontend_routes -->|"routes to"| node_auth_ui
node_gallery -.->|"requests venues"| node_frontend_services
node_venue_detail -.->|"requests details"| node_frontend_services
node_booking_ui -.->|"requests bookings"| node_frontend_services
node_owner_dashboard -.->|"requests management"| node_frontend_services
node_admin_users -.->|"requests users"| node_frontend_services
node_auth_ui -.->|"submits credentials"| node_auth_service_ui
node_frontend_services -.->|"calls API"| node_api_controllers
node_auth_service_ui -.->|"calls API"| node_api_controllers
node_api_controllers -->|"dispatches"| node_service_facade
node_service_facade -->|"exposes"| node_booking_logic
node_service_facade -->|"exposes"| node_playground_logic
node_service_facade -->|"exposes"| node_review_logic
node_service_facade -->|"exposes"| node_payment_logic
node_service_facade -->|"exposes"| node_auth_logic
node_service_facade -->|"exposes"| node_user_logic
node_booking_logic -.->|"uses repositories"| node_repository_manager
node_playground_logic -.->|"uses repositories"| node_repository_manager
node_review_logic -->|"reads and saves"| node_repository_manager
node_payment_logic -.->|"uses repositories"| node_repository_manager
node_auth_logic -->|"creates and authenticates"| node_user_entity
node_auth_logic -->|"saves changes"| node_repository_manager
node_user_logic -.->|"uses repositories"| node_repository_manager
node_playground_logic -.->|"stores images"| node_file_storage
node_payment_logic -.->|"processes payment"| node_payment_gateway
node_repository_manager -->|"coordinates"| node_repositories
node_repositories -->|"queries and saves"| node_database
node_database -->|"persists"| node_booking_entity
node_database -->|"persists"| node_venue_entity
node_database -->|"persists"| node_review_entity
node_database -->|"persists"| node_payment_entity
node_database -->|"persists"| node_user_entity
node_review_logic -->|"checks venue"| node_venue_entity
node_review_logic -->|"creates review"| node_review_entity
node_middleware -.->|"handles failures"| node_api_controllers
node_booking_logic -.->|"creates and updates"| node_booking_entity
node_owner -.->|"manages facilities"| node_owner_dashboard
node_admin -.->|"manages users"| node_admin_users

click node_frontend_routes "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/app.routes.ts"
click node_gallery "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/playgrounds/gallery/playground-gallery.component.ts"
click node_venue_detail "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/playgrounds/detail/playground-detail.component.ts"
click node_booking_ui "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/bookings/my-bookings/my-bookings.component.ts"
click node_owner_dashboard "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/management/owner-dashboard/owner-dashboard.component.ts"
click node_admin_users "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/management/admin-users/admin-users.component.ts"
click node_auth_ui "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/auth/login/login.component.ts"
click node_frontend_services "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/core/services/playground.service.ts"
click node_auth_service_ui "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/core/services/auth.service.ts"
click node_api_controllers "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Presentation/Controllers/BookingsController.cs"
click node_service_facade "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/ServiceManager.cs"
click node_booking_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/BookingService.cs"
click node_playground_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/PlaygroundService.cs"
click node_review_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/ReviewService.cs"
click node_payment_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/PaymentService.cs"
click node_auth_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/AuthenticationService.cs"
click node_user_logic "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/UserService.cs"
click node_file_storage "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Services/CloudinaryStorageService.cs"
click node_payment_gateway "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Services/PayPalGateway.cs"
click node_repository_manager "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Repositories/RepositoryManager.cs"
click node_repositories "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Repositories/BookingRepository.cs"
click node_database "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/DatabaseContext/RepositoryContext.cs"
click node_middleware "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Presentation/Extensions/ExceptionMiddlewareExtensions.cs"
click node_booking_entity "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Booking.cs"
click node_venue_entity "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Playground.cs"
click node_review_entity "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Review.cs"
click node_payment_entity "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Payment.cs"
click node_user_entity "https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/User.cs"

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_frontend_routes,node_gallery,node_venue_detail,node_booking_ui,node_owner_dashboard,node_admin_users,node_auth_ui,node_frontend_services,node_auth_service_ui toneBlue
class node_api_controllers,node_service_facade,node_booking_logic,node_playground_logic,node_review_logic,node_payment_logic,node_auth_logic,node_user_logic,node_middleware toneAmber
class node_file_storage,node_payment_gateway,node_repository_manager,node_repositories,node_database toneMint
class node_booking_entity,node_venue_entity,node_review_entity,node_payment_entity,node_user_entity toneRose
class node_player,node_owner,node_admin toneIndigo
```

## Components

### Angular client

- [Role-based routes](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/app.routes.ts): `Frontend/src/app/app.routes.ts`
- [Venue discovery](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/playgrounds/gallery/playground-gallery.component.ts): `Frontend/src/app/features/playgrounds/gallery/playground-gallery.component.ts`
- [Venue details](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/playgrounds/detail/playground-detail.component.ts): `Frontend/src/app/features/playgrounds/detail/playground-detail.component.ts`
- [Booking management](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/bookings/my-bookings/my-bookings.component.ts): `Frontend/src/app/features/bookings/my-bookings/my-bookings.component.ts`
- [Owner dashboard](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/management/owner-dashboard/owner-dashboard.component.ts): `Frontend/src/app/features/management/owner-dashboard/owner-dashboard.component.ts`
- [Admin user tools](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/management/admin-users/admin-users.component.ts): `Frontend/src/app/features/management/admin-users/admin-users.component.ts`
- [Login and registration](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/features/auth/login/login.component.ts): `Frontend/src/app/features/auth/login/login.component.ts`
- [API client services](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/core/services/playground.service.ts): `Frontend/src/app/core/services/playground.service.ts`
- [Auth state and requests](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Frontend/src/app/core/services/auth.service.ts): `Frontend/src/app/core/services/auth.service.ts`

### API and application

- [REST controllers](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Presentation/Controllers/BookingsController.cs): `Backend/Presentation/Controllers/BookingsController.cs`
- [Service manager](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/ServiceManager.cs): `Backend/Application/Services/ServiceManager.cs`
- [Booking rules](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/BookingService.cs): `Backend/Application/Services/BookingService.cs`
- [Venue management](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/PlaygroundService.cs): `Backend/Application/Services/PlaygroundService.cs`
- [Review handling](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/ReviewService.cs): `Backend/Application/Services/ReviewService.cs`
- [Payment workflow](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/PaymentService.cs): `Backend/Application/Services/PaymentService.cs`
- [Authentication and JWT](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/AuthenticationService.cs): `Backend/Application/Services/AuthenticationService.cs`
- [User administration](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Application/Services/UserService.cs): `Backend/Application/Services/UserService.cs`
- [Exception handling](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Presentation/Extensions/ExceptionMiddlewareExtensions.cs): `Backend/Presentation/Extensions/ExceptionMiddlewareExtensions.cs`

### Persistence and integrations

- [Image storage](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Services/CloudinaryStorageService.cs): `Backend/Infrastructure/Services/CloudinaryStorageService.cs`
- [PayPal gateway](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Services/PayPalGateway.cs): `Backend/Infrastructure/Services/PayPalGateway.cs`
- [Repository unit of work](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Repositories/RepositoryManager.cs): `Backend/Infrastructure/Repositories/RepositoryManager.cs`
- [Entity repositories](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/Repositories/BookingRepository.cs): `Backend/Infrastructure/Repositories/BookingRepository.cs`
- [SQL Server data](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Infrastructure/DatabaseContext/RepositoryContext.cs): `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`

### Domain model

- [Booking records](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Booking.cs): `Backend/Domain/Entities/Booking.cs`
- [Playground records](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Playground.cs): `Backend/Domain/Entities/Playground.cs`
- [Review records](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Review.cs): `Backend/Domain/Entities/Review.cs`
- [Payment records](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/Payment.cs): `Backend/Domain/Entities/Payment.cs`
- [User and roles](https://github.com/ma7moudkolib/sportsxbooking/blob/master/Backend/Domain/Entities/User.cs): `Backend/Domain/Entities/User.cs`

### Other components

- **Player**
- **Facility owner**
- **Admin**

## Connections

- Player → Role-based routes: opens (evidence: `Frontend/src/app/app.routes.ts`)
- Facility owner → Role-based routes: opens
- Admin → Role-based routes: opens
- Role-based routes → Venue discovery: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Role-based routes → Venue details: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Role-based routes → Booking management: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Role-based routes → Owner dashboard: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Role-based routes → Admin user tools: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Role-based routes → Login and registration: routes to (evidence: `Frontend/src/app/app.routes.ts`)
- Venue discovery → API client services: requests venues
- Venue details → API client services: requests details
- Booking management → API client services: requests bookings
- Owner dashboard → API client services: requests management
- Admin user tools → API client services: requests users
- Login and registration → Auth state and requests: submits credentials
- API client services → REST controllers: calls API
- Auth state and requests → REST controllers: calls API
- REST controllers → Service manager: dispatches (evidence: `Backend/Presentation/Controllers/BookingsController.cs`)
- Service manager → Booking rules: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Service manager → Venue management: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Service manager → Review handling: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Service manager → Payment workflow: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Service manager → Authentication and JWT: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Service manager → User administration: exposes (evidence: `Backend/Application/Services/ServiceManager.cs`)
- Booking rules → Repository unit of work: uses repositories
- Venue management → Repository unit of work: uses repositories
- Review handling → Repository unit of work: reads and saves (evidence: `Backend/Application/Services/ReviewService.cs`)
- Payment workflow → Repository unit of work: uses repositories
- Authentication and JWT → User and roles: creates and authenticates (evidence: `Backend/Application/Services/AuthenticationService.cs`)
- Authentication and JWT → Repository unit of work: saves changes (evidence: `Backend/Application/Services/AuthenticationService.cs`)
- User administration → Repository unit of work: uses repositories
- Venue management → Image storage: stores images
- Payment workflow → PayPal gateway: processes payment
- Repository unit of work → Entity repositories: coordinates (evidence: `Backend/Infrastructure/Repositories/RepositoryManager.cs`)
- Entity repositories → SQL Server data: queries and saves (evidence: `Backend/Infrastructure/Repositories/RepositoryManager.cs`)
- SQL Server data → Booking records: persists (evidence: `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`)
- SQL Server data → Playground records: persists (evidence: `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`)
- SQL Server data → Review records: persists (evidence: `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`)
- SQL Server data → Payment records: persists (evidence: `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`)
- SQL Server data → User and roles: persists (evidence: `Backend/Infrastructure/DatabaseContext/RepositoryContext.cs`)
- Review handling → Playground records: checks venue (evidence: `Backend/Application/Services/ReviewService.cs`)
- Review handling → Review records: creates review (evidence: `Backend/Application/Services/ReviewService.cs`)
- Exception handling → REST controllers: handles failures
- Booking rules → Booking records: creates and updates
- Facility owner → Owner dashboard: manages facilities
- Admin → Admin user tools: manages users
