# demarillacizere/realtime-chat architecture

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

- Interactive diagram: https://gitdiagram.com/demarillacizere/realtime-chat
- Repository: https://github.com/demarillacizere/realtime-chat

## Overview

This Laravel/Livewire application supports account access and a real-time text-chat workflow: users enter the chat, choose or create conversations, and send messages that appear in the interface. The documented product also includes registration, login, email verification, profile management, timestamps, and online presence, with MySQL persistence and Pusher-based WebSockets. Chat component internals and presence wiring were not fully sampled, so those relationships are shown only where the source index or README supports them; optional or unverified links are dashed.

Main entry points: [`app/Livewire/Chat/Chatbox.php`](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/Chatbox.php) (Conversation messaging), [`app/Events/MessageSent.php`](https://github.com/demarillacizere/realtime-chat/blob/main/app/Events/MessageSent.php) (Message broadcast event), [`routes/web.php`](https://github.com/demarillacizere/realtime-chat/blob/main/routes/web.php) (Web routes), [`app/Models/Conversation.php`](https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/Conversation.php) (Conversation model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Accounts and access"]
  node_authroutes["Authentication routes<br/>[auth.php]"]
  node_registration["Registration"]
  node_login["Login sessions"]
  node_loginrequest["Login validation<br/>[LoginRequest.php]"]
  node_profile["Profile management"]
end

subgraph group_chat["Chat experience"]
  node_chatmain["Chat page<br/>[Main.php]"]
  node_chatlist["Conversation list<br/>[ChatList.php]"]
  node_createchat["Create conversation<br/>[CreateChat.php]"]
  node_chatbox["Conversation messaging<br/>[Chatbox.php]"]
  node_sendmessage["Send message UI<br/>[SendMessage.php]"]
  node_presence["Online presence<br/>[channels.php]"]
end

subgraph group_domain["Chat domain"]
  node_messageevent["Message broadcast event<br/>[MessageSent.php]"]
  node_conversation["Conversation model<br/>[Conversation.php]"]
  node_message["Message model<br/>[Message.php]"]
  node_user["User model<br/>[User.php]"]
end

subgraph group_platform["Application platform"]
  node_http["Laravel HTTP entry<br/>[index.php]"]
  node_routes["Web routes<br/>[web.php]"]
  node_database[("MySQL database<br/>[database.php]")]
end

node_visitor(("Web user"))
node_pusher{{"Pusher WebSockets"}}

node_visitor -->|"requests pages"| node_http
node_http -->|"dispatches web"| node_routes
node_routes -->|"routes chat"| node_chatmain
node_routes -->|"routes creation"| node_createchat
node_routes -->|"loads auth routes"| node_authroutes
node_authroutes -->|"routes registration"| node_registration
node_authroutes -->|"routes login"| node_login
node_login -->|"authenticates with"| node_loginrequest
node_registration -->|"creates account"| node_user
node_chatmain -.->|"renders list"| node_chatlist
node_chatmain -.->|"renders conversation"| node_chatbox
node_chatlist -.->|"loads conversations"| node_conversation
node_createchat -.->|"creates conversation"| node_conversation
node_chatbox -->|"uses messages"| node_message
node_chatbox -->|"uses conversation"| node_conversation
node_chatbox -->|"uses participants"| node_user
node_chatbox -->|"dispatches event"| node_messageevent
node_sendmessage -.->|"persists message"| node_message
node_messageevent -->|"references message"| node_message
node_messageevent -->|"references conversation"| node_conversation
node_messageevent -->|"references sender"| node_user
node_chatbox -.->|"shows status"| node_presence
node_messageevent -.->|"broadcasts via"| node_pusher
node_conversation -.->|"persists data"| node_database
node_message -.->|"persists data"| node_database
node_user -.->|"persists data"| node_database
node_routes -->|"routes profile"| node_profile

click node_http "https://github.com/demarillacizere/realtime-chat/blob/main/public/index.php"
click node_routes "https://github.com/demarillacizere/realtime-chat/blob/main/routes/web.php"
click node_authroutes "https://github.com/demarillacizere/realtime-chat/blob/main/routes/auth.php"
click node_registration "https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_login "https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_loginrequest "https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Requests/Auth/LoginRequest.php"
click node_profile "https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/ProfileController.php"
click node_chatmain "https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/Main.php"
click node_chatlist "https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/ChatList.php"
click node_createchat "https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/CreateChat.php"
click node_chatbox "https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/Chatbox.php"
click node_sendmessage "https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/SendMessage.php"
click node_messageevent "https://github.com/demarillacizere/realtime-chat/blob/main/app/Events/MessageSent.php"
click node_presence "https://github.com/demarillacizere/realtime-chat/blob/main/routes/channels.php"
click node_conversation "https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/Conversation.php"
click node_message "https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/Message.php"
click node_user "https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/User.php"
click node_database "https://github.com/demarillacizere/realtime-chat/blob/main/config/database.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_registration,node_login,node_loginrequest,node_profile,node_visitor toneBlue
class node_chatmain,node_chatlist,node_createchat,node_chatbox,node_sendmessage,node_presence toneAmber
class node_messageevent,node_conversation,node_message,node_user toneMint
class node_http,node_routes,node_database toneRose
class node_pusher toneIndigo
```

## Components

### Accounts and access

- [Authentication routes](https://github.com/demarillacizere/realtime-chat/blob/main/routes/auth.php): `routes/auth.php`
- [Registration](https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Login sessions](https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Login validation](https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Requests/Auth/LoginRequest.php): `app/Http/Requests/Auth/LoginRequest.php`
- [Profile management](https://github.com/demarillacizere/realtime-chat/blob/main/app/Http/Controllers/ProfileController.php): `app/Http/Controllers/ProfileController.php`

### Chat experience

- [Chat page](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/Main.php): `app/Livewire/Chat/Main.php`
- [Conversation list](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/ChatList.php): `app/Livewire/Chat/ChatList.php`
- [Create conversation](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/CreateChat.php): `app/Livewire/Chat/CreateChat.php`
- [Conversation messaging](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/Chatbox.php): `app/Livewire/Chat/Chatbox.php`
- [Send message UI](https://github.com/demarillacizere/realtime-chat/blob/main/app/Livewire/Chat/SendMessage.php): `app/Livewire/Chat/SendMessage.php`
- [Online presence](https://github.com/demarillacizere/realtime-chat/blob/main/routes/channels.php): `routes/channels.php`

### Chat domain

- [Message broadcast event](https://github.com/demarillacizere/realtime-chat/blob/main/app/Events/MessageSent.php): `app/Events/MessageSent.php`
- [Conversation model](https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/Conversation.php): `app/Models/Conversation.php`
- [Message model](https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/Message.php): `app/Models/Message.php`
- [User model](https://github.com/demarillacizere/realtime-chat/blob/main/app/Models/User.php): `app/Models/User.php`

### Application platform

- [Laravel HTTP entry](https://github.com/demarillacizere/realtime-chat/blob/main/public/index.php): `public/index.php`
- [Web routes](https://github.com/demarillacizere/realtime-chat/blob/main/routes/web.php): `routes/web.php`
- [MySQL database](https://github.com/demarillacizere/realtime-chat/blob/main/config/database.php): `config/database.php`

### Other components

- **Web user**
- **Pusher WebSockets**

## Connections

- Web user → Laravel HTTP entry: requests pages
- Laravel HTTP entry → Web routes: dispatches web
- Web routes → Chat page: routes chat (evidence: `routes/web.php`)
- Web routes → Create conversation: routes creation (evidence: `routes/web.php`)
- Web routes → Authentication routes: loads auth routes (evidence: `routes/web.php`)
- Authentication routes → Registration: routes registration (evidence: `routes/auth.php`)
- Authentication routes → Login sessions: routes login (evidence: `routes/auth.php`)
- Login sessions → Login validation: authenticates with (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Registration → User model: creates account (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- Chat page → Conversation list: renders list
- Chat page → Conversation messaging: renders conversation
- Conversation list → Conversation model: loads conversations
- Create conversation → Conversation model: creates conversation
- Conversation messaging → Message model: uses messages (evidence: `app/Livewire/Chat/Chatbox.php`)
- Conversation messaging → Conversation model: uses conversation (evidence: `app/Livewire/Chat/Chatbox.php`)
- Conversation messaging → User model: uses participants (evidence: `app/Livewire/Chat/Chatbox.php`)
- Conversation messaging → Message broadcast event: dispatches event (evidence: `app/Livewire/Chat/Chatbox.php`)
- Send message UI → Message model: persists message
- Message broadcast event → Message model: references message (evidence: `app/Events/MessageSent.php`)
- Message broadcast event → Conversation model: references conversation (evidence: `app/Events/MessageSent.php`)
- Message broadcast event → User model: references sender (evidence: `app/Events/MessageSent.php`)
- Conversation messaging → Online presence: shows status
- Message broadcast event → Pusher WebSockets: broadcasts via
- Conversation model → MySQL database: persists data
- Message model → MySQL database: persists data
- User model → MySQL database: persists data
- Web routes → Profile management: routes profile (evidence: `routes/web.php`)
