# rajorshidas/real-time-chat-application architecture

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

- Interactive diagram: https://gitdiagram.com/rajorshidas/real-time-chat-application
- Repository: https://github.com/rajorshidas/real-time-chat-application

## Overview

This is a Laravel/Inertia chat application: users authenticate, select direct or group conversations, exchange messages and attachments, and receive message/group deletion or new-message updates. The sampled controller shows message persistence, conversation-summary updates, attachment storage, and event dispatch; models supply conversation and group data. The README describes Laravel generically rather than this product, so unsampled UI, routes, user administration, and realtime wiring are represented only where supported or as unverified links.

Main entry points: [`app/Http/Controllers/MessageController.php`](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/MessageController.php) (Message actions), [`resources/js/Pages/Home.jsx`](https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/Pages/Home.jsx) (Chat screens and layout), [`routes/auth.php`](https://github.com/rajorshidas/real-time-chat-application/blob/master/routes/auth.php) (Auth routes), [`app/Models/Group.php`](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Group.php) (Groups)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_authroutes["Auth routes<br/>[auth.php]"]
  node_sessions["Sessions and registration"]
  node_registration["User registration"]
end

subgraph group_chat["Chat workflows"]
  node_messages["Message actions"]
  node_groups["Group management"]
  node_deletejob["Group deletion job<br/>[DeleteGroupJob.php]"]
end

subgraph group_domain["Chat domain"]
  node_message["Messages and attachments<br/>[Message.php]"]
  node_conversation["Direct conversations<br/>[Conversation.php]"]
  node_groupmodel["Groups<br/>[Group.php]"]
  node_user["Users<br/>[User.php]"]
  node_messageresource["Message response shaping"]
  node_socket["Message broadcast event<br/>[SocketMessage.php]"]
  node_msgdeleted["Message deletion event<br/>[MessageDeleted.php]"]
  node_groupdeleted["Group deletion event<br/>[GroupDeleted.php]"]
  node_observer["Message observer"]
end

subgraph group_client["Inertia client"]
  node_chatui["Chat screens and layout<br/>[Home.jsx]"]
  node_eventbus["Client event bus<br/>[EventBus.jsx]"]
  node_attachmentui["Attachment preview"]
  node_inertia["Inertia page shell<br/>[app.blade.php]"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests auth"| node_authroutes
node_authroutes -->|"routes login"| node_sessions
node_authroutes -->|"routes registration"| node_registration
node_registration -->|"creates user"| node_user
node_messages -->|"creates and queries"| node_message
node_messages -->|"updates summary"| node_conversation
node_messages -->|"updates summary"| node_groupmodel
node_messages -->|"formats response"| node_messageresource
node_messages -->|"dispatches event"| node_socket
node_messages -->|"dispatches event"| node_msgdeleted
node_groups -->|"creates and updates"| node_groupmodel
node_groups -->|"dispatches event"| node_groupdeleted
node_deletejob -->|"deletes group"| node_groupmodel
node_deletejob -->|"dispatches event"| node_groupdeleted
node_message -->|"observed by"| node_observer
node_msgdeleted -->|"formats message"| node_messageresource
node_socket -->|"formats message"| node_messageresource
node_chatui -.->|"submits chat actions"| node_messages
node_chatui -.->|"handles live updates"| node_eventbus
node_chatui -.->|"previews attachments"| node_attachmentui
node_chatui -.->|"rendered through"| node_inertia

click node_authroutes "https://github.com/rajorshidas/real-time-chat-application/blob/master/routes/auth.php"
click node_sessions "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_registration "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_messages "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/MessageController.php"
click node_groups "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/GroupController.php"
click node_deletejob "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Jobs/DeleteGroupJob.php"
click node_message "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Message.php"
click node_conversation "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Conversation.php"
click node_groupmodel "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Group.php"
click node_user "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/User.php"
click node_messageresource "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Resources/MessageResource.php"
click node_socket "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/SocketMessage.php"
click node_msgdeleted "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/MessageDeleted.php"
click node_groupdeleted "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/GroupDeleted.php"
click node_observer "https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Observers/MessageObserver.php"
click node_chatui "https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/Pages/Home.jsx"
click node_eventbus "https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/EventBus.jsx"
click node_attachmentui "https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/Components/App/AttachmentPreview.jsx"
click node_inertia "https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/views/app.blade.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_authroutes,node_sessions,node_registration toneBlue
class node_messages,node_groups,node_deletejob toneAmber
class node_message,node_conversation,node_groupmodel,node_user,node_messageresource,node_socket,node_msgdeleted,node_groupdeleted,node_observer toneMint
class node_chatui,node_eventbus,node_attachmentui,node_inertia toneRose
class node_visitor toneIndigo
```

## Components

### Identity

- [Auth routes](https://github.com/rajorshidas/real-time-chat-application/blob/master/routes/auth.php): `routes/auth.php`
- [Sessions and registration](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [User registration](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`

### Chat workflows

- [Message actions](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/MessageController.php): `app/Http/Controllers/MessageController.php`
- [Group management](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Controllers/GroupController.php): `app/Http/Controllers/GroupController.php`
- [Group deletion job](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Jobs/DeleteGroupJob.php): `app/Jobs/DeleteGroupJob.php`

### Chat domain

- [Messages and attachments](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Message.php): `app/Models/Message.php`
- [Direct conversations](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Conversation.php): `app/Models/Conversation.php`
- [Groups](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/Group.php): `app/Models/Group.php`
- [Users](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Models/User.php): `app/Models/User.php`
- [Message response shaping](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Http/Resources/MessageResource.php): `app/Http/Resources/MessageResource.php`
- [Message broadcast event](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/SocketMessage.php): `app/Events/SocketMessage.php`
- [Message deletion event](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/MessageDeleted.php): `app/Events/MessageDeleted.php`
- [Group deletion event](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Events/GroupDeleted.php): `app/Events/GroupDeleted.php`
- [Message observer](https://github.com/rajorshidas/real-time-chat-application/blob/master/app/Observers/MessageObserver.php): `app/Observers/MessageObserver.php`

### Inertia client

- [Chat screens and layout](https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/Pages/Home.jsx): `resources/js/Pages/Home.jsx`
- [Client event bus](https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/EventBus.jsx): `resources/js/EventBus.jsx`
- [Attachment preview](https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/js/Components/App/AttachmentPreview.jsx): `resources/js/Components/App/AttachmentPreview.jsx`
- [Inertia page shell](https://github.com/rajorshidas/real-time-chat-application/blob/master/resources/views/app.blade.php): `resources/views/app.blade.php`

### Other components

- **Visitor**

## Connections

- Visitor → Auth routes: requests auth (evidence: `routes/auth.php`)
- Auth routes → Sessions and registration: routes login (evidence: `routes/auth.php`)
- Auth routes → User registration: routes registration (evidence: `routes/auth.php`)
- User registration → Users: creates user (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- Message actions → Messages and attachments: creates and queries (evidence: `app/Http/Controllers/MessageController.php`)
- Message actions → Direct conversations: updates summary (evidence: `app/Http/Controllers/MessageController.php`)
- Message actions → Groups: updates summary (evidence: `app/Http/Controllers/MessageController.php`)
- Message actions → Message response shaping: formats response (evidence: `app/Http/Controllers/MessageController.php`)
- Message actions → Message broadcast event: dispatches event (evidence: `app/Http/Controllers/MessageController.php`)
- Message actions → Message deletion event: dispatches event (evidence: `app/Http/Controllers/MessageController.php`)
- Group management → Groups: creates and updates (evidence: `app/Http/Controllers/GroupController.php`)
- Group management → Group deletion event: dispatches event (evidence: `app/Http/Controllers/GroupController.php`)
- Group deletion job → Groups: deletes group (evidence: `app/Jobs/DeleteGroupJob.php`)
- Group deletion job → Group deletion event: dispatches event (evidence: `app/Jobs/DeleteGroupJob.php`)
- Messages and attachments → Message observer: observed by (evidence: `app/Models/Message.php`)
- Message deletion event → Message response shaping: formats message (evidence: `app/Events/MessageDeleted.php`)
- Message broadcast event → Message response shaping: formats message (evidence: `app/Events/SocketMessage.php`)
- Chat screens and layout → Message actions: submits chat actions
- Chat screens and layout → Client event bus: handles live updates
- Chat screens and layout → Attachment preview: previews attachments
- Chat screens and layout → Inertia page shell: rendered through
