How dev-tew/chatapp works
This repository is a Laravel/Inertia chat application: users register or sign in, open private or group conversations, retrieve history, and send text or image messages that are persisted and broadcast. The frontend also includes profile and online-status capabilities. The principal message flow is grounded in ChatController; the tree indicates other UI and presence branches, but their implementation and exact wiring were not sampled. The README describes Laravel generically, so it does not document application-specific behavior.
Main entry points: ChatController.php Chat requests · User.php User model · BroadcastServiceProvider.php Broadcast service · database.php Relational database
Components 24
Web entry and routing
- HTTP entry
public/index.php - Web routes
routes/web.php - API routes
routes/api.php - Auth routes
routes/auth.php
Accounts and profile
- Authentication
app/Http/Controllers/Auth/RegisteredUserController.php - Session handling
app/Http/Controllers/Auth/AuthenticatedSessionController.php - Profile management
app/Http/Controllers/ProfileController.php - User model
app/Models/User.php
Chat and persistence
- Chat requests
app/Http/Controllers/ChatController.php - Conversations
app/Models/Conversation.php - Participants
app/Models/Participant.php - Messages
app/Models/Message.php - Relational database
config/database.php
Realtime and interface
- Private message event
app/Events/PrivateMessageEvent.php - Group message event
app/Events/GroupMessageEvent.php - User status event
app/Events/UserStatusEvent.php - Channel authorization
routes/channels.php - Chat interface
resources/js/Pages/Chat.jsx - Group chat interface
resources/js/Pages/GroupChat.jsx - Realtime client
resources/js/Components/EchoComponent/Echo.jsx - Online status hook
resources/js/Hooks/useOnlineStatusChannel.jsx - Broadcast service
app/Providers/BroadcastServiceProvider.php
Other components
- Browser user
- WebSocket service
Connections 34
- Browser user → HTTP entry: sends requests
- HTTP entry → Web routes: hands off
- Web routes → Chat requests: routes chat
- Web routes → Profile management: routes profile
- Auth routes → Authentication: routes registration
- Auth routes → Session handling: routes sessions
- Browser user → Auth routes: submits credentials
- Browser user → API routes: requests API
- Authentication → User model: creates user
- Authentication → Conversations: creates group membership
- Session handling → User model: authenticates user
- Profile management → User model: updates account
- Chat requests → Conversations: finds or creates
- Chat requests → Messages: reads and saves
- Chat requests → User model: loads users
- Conversations → Relational database: persists
- Participants → Relational database: persists
- Messages → Relational database: persists
- User model → Relational database: persists
- Chat requests → Private message event: dispatches private
- Chat requests → Group message event: dispatches group
- Private message event → Broadcast service: broadcasts event
- Group message event → Broadcast service: broadcasts event
- Broadcast service → WebSocket service: publishes events
- Browser user → Chat interface: uses chat
- Browser user → Group chat interface: uses group chat
- Chat interface → Chat requests: sends chat requests
- Group chat interface → Chat requests: sends group requests
- Chat interface → Realtime client: uses realtime client
- Group chat interface → Realtime client: uses realtime client
- Realtime client → WebSocket service: subscribes
- Online status hook → Channel authorization: subscribes to status
- User status event → Broadcast service: broadcasts status
- Channel authorization → Broadcast service: authorizes channels