# omar-gamal18/el3abha architecture

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

- Interactive diagram: https://gitdiagram.com/omar-gamal18/el3abha
- Repository: https://github.com/omar-gamal18/el3abha

## Overview

This is an Express API for venue discovery and management, player bookings, and account access. Users call the API; authentication and venue routes are mounted by the app, while booking routes and handlers are present as a separate subsystem. Venue owners submit and manage venues, administrators review them, and players can check slots and submit bookings. Controllers use the Prisma-backed data layer and Cloudinary for images; account recovery also sends email. Booking-route mounting is not shown in the sampled app, so that connection is omitted.

Main entry points: [`src/app.js`](https://github.com/omar-gamal18/el3abha/blob/main/src/app.js) (Express app), [`src/routes/auth.route.js`](https://github.com/omar-gamal18/el3abha/blob/main/src/routes/auth.route.js) (Auth routes), [`src/controllers/auth.controller.js`](https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/auth.controller.js) (Account workflows), [`src/routes/venue.route.js`](https://github.com/omar-gamal18/el3abha/blob/main/src/routes/venue.route.js) (Venue routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and routing"]
  node_server["HTTP server<br/>[server.js]"]
  node_app["Express app<br/>[app.js]"]
  node_upload["File upload"]
  node_responses["API responses<br/>[apiResponse.js]"]
  node_errors["Error handling"]
end

subgraph group_accounts["Accounts and access"]
  node_auth_routes["Auth routes<br/>[auth.route.js]"]
  node_auth_validation["Auth validation<br/>[auth.validator.js]"]
  node_auth_controller["Account workflows<br/>[auth.controller.js]"]
  node_auth_middleware["Access control<br/>[auth.middleware.js]"]
end

subgraph group_venues["Venue operations"]
  node_venue_routes["Venue routes<br/>[venue.route.js]"]
  node_venue_validation["Venue validation"]
  node_venue_controller["Venue management"]
end

subgraph group_booking["Booking operations"]
  node_booking_routes["Booking routes<br/>[bookings.route.js]"]
  node_booking_controller["Booking workflows"]
end

subgraph group_services["Data and integrations"]
  node_database[("Prisma data layer<br/>[db.ts]")]
  node_cloudinary["Cloudinary images<br/>[cloudinary.js]"]
  node_email["Email delivery<br/>[sendEmail.js]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"starts"| node_app
node_app -->|"mounts"| node_auth_routes
node_app -->|"mounts"| node_venue_routes
node_app -->|"handles errors"| node_errors
node_auth_routes -->|"validates input"| node_auth_validation
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects logout"| node_auth_middleware
node_auth_controller -->|"reads and writes"| node_database
node_auth_controller -->|"sends reset code"| node_email
node_auth_controller -->|"formats success"| node_responses
node_auth_middleware -->|"loads user"| node_database
node_venue_routes -->|"dispatches"| node_venue_controller
node_venue_routes -->|"protects operations"| node_auth_middleware
node_venue_routes -->|"accepts image"| node_upload
node_venue_controller -->|"reads and writes"| node_database
node_venue_controller -->|"manages images"| node_cloudinary
node_venue_controller -->|"formats success"| node_responses
node_booking_routes -->|"dispatches"| node_booking_controller
node_booking_routes -->|"protects operations"| node_auth_middleware
node_booking_routes -->|"accepts receipt"| node_upload
node_booking_controller -->|"reads and writes"| node_database
node_booking_controller -->|"stores receipts"| node_cloudinary
node_booking_controller -->|"formats success"| node_responses

click node_server "https://github.com/omar-gamal18/el3abha/blob/main/src/server.js"
click node_app "https://github.com/omar-gamal18/el3abha/blob/main/src/app.js"
click node_auth_routes "https://github.com/omar-gamal18/el3abha/blob/main/src/routes/auth.route.js"
click node_auth_validation "https://github.com/omar-gamal18/el3abha/blob/main/src/validators/auth.validator.js"
click node_auth_controller "https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/auth.controller.js"
click node_auth_middleware "https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/auth.middleware.js"
click node_venue_routes "https://github.com/omar-gamal18/el3abha/blob/main/src/routes/venue.route.js"
click node_venue_validation "https://github.com/omar-gamal18/el3abha/tree/main/src/validators"
click node_venue_controller "https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/venue.controller.js"
click node_booking_routes "https://github.com/omar-gamal18/el3abha/blob/main/src/routes/bookings.route.js"
click node_booking_controller "https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/bookings.controller.js"
click node_upload "https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/upload.middleware.js"
click node_database "https://github.com/omar-gamal18/el3abha/blob/main/src/prisma/db.ts"
click node_cloudinary "https://github.com/omar-gamal18/el3abha/blob/main/src/utils/cloudinary.js"
click node_email "https://github.com/omar-gamal18/el3abha/blob/main/src/utils/sendEmail.js"
click node_responses "https://github.com/omar-gamal18/el3abha/blob/main/src/utils/apiResponse.js"
click node_errors "https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/errorHandler.middleware.js"

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_server,node_app,node_upload,node_responses,node_errors,node_client toneBlue
class node_auth_routes,node_auth_validation,node_auth_controller,node_auth_middleware toneAmber
class node_venue_routes,node_venue_validation,node_venue_controller toneMint
class node_booking_routes,node_booking_controller toneRose
class node_database,node_cloudinary,node_email toneIndigo
```

## Components

### API and routing

- [HTTP server](https://github.com/omar-gamal18/el3abha/blob/main/src/server.js): `src/server.js`
- [Express app](https://github.com/omar-gamal18/el3abha/blob/main/src/app.js): `src/app.js`
- [File upload](https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/upload.middleware.js): `src/middlewares/upload.middleware.js`
- [API responses](https://github.com/omar-gamal18/el3abha/blob/main/src/utils/apiResponse.js): `src/utils/apiResponse.js`
- [Error handling](https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/errorHandler.middleware.js): `src/middlewares/errorHandler.middleware.js`

### Accounts and access

- [Auth routes](https://github.com/omar-gamal18/el3abha/blob/main/src/routes/auth.route.js): `src/routes/auth.route.js`
- [Auth validation](https://github.com/omar-gamal18/el3abha/blob/main/src/validators/auth.validator.js): `src/validators/auth.validator.js`
- [Account workflows](https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/auth.controller.js): `src/controllers/auth.controller.js`
- [Access control](https://github.com/omar-gamal18/el3abha/blob/main/src/middlewares/auth.middleware.js): `src/middlewares/auth.middleware.js`

### Venue operations

- [Venue routes](https://github.com/omar-gamal18/el3abha/blob/main/src/routes/venue.route.js): `src/routes/venue.route.js`
- [Venue validation](https://github.com/omar-gamal18/el3abha/tree/main/src/validators): `src/validators`
- [Venue management](https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/venue.controller.js): `src/controllers/venue.controller.js`

### Booking operations

- [Booking routes](https://github.com/omar-gamal18/el3abha/blob/main/src/routes/bookings.route.js): `src/routes/bookings.route.js`
- [Booking workflows](https://github.com/omar-gamal18/el3abha/blob/main/src/controllers/bookings.controller.js): `src/controllers/bookings.controller.js`

### Data and integrations

- [Prisma data layer](https://github.com/omar-gamal18/el3abha/blob/main/src/prisma/db.ts): `src/prisma/db.ts`
- [Cloudinary images](https://github.com/omar-gamal18/el3abha/blob/main/src/utils/cloudinary.js): `src/utils/cloudinary.js`
- [Email delivery](https://github.com/omar-gamal18/el3abha/blob/main/src/utils/sendEmail.js): `src/utils/sendEmail.js`

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests
- HTTP server → Express app: starts (evidence: `src/server.js`)
- Express app → Auth routes: mounts (evidence: `src/app.js`)
- Express app → Venue routes: mounts (evidence: `src/app.js`)
- Express app → Error handling: handles errors (evidence: `src/app.js`)
- Auth routes → Auth validation: validates input (evidence: `src/routes/auth.route.js`)
- Auth routes → Account workflows: dispatches (evidence: `src/routes/auth.route.js`)
- Auth routes → Access control: protects logout (evidence: `src/routes/auth.route.js`)
- Account workflows → Prisma data layer: reads and writes (evidence: `src/controllers/auth.controller.js`)
- Account workflows → Email delivery: sends reset code (evidence: `src/controllers/auth.controller.js`)
- Account workflows → API responses: formats success (evidence: `src/controllers/auth.controller.js`)
- Access control → Prisma data layer: loads user (evidence: `src/middlewares/auth.middleware.js`)
- Venue routes → Venue management: dispatches (evidence: `src/routes/venue.route.js`)
- Venue routes → Access control: protects operations (evidence: `src/routes/venue.route.js`)
- Venue routes → File upload: accepts image (evidence: `src/routes/venue.route.js`)
- Venue management → Prisma data layer: reads and writes (evidence: `src/controllers/venue.controller.js`)
- Venue management → Cloudinary images: manages images (evidence: `src/controllers/venue.controller.js`)
- Venue management → API responses: formats success (evidence: `src/controllers/venue.controller.js`)
- Booking routes → Booking workflows: dispatches (evidence: `src/routes/bookings.route.js`)
- Booking routes → Access control: protects operations (evidence: `src/routes/bookings.route.js`)
- Booking routes → File upload: accepts receipt (evidence: `src/routes/bookings.route.js`)
- Booking workflows → Prisma data layer: reads and writes (evidence: `src/controllers/bookings.controller.js`)
- Booking workflows → Cloudinary images: stores receipts (evidence: `src/controllers/bookings.controller.js`)
- Booking workflows → API responses: formats success (evidence: `src/controllers/bookings.controller.js`)
