# jatint4r/livewire_web_chat_app architecture

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

- Interactive diagram: https://gitdiagram.com/jatint4r/livewire_web_chat_app
- Repository: https://github.com/jatint4r/livewire_web_chat_app

## Overview

SyncTalk is a real-time chat application. Users register or log in, choose another user, load a conversation, and send messages; the backend persists messages and uses Socket.IO for live delivery and online-user updates. The graph follows documented capabilities and sampled calls. Several profile, settings, and UI details are represented at their source paths because their implementation excerpts were not provided; those links are not inferred as runtime calls.

Main entry points: [`frontend/src/App.jsx`](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/App.jsx) (Route and auth shell), [`frontend/src/store/useChatStore.js`](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useChatStore.js) (Chat state), [`backend/src/controllers/message.controller.js`](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/controllers/message.controller.js) (Conversation handlers), [`backend/src/lib/socket.js`](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/lib/socket.js) (Socket server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web client"]
  node_app["Route and auth shell<br/>[App.jsx]"]
  node_auth_pages["Login and registration<br/>[LoginPage.jsx]"]
  node_profile["Profile and settings<br/>[ProfilePage.jsx]"]
  node_landing["Landing experience<br/>[LandingPage.jsx]"]
  node_home["Chat workspace<br/>[HomePage.jsx]"]
  node_sidebar["User sidebar<br/>[Sidebar.jsx]"]
  node_chat_window["Conversation view<br/>[ChatWindow.jsx]"]
  node_auth_store["Auth state<br/>[useAuthStore.js]"]
  node_chat_store["Chat state<br/>[useChatStore.js]"]
  node_socket_store["Socket state<br/>[useSocketStore.js]"]
  node_http_client["HTTP client<br/>[axios.js]"]
end

subgraph group_backend["API and identity"]
  node_api["Express API entry<br/>[index.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_auth_controller["Authentication handlers<br/>[auth.controller.js]"]
  node_auth_middleware["JWT authorization<br/>[auth.middleware.js]"]
end

subgraph group_messaging["Messaging and presence"]
  node_message_routes["Message routes<br/>[message.routes.js]"]
  node_message_controller["Conversation handlers"]
  node_socket_server["Socket server<br/>[socket.js]"]
end

subgraph group_persistence["MongoDB storage"]
  node_user_model[("User records<br/>[user.model.js]")]
  node_message_model[("Message records<br/>[message.model.js]")]
end

node_user(("Chat user"))
node_mongo[("MongoDB")]
node_socket_io["Socket.IO transport"]

node_user -->|"uses"| node_app
node_app -->|"checks auth"| node_auth_store
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_profile
node_user -->|"submits credentials"| node_auth_pages
node_auth_pages -->|"updates auth"| node_auth_store
node_auth_store -->|"sends requests"| node_http_client
node_auth_store -->|"connects user"| node_socket_store
node_api -->|"mounts routes"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects profile"| node_auth_middleware
node_auth_controller -->|"reads and saves"| node_user_model
node_auth_middleware -->|"loads user"| node_user_model
node_user_model -.->|"stores users"| node_mongo
node_home -->|"renders"| node_sidebar
node_home -->|"renders"| node_chat_window
node_user -.->|"chooses contact"| node_sidebar
node_sidebar -->|"selects user"| node_chat_store
node_chat_window -->|"loads and sends"| node_chat_store
node_chat_store -->|"requests messages"| node_http_client
node_api -->|"mounts routes"| node_message_routes
node_message_routes -->|"protects endpoints"| node_auth_middleware
node_message_routes -->|"dispatches"| node_message_controller
node_message_controller -->|"lists contacts"| node_user_model
node_message_controller -->|"reads and saves"| node_message_model
node_message_model -.->|"stores messages"| node_mongo
node_message_controller -->|"emits delivery"| node_socket_server
node_socket_store -->|"opens connection"| node_socket_io
node_socket_server -->|"serves events"| node_socket_io
node_socket_store -->|"supplies socket"| node_chat_store
node_socket_server -->|"broadcasts presence"| node_socket_store
node_socket_server -.->|"delivers messages"| node_chat_store
node_user -.->|"edits profile"| node_profile

click node_app "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/App.jsx"
click node_auth_pages "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/LoginPage.jsx"
click node_profile "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_landing "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/LandingPage.jsx"
click node_home "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/HomePage.jsx"
click node_sidebar "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/components/Sidebar.jsx"
click node_chat_window "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/components/ChatWindow.jsx"
click node_auth_store "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useAuthStore.js"
click node_chat_store "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useChatStore.js"
click node_socket_store "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useSocketStore.js"
click node_http_client "https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/lib/axios.js"
click node_api "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/index.js"
click node_auth_routes "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/controllers/auth.controller.js"
click node_auth_middleware "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/middleware/auth.middleware.js"
click node_user_model "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/models/user.model.js"
click node_message_routes "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/routes/message.routes.js"
click node_message_controller "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/controllers/message.controller.js"
click node_message_model "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/models/message.model.js"
click node_socket_server "https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/lib/socket.js"

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_app,node_auth_pages,node_profile,node_landing,node_home,node_sidebar,node_chat_window,node_auth_store,node_chat_store,node_socket_store,node_http_client,node_user toneBlue
class node_api,node_auth_routes,node_auth_controller,node_auth_middleware,node_mongo toneAmber
class node_message_routes,node_message_controller,node_socket_server toneMint
class node_user_model,node_message_model toneRose
class node_socket_io toneIndigo
```

## Components

### Web client

- [Route and auth shell](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and registration](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Profile and settings](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Landing experience](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/LandingPage.jsx): `frontend/src/pages/LandingPage.jsx`
- [Chat workspace](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [User sidebar](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Conversation view](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/components/ChatWindow.jsx): `frontend/src/components/ChatWindow.jsx`
- [Auth state](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Chat state](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useChatStore.js): `frontend/src/store/useChatStore.js`
- [Socket state](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/store/useSocketStore.js): `frontend/src/store/useSocketStore.js`
- [HTTP client](https://github.com/jatint4r/livewire_web_chat_app/blob/main/frontend/src/lib/axios.js): `frontend/src/lib/axios.js`

### API and identity

- [Express API entry](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/index.js): `backend/src/index.js`
- [Auth routes](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Authentication handlers](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [JWT authorization](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`

### Messaging and presence

- [Message routes](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/routes/message.routes.js): `backend/src/routes/message.routes.js`
- [Conversation handlers](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/controllers/message.controller.js): `backend/src/controllers/message.controller.js`
- [Socket server](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/lib/socket.js): `backend/src/lib/socket.js`

### MongoDB storage

- [User records](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Message records](https://github.com/jatint4r/livewire_web_chat_app/blob/main/backend/src/models/message.model.js): `backend/src/models/message.model.js`

### Other components

- **Chat user**
- **MongoDB**
- **Socket.IO transport**

## Connections

- Chat user → Route and auth shell: uses (evidence: `README.md`)
- Route and auth shell → Auth state: checks auth (evidence: `frontend/src/App.jsx`)
- Route and auth shell → Landing experience: routes to (evidence: `frontend/src/App.jsx`)
- Route and auth shell → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Route and auth shell → Chat workspace: routes to (evidence: `frontend/src/App.jsx`)
- Route and auth shell → Profile and settings: routes to (evidence: `frontend/src/App.jsx`)
- Chat user → Login and registration: submits credentials (evidence: `README.md`)
- Login and registration → Auth state: updates auth (evidence: `frontend/src/store/useAuthStore.js`)
- Auth state → HTTP client: sends requests (evidence: `frontend/src/store/useAuthStore.js`)
- Auth state → Socket state: connects user (evidence: `frontend/src/store/useAuthStore.js`)
- Express API entry → Auth routes: mounts routes (evidence: `backend/src/index.js`)
- Auth routes → Authentication handlers: dispatches (evidence: `backend/src/routes/auth.routes.js`)
- Auth routes → JWT authorization: protects profile (evidence: `backend/src/routes/auth.routes.js`)
- Authentication handlers → User records: reads and saves (evidence: `backend/src/controllers/auth.controller.js`)
- JWT authorization → User records: loads user (evidence: `backend/src/middleware/auth.middleware.js`)
- User records → MongoDB: stores users
- Chat workspace → User sidebar: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Chat workspace → Conversation view: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Chat user → User sidebar: chooses contact
- User sidebar → Chat state: selects user (evidence: `frontend/src/store/useChatStore.js`)
- Conversation view → Chat state: loads and sends (evidence: `frontend/src/components/ChatWindow.jsx`)
- Chat state → HTTP client: requests messages (evidence: `frontend/src/store/useChatStore.js`)
- Express API entry → Message routes: mounts routes (evidence: `backend/src/index.js`)
- Message routes → JWT authorization: protects endpoints (evidence: `backend/src/routes/message.routes.js`)
- Message routes → Conversation handlers: dispatches (evidence: `backend/src/routes/message.routes.js`)
- Conversation handlers → User records: lists contacts (evidence: `backend/src/controllers/message.controller.js`)
- Conversation handlers → Message records: reads and saves (evidence: `backend/src/controllers/message.controller.js`)
- Message records → MongoDB: stores messages
- Conversation handlers → Socket server: emits delivery (evidence: `backend/src/controllers/message.controller.js`)
- Socket state → Socket.IO transport: opens connection (evidence: `frontend/src/store/useSocketStore.js`)
- Socket server → Socket.IO transport: serves events (evidence: `backend/src/lib/socket.js`)
- Socket state → Chat state: supplies socket (evidence: `frontend/src/store/useChatStore.js`)
- Socket server → Socket state: broadcasts presence (evidence: `README.md`)
- Socket server → Chat state: delivers messages
- Chat user → Profile and settings: edits profile
