# dhanyahegdek/relayhub architecture

> Architecture diagram of the GitHub repository dhanyahegdek/relayhub, 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/dhanyahegdek/relayhub
- Repository: https://github.com/dhanyahegdek/relayhub

## Overview

RelayHub is a Laravel backend serving a JWT-authenticated chat API, with a separate web account experience and Filament administration. The primary flow is a frontend request through API routes to authentication or chat handlers, which read and update user, conversation, and message records; chat sends also dispatch a broadcast event. File uploads additionally enforce user quotas and use public storage. The README documents channel authorization, user administration, and Filament capabilities. Some route and integration wiring is documented rather than sampled, so those edges cite the README; unsampled details are not inferred.

Main entry points: [`app/Http/Controllers/ChatController.php`](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/ChatController.php) (Chat API), [`app/Models/User.php`](https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/User.php) (User identity), [`routes/api.php`](https://github.com/dhanyahegdek/relayhub/blob/main/routes/api.php) (API routes), [`app/Http/Controllers/Admincontroller.php`](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/Admincontroller.php) (Admin API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request handling"]
  node_laravel["Laravel entry<br/>[index.php]"]
  node_api_routes["API routes<br/>[api.php]"]
  node_inertia_middleware["Inertia middleware"]
end

subgraph group_chat["Chat and storage"]
  node_chat_api["Chat API<br/>[ChatController.php]"]
  node_conversation[("Conversations<br/>[Conversation.php]")]
  node_message[("Messages<br/>[Message.php]")]
  node_broadcast_event["Message event<br/>[MessageSent.php]"]
  node_channels["Channel authorization<br/>[channels.php]"]
  node_file_storage[("Public file storage")]
end

subgraph group_identity["Identity and access"]
  node_auth_api["JWT API auth<br/>[AuthController.php]"]
  node_user[("User identity<br/>[User.php]")]
  node_fortify["Web authentication"]
  node_settings["Account settings"]
end

subgraph group_admin["Administration"]
  node_admin_api["Admin API"]
  node_roles["Roles and permissions<br/>[RolePolicy.php]"]
  node_filament_users["Filament user admin"]
end

node_frontend(("Chat frontend"))
node_reverb["Reverb WebSocket"]

node_frontend -->|"sends requests"| node_laravel
node_laravel -->|"routes API"| node_api_routes
node_api_routes -->|"routes auth"| node_auth_api
node_api_routes -->|"routes chat"| node_chat_api
node_api_routes -->|"routes admin"| node_admin_api
node_auth_api -->|"creates and reads"| node_user
node_chat_api -->|"reads identity"| node_user
node_chat_api -->|"reads and updates"| node_conversation
node_chat_api -->|"creates and queries"| node_message
node_chat_api -->|"dispatches"| node_broadcast_event
node_broadcast_event -->|"broadcasts"| node_reverb
node_frontend -->|"authorizes subscriptions"| node_channels
node_channels -->|"authorizes channels"| node_reverb
node_chat_api -->|"stores uploads"| node_file_storage
node_chat_api -->|"checks quota"| node_user
node_admin_api -->|"manages users"| node_user
node_admin_api -->|"assigns roles"| node_roles
node_frontend -->|"uses web auth"| node_fortify
node_fortify -.->|"renders web views"| node_inertia_middleware
node_frontend -->|"manages account"| node_settings
node_filament_users -.->|"manages users"| node_user
node_filament_users -->|"manages permissions"| node_roles

click node_laravel "https://github.com/dhanyahegdek/relayhub/blob/main/public/index.php"
click node_api_routes "https://github.com/dhanyahegdek/relayhub/blob/main/routes/api.php"
click node_auth_api "https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/AuthController.php"
click node_user "https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/User.php"
click node_chat_api "https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/ChatController.php"
click node_conversation "https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/Conversation.php"
click node_message "https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/Message.php"
click node_broadcast_event "https://github.com/dhanyahegdek/relayhub/blob/main/app/Events/MessageSent.php"
click node_channels "https://github.com/dhanyahegdek/relayhub/blob/main/routes/channels.php"
click node_admin_api "https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/Admincontroller.php"
click node_roles "https://github.com/dhanyahegdek/relayhub/blob/main/app/Policies/RolePolicy.php"
click node_filament_users "https://github.com/dhanyahegdek/relayhub/tree/main/app/Filament/Resources/Users"
click node_fortify "https://github.com/dhanyahegdek/relayhub/blob/main/app/Providers/FortifyServiceProvider.php"
click node_settings "https://github.com/dhanyahegdek/relayhub/tree/main/app/Http/Controllers/Settings"
click node_inertia_middleware "https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Middleware/HandleInertiaRequests.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_laravel,node_api_routes,node_inertia_middleware,node_frontend toneBlue
class node_chat_api,node_conversation,node_message,node_broadcast_event,node_channels,node_file_storage toneAmber
class node_auth_api,node_user,node_fortify,node_settings toneMint
class node_admin_api,node_roles,node_filament_users toneRose
class node_reverb toneIndigo
```

## Components

### Request handling

- [Laravel entry](https://github.com/dhanyahegdek/relayhub/blob/main/public/index.php): `public/index.php`
- [API routes](https://github.com/dhanyahegdek/relayhub/blob/main/routes/api.php): `routes/api.php`
- [Inertia middleware](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Middleware/HandleInertiaRequests.php): `app/Http/Middleware/HandleInertiaRequests.php`

### Chat and storage

- [Chat API](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/ChatController.php): `app/Http/Controllers/ChatController.php`
- [Conversations](https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/Conversation.php): `app/Models/Conversation.php`
- [Messages](https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/Message.php): `app/Models/Message.php`
- [Message event](https://github.com/dhanyahegdek/relayhub/blob/main/app/Events/MessageSent.php): `app/Events/MessageSent.php`
- [Channel authorization](https://github.com/dhanyahegdek/relayhub/blob/main/routes/channels.php): `routes/channels.php`
- **Public file storage**

### Identity and access

- [JWT API auth](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/AuthController.php): `app/Http/Controllers/AuthController.php`
- [User identity](https://github.com/dhanyahegdek/relayhub/blob/main/app/Models/User.php): `app/Models/User.php`
- [Web authentication](https://github.com/dhanyahegdek/relayhub/blob/main/app/Providers/FortifyServiceProvider.php): `app/Providers/FortifyServiceProvider.php`
- [Account settings](https://github.com/dhanyahegdek/relayhub/tree/main/app/Http/Controllers/Settings): `app/Http/Controllers/Settings`

### Administration

- [Admin API](https://github.com/dhanyahegdek/relayhub/blob/main/app/Http/Controllers/Admincontroller.php): `app/Http/Controllers/Admincontroller.php`
- [Roles and permissions](https://github.com/dhanyahegdek/relayhub/blob/main/app/Policies/RolePolicy.php): `app/Policies/RolePolicy.php`
- [Filament user admin](https://github.com/dhanyahegdek/relayhub/tree/main/app/Filament/Resources/Users): `app/Filament/Resources/Users`

### Other components

- **Chat frontend**
- **Reverb WebSocket**

## Connections

- Chat frontend → Laravel entry: sends requests
- Laravel entry → API routes: routes API
- API routes → JWT API auth: routes auth
- API routes → Chat API: routes chat
- API routes → Admin API: routes admin
- JWT API auth → User identity: creates and reads (evidence: `app/Http/Controllers/AuthController.php`)
- Chat API → User identity: reads identity (evidence: `app/Http/Controllers/ChatController.php`)
- Chat API → Conversations: reads and updates (evidence: `app/Http/Controllers/ChatController.php`)
- Chat API → Messages: creates and queries (evidence: `app/Http/Controllers/ChatController.php`)
- Chat API → Message event: dispatches (evidence: `app/Http/Controllers/ChatController.php`)
- Message event → Reverb WebSocket: broadcasts
- Chat frontend → Channel authorization: authorizes subscriptions
- Channel authorization → Reverb WebSocket: authorizes channels
- Chat API → Public file storage: stores uploads (evidence: `app/Http/Controllers/ChatController.php`)
- Chat API → User identity: checks quota (evidence: `app/Http/Controllers/ChatController.php`)
- Admin API → User identity: manages users (evidence: `app/Http/Controllers/Admincontroller.php`)
- Admin API → Roles and permissions: assigns roles (evidence: `app/Http/Controllers/Admincontroller.php`)
- Chat frontend → Web authentication: uses web auth
- Web authentication → Inertia middleware: renders web views
- Chat frontend → Account settings: manages account
- Filament user admin → User identity: manages users
- Filament user admin → Roles and permissions: manages permissions
