# phuoc-link/eventhub-backend architecture

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

- Interactive diagram: https://gitdiagram.com/phuoc-link/eventhub-backend
- Repository: https://github.com/phuoc-link/eventhub-backend

## Overview

EventHub is a Laravel API for a Flutter event app. Its main workflow is authenticated event discovery and detail viewing, followed by event creation or schedule-level registration; owners manage schedules and participants, while users can cancel registrations and receive notifications. The graph also includes profile, place autocomplete, and shared time/state rules. Relationships are limited to those visible in excerpts, the source index, or README; several request, resource, and service implementations were not sampled, so their internal behavior is not inferred.

Main entry points: [`routes/api.php`](https://github.com/phuoc-link/eventhub-backend/blob/main/routes/api.php) (API routes), [`app/Services/EventReadService.php`](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventReadService.php) (Event queries), [`app/Services/EventService.php`](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventService.php) (Event management), [`app/Models/Event.php`](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Event.php) (Events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_routes["API routes<br/>[api.php]"]
  node_auth_api["Authentication API<br/>[AuthController.php]"]
  node_events_api["Events API"]
  node_registration_api["Registration API"]
  node_notification_api["Notifications API"]
end

subgraph group_events["Event management"]
  node_event_read["Event queries"]
  node_event_write["Event management<br/>[EventService.php]"]
  node_schedule_service["Schedule management"]
end

subgraph group_participation["Participation"]
  node_registration_service["Registration management"]
  node_notification_service["Notification creation"]
  node_notification_read["Notification queries"]
end

subgraph group_account["Accounts and integrations"]
  node_auth_service["Authentication service<br/>[AuthService.php]"]
  node_profile_api["Profile API"]
  node_profile_service["Profile service<br/>[ProfileService.php]"]
  node_places_api["Place autocomplete API"]
  node_places_service["Google Places integration"]
end

subgraph group_domain["Domain and data"]
  node_event_state["Event state rules<br/>[EventState.php]"]
  node_business_clock["Business time<br/>[BusinessClock.php]"]
  node_api_response["API responses<br/>[ApiResponse.php]"]
  node_event_model[("Events<br/>[Event.php]")]
  node_schedule_model[("Schedules<br/>[Schedule.php]")]
  node_registration_model[("Registrations<br/>[Registration.php]")]
  node_notification_model[("Notifications<br/>[Notification.php]")]
  node_user_model[("Users<br/>[User.php]")]
end

node_client(("Flutter client"))
node_google_places(("Google Places<br/>external system"))

node_client -->|"calls API"| node_routes
node_routes -->|"routes requests"| node_auth_api
node_routes -->|"routes requests"| node_events_api
node_routes -->|"routes requests"| node_registration_api
node_routes -->|"routes requests"| node_notification_api
node_routes -->|"routes requests"| node_profile_api
node_routes -->|"routes requests"| node_places_api
node_auth_api -->|"delegates auth"| node_auth_service
node_auth_api -->|"returns user data"| node_user_model
node_auth_api -->|"formats response"| node_api_response
node_events_api -->|"queries events"| node_event_read
node_events_api -->|"manages events"| node_event_write
node_events_api -->|"formats response"| node_api_response
node_event_read -->|"applies status rules"| node_event_state
node_event_read -->|"queries events"| node_event_model
node_event_read -->|"reads registrations"| node_registration_model
node_event_read -->|"reads schedules"| node_schedule_model
node_event_write -->|"delegates schedules"| node_schedule_service
node_event_write -->|"creates notifications"| node_notification_service
node_event_write -->|"checks editability"| node_event_state
node_event_write -->|"writes events"| node_event_model
node_schedule_service -->|"creates notifications"| node_notification_service
node_registration_api -->|"delegates changes"| node_registration_service
node_registration_api -->|"queries event data"| node_event_read
node_registration_service -->|"creates notifications"| node_notification_service
node_registration_service -->|"writes registrations"| node_registration_model
node_registration_model -->|"belongs to schedule"| node_schedule_model
node_schedule_model -->|"belongs to event"| node_event_model
node_notification_api -->|"queries notifications"| node_notification_read
node_notification_api -->|"formats response"| node_api_response
node_notification_service -->|"writes notifications"| node_notification_model
node_places_api -->|"requests suggestions"| node_places_service
node_places_service -.->|"queries provider"| node_google_places
node_profile_api -->|"delegates updates"| node_profile_service
node_profile_service -.->|"updates profile"| node_user_model
node_business_clock -->|"provides time"| node_event_state
node_event_read -->|"reads business time"| node_business_clock
node_event_model -->|"belongs to creator"| node_user_model
node_user_model -.->|"owns schedules"| node_event_model

click node_routes "https://github.com/phuoc-link/eventhub-backend/blob/main/routes/api.php"
click node_auth_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/AuthController.php"
click node_events_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/EventController.php"
click node_registration_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/RegistrationController.php"
click node_notification_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/NotificationController.php"
click node_event_read "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventReadService.php"
click node_event_write "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventService.php"
click node_schedule_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/ScheduleService.php"
click node_registration_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/RegistrationService.php"
click node_notification_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/NotificationService.php"
click node_notification_read "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/NotificationReadService.php"
click node_auth_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/AuthService.php"
click node_profile_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/ProfileController.php"
click node_profile_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/ProfileService.php"
click node_places_api "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/PlaceAutocompleteController.php"
click node_places_service "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/GooglePlacesService.php"
click node_event_state "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Support/EventState.php"
click node_business_clock "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Support/BusinessClock.php"
click node_api_response "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Responses/ApiResponse.php"
click node_event_model "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Event.php"
click node_schedule_model "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Schedule.php"
click node_registration_model "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Registration.php"
click node_notification_model "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Notification.php"
click node_user_model "https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/User.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_routes,node_auth_api,node_events_api,node_registration_api,node_notification_api,node_client toneBlue
class node_event_read,node_event_write,node_schedule_service toneAmber
class node_registration_service,node_notification_service,node_notification_read toneMint
class node_auth_service,node_profile_api,node_profile_service,node_places_api,node_places_service toneRose
class node_event_state,node_business_clock,node_api_response,node_event_model,node_schedule_model,node_registration_model,node_notification_model,node_user_model,node_google_places toneIndigo
```

## Components

### API boundary

- [API routes](https://github.com/phuoc-link/eventhub-backend/blob/main/routes/api.php): `routes/api.php`
- [Authentication API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/AuthController.php): `app/Http/Controllers/Api/V1/AuthController.php`
- [Events API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/EventController.php): `app/Http/Controllers/Api/V1/EventController.php`
- [Registration API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/RegistrationController.php): `app/Http/Controllers/Api/V1/RegistrationController.php`
- [Notifications API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/NotificationController.php): `app/Http/Controllers/Api/V1/NotificationController.php`

### Event management

- [Event queries](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventReadService.php): `app/Services/EventReadService.php`
- [Event management](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/EventService.php): `app/Services/EventService.php`
- [Schedule management](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/ScheduleService.php): `app/Services/ScheduleService.php`

### Participation

- [Registration management](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/RegistrationService.php): `app/Services/RegistrationService.php`
- [Notification creation](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/NotificationService.php): `app/Services/NotificationService.php`
- [Notification queries](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/NotificationReadService.php): `app/Services/NotificationReadService.php`

### Accounts and integrations

- [Authentication service](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/AuthService.php): `app/Services/AuthService.php`
- [Profile API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/ProfileController.php): `app/Http/Controllers/Api/V1/ProfileController.php`
- [Profile service](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/ProfileService.php): `app/Services/ProfileService.php`
- [Place autocomplete API](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Controllers/Api/V1/PlaceAutocompleteController.php): `app/Http/Controllers/Api/V1/PlaceAutocompleteController.php`
- [Google Places integration](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Services/GooglePlacesService.php): `app/Services/GooglePlacesService.php`

### Domain and data

- [Event state rules](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Support/EventState.php): `app/Support/EventState.php`
- [Business time](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Support/BusinessClock.php): `app/Support/BusinessClock.php`
- [API responses](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Http/Responses/ApiResponse.php): `app/Http/Responses/ApiResponse.php`
- [Events](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Event.php): `app/Models/Event.php`
- [Schedules](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Schedule.php): `app/Models/Schedule.php`
- [Registrations](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Registration.php): `app/Models/Registration.php`
- [Notifications](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/Notification.php): `app/Models/Notification.php`
- [Users](https://github.com/phuoc-link/eventhub-backend/blob/main/app/Models/User.php): `app/Models/User.php`

### Other components

- **Flutter client**
- **Google Places**: external system

## Connections

- Flutter client → API routes: calls API
- API routes → Authentication API: routes requests (evidence: `routes/api.php`)
- API routes → Events API: routes requests (evidence: `routes/api.php`)
- API routes → Registration API: routes requests (evidence: `routes/api.php`)
- API routes → Notifications API: routes requests (evidence: `routes/api.php`)
- API routes → Profile API: routes requests (evidence: `routes/api.php`)
- API routes → Place autocomplete API: routes requests (evidence: `routes/api.php`)
- Authentication API → Authentication service: delegates auth (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- Authentication API → Users: returns user data (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- Authentication API → API responses: formats response (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- Events API → Event queries: queries events (evidence: `app/Http/Controllers/Api/V1/EventController.php`)
- Events API → Event management: manages events (evidence: `app/Http/Controllers/Api/V1/EventController.php`)
- Events API → API responses: formats response (evidence: `app/Http/Controllers/Api/V1/EventController.php`)
- Event queries → Event state rules: applies status rules (evidence: `app/Services/EventReadService.php`)
- Event queries → Events: queries events (evidence: `app/Services/EventReadService.php`)
- Event queries → Registrations: reads registrations (evidence: `app/Services/EventReadService.php`)
- Event queries → Schedules: reads schedules (evidence: `app/Services/EventReadService.php`)
- Event management → Schedule management: delegates schedules (evidence: `app/Services/EventService.php`)
- Event management → Notification creation: creates notifications (evidence: `app/Services/EventService.php`)
- Event management → Event state rules: checks editability (evidence: `app/Services/EventService.php`)
- Event management → Events: writes events (evidence: `app/Services/EventService.php`)
- Schedule management → Notification creation: creates notifications (evidence: `app/Services/ScheduleService.php`)
- Registration API → Registration management: delegates changes (evidence: `app/Http/Controllers/Api/V1/RegistrationController.php`)
- Registration API → Event queries: queries event data (evidence: `app/Http/Controllers/Api/V1/RegistrationController.php`)
- Registration management → Notification creation: creates notifications (evidence: `app/Services/RegistrationService.php`)
- Registration management → Registrations: writes registrations (evidence: `app/Services/RegistrationService.php`)
- Registrations → Schedules: belongs to schedule (evidence: `app/Models/Registration.php`)
- Schedules → Events: belongs to event (evidence: `app/Models/Schedule.php`)
- Notifications API → Notification queries: queries notifications (evidence: `app/Http/Controllers/Api/V1/NotificationController.php`)
- Notifications API → API responses: formats response (evidence: `app/Http/Controllers/Api/V1/NotificationController.php`)
- Notification creation → Notifications: writes notifications (evidence: `app/Services/NotificationService.php`)
- Place autocomplete API → Google Places integration: requests suggestions (evidence: `app/Http/Controllers/Api/V1/PlaceAutocompleteController.php`)
- Google Places integration → Google Places: queries provider · Inferred; not shown in the code that was read.
- Profile API → Profile service: delegates updates (evidence: `app/Http/Controllers/Api/V1/ProfileController.php`)
- Profile service → Users: updates profile
- Business time → Event state rules: provides time (evidence: `app/Support/EventState.php`)
- Event queries → Business time: reads business time (evidence: `app/Services/EventReadService.php`)
- Events → Users: belongs to creator (evidence: `app/Models/Event.php`)
- Users → Events: owns schedules (evidence: `app/Models/Event.php`)
