# nofcngway/chat-app architecture

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

- Interactive diagram: https://gitdiagram.com/nofcngway/chat-app
- Repository: https://github.com/nofcngway/chat-app

## Overview

Hexlet Chat is a React/Redux real-time chat SPA. Users sign up or log in, then load channels and messages, choose a channel, and exchange messages; channel creation, renaming, and removal are additional workflows. The graph separates page orchestration, chat UI, state, and network integrations. API and event relationships are shown where the excerpts or source index establish them; backend internals are outside this repository.

Main entry points: [`frontend/src/pages/MainPage.jsx`](https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/MainPage.jsx) (Chat page), [`frontend/src/components/Channels/ChannelsList.jsx`](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Channels/ChannelsList.jsx) (Channel list), [`frontend/src/store/slices/chatSlice.js`](https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/slices/chatSlice.js) (Chat state), [`frontend/src/App.jsx`](https://github.com/nofcngway/chat-app/blob/main/frontend/src/App.jsx) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["App routes<br/>[App.jsx]"]
  node_login["Login<br/>[LoginPage.jsx]"]
  node_signup["Sign up<br/>[SignupPage.jsx]"]
  node_main["Chat page<br/>[MainPage.jsx]"]
  node_header["Header<br/>[Header.jsx]"]
  node_validation["Form validation"]
end

subgraph group_chat["Chat experience"]
  node_channels["Channel list<br/>[ChannelsList.jsx]"]
  node_channelitem["Channel item<br/>[ChannelItem.jsx]"]
  node_addchannel["Add channel"]
  node_editchannel["Rename channel"]
  node_removechannel["Remove channel"]
  node_messages["Message list<br/>[MessagesList.jsx]"]
  node_messageitem["Message item<br/>[MessageItem.jsx]"]
  node_messageform["Message composer<br/>[MessageForm.jsx]"]
  node_profanity["Text cleaning<br/>[profanity.js]"]
end

subgraph group_state["Client state"]
  node_authstate[("Auth state<br/>[authSlice.js]")]
  node_chatstate[("Chat state<br/>[chatSlice.js]")]
  node_store["Redux store<br/>[store.js]"]
end

subgraph group_services["Network services"]
  node_authapi["Auth API<br/>[auth.js]"]
  node_channelapi["Channel API<br/>[channels.js]"]
  node_messageapi["Message API<br/>[messages.js]"]
  node_http["REST client<br/>[index.js]"]
  node_socket["Socket client<br/>[socket.js]"]
end

node_user(("Chat user"))
node_backend{{"Chat backend"}}

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_main
node_app -->|"renders"| node_header
node_login -->|"authenticates via"| node_authapi
node_signup -->|"registers via"| node_authapi
node_login -->|"validates with"| node_validation
node_signup -->|"validates with"| node_validation
node_login -->|"dispatches credentials"| node_authstate
node_signup -->|"dispatches credentials"| node_authstate
node_store -->|"registers reducer"| node_authstate
node_store -->|"registers reducer"| node_chatstate
node_main -->|"checks access"| node_authstate
node_main -->|"loads channels"| node_channelapi
node_main -->|"loads messages"| node_messageapi
node_main -->|"dispatches chat data"| node_chatstate
node_main -->|"connects and listens"| node_socket
node_main -->|"renders"| node_channels
node_main -->|"renders"| node_messages
node_main -->|"renders"| node_messageform
node_channels -->|"reads channels"| node_chatstate
node_channels -->|"renders"| node_channelitem
node_channels -->|"opens"| node_addchannel
node_channels -->|"opens"| node_editchannel
node_channels -->|"opens"| node_removechannel
node_addchannel -->|"creates channel"| node_channelapi
node_addchannel -->|"updates state"| node_chatstate
node_addchannel -->|"validates with"| node_validation
node_addchannel -->|"cleans text"| node_profanity
node_editchannel -->|"renames channel"| node_channelapi
node_editchannel -->|"updates state"| node_chatstate
node_editchannel -->|"validates with"| node_validation
node_editchannel -->|"cleans text"| node_profanity
node_removechannel -->|"deletes channel"| node_channelapi
node_removechannel -->|"updates state"| node_chatstate
node_messages -->|"renders"| node_messageitem
node_messageform -->|"sends message"| node_messageapi
node_messageform -->|"cleans text"| node_profanity
node_authapi -->|"uses client"| node_http
node_channelapi -->|"uses client"| node_http
node_messageapi -->|"uses client"| node_http
node_http -->|"sends REST requests"| node_backend
node_socket -.->|"exchanges events"| node_backend

click node_app "https://github.com/nofcngway/chat-app/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/LoginPage.jsx"
click node_signup "https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/SignupPage.jsx"
click node_main "https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/MainPage.jsx"
click node_header "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Header/Header.jsx"
click node_validation "https://github.com/nofcngway/chat-app/blob/main/frontend/src/schemas/validationSchema.js"
click node_channels "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Channels/ChannelsList.jsx"
click node_channelitem "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Channels/ChannelItem.jsx"
click node_addchannel "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/AddChannelModal.jsx"
click node_editchannel "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/EditChannelModal.jsx"
click node_removechannel "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/RemoveChannelModal.jsx"
click node_messages "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessagesList.jsx"
click node_messageitem "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessageItem.jsx"
click node_messageform "https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessageForm.jsx"
click node_profanity "https://github.com/nofcngway/chat-app/blob/main/frontend/src/utils/profanity.js"
click node_authstate "https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/slices/authSlice.js"
click node_chatstate "https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/slices/chatSlice.js"
click node_store "https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/store.js"
click node_authapi "https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/auth.js"
click node_channelapi "https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/channels.js"
click node_messageapi "https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/messages.js"
click node_http "https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/index.js"
click node_socket "https://github.com/nofcngway/chat-app/blob/main/frontend/src/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_login,node_signup,node_main,node_header,node_validation,node_user toneBlue
class node_channels,node_channelitem,node_addchannel,node_editchannel,node_removechannel,node_messages,node_messageitem,node_messageform,node_profanity toneAmber
class node_authstate,node_chatstate,node_store toneMint
class node_authapi,node_channelapi,node_messageapi,node_http,node_socket toneRose
class node_backend toneIndigo
```

## Components

### Application

- [App routes](https://github.com/nofcngway/chat-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login](https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Sign up](https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/SignupPage.jsx): `frontend/src/pages/SignupPage.jsx`
- [Chat page](https://github.com/nofcngway/chat-app/blob/main/frontend/src/pages/MainPage.jsx): `frontend/src/pages/MainPage.jsx`
- [Header](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Header/Header.jsx): `frontend/src/components/Header/Header.jsx`
- [Form validation](https://github.com/nofcngway/chat-app/blob/main/frontend/src/schemas/validationSchema.js): `frontend/src/schemas/validationSchema.js`

### Chat experience

- [Channel list](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Channels/ChannelsList.jsx): `frontend/src/components/Channels/ChannelsList.jsx`
- [Channel item](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Channels/ChannelItem.jsx): `frontend/src/components/Channels/ChannelItem.jsx`
- [Add channel](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/AddChannelModal.jsx): `frontend/src/components/Modals/AddChannelModal.jsx`
- [Rename channel](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/EditChannelModal.jsx): `frontend/src/components/Modals/EditChannelModal.jsx`
- [Remove channel](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Modals/RemoveChannelModal.jsx): `frontend/src/components/Modals/RemoveChannelModal.jsx`
- [Message list](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessagesList.jsx): `frontend/src/components/Messages/MessagesList.jsx`
- [Message item](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessageItem.jsx): `frontend/src/components/Messages/MessageItem.jsx`
- [Message composer](https://github.com/nofcngway/chat-app/blob/main/frontend/src/components/Messages/MessageForm.jsx): `frontend/src/components/Messages/MessageForm.jsx`
- [Text cleaning](https://github.com/nofcngway/chat-app/blob/main/frontend/src/utils/profanity.js): `frontend/src/utils/profanity.js`

### Client state

- [Auth state](https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/slices/authSlice.js): `frontend/src/store/slices/authSlice.js`
- [Chat state](https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/slices/chatSlice.js): `frontend/src/store/slices/chatSlice.js`
- [Redux store](https://github.com/nofcngway/chat-app/blob/main/frontend/src/store/store.js): `frontend/src/store/store.js`

### Network services

- [Auth API](https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Channel API](https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/channels.js): `frontend/src/api/channels.js`
- [Message API](https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/messages.js): `frontend/src/api/messages.js`
- [REST client](https://github.com/nofcngway/chat-app/blob/main/frontend/src/api/index.js): `frontend/src/api/index.js`
- [Socket client](https://github.com/nofcngway/chat-app/blob/main/frontend/src/socket.js): `frontend/src/socket.js`

### Other components

- **Chat user**
- **Chat backend**

## Connections

- Chat user → App routes: uses (evidence: `README.md`)
- App routes → Login: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Sign up: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Chat page: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Header: renders (evidence: `frontend/src/App.jsx`)
- Login → Auth API: authenticates via (evidence: `frontend/src/pages/LoginPage.jsx`)
- Sign up → Auth API: registers via (evidence: `frontend/src/pages/SignupPage.jsx`)
- Login → Form validation: validates with (evidence: `frontend/src/pages/LoginPage.jsx`)
- Sign up → Form validation: validates with (evidence: `frontend/src/pages/SignupPage.jsx`)
- Login → Auth state: dispatches credentials (evidence: `frontend/src/pages/LoginPage.jsx`)
- Sign up → Auth state: dispatches credentials (evidence: `frontend/src/pages/SignupPage.jsx`)
- Redux store → Auth state: registers reducer (evidence: `frontend/src/store/store.js`)
- Redux store → Chat state: registers reducer (evidence: `frontend/src/store/store.js`)
- Chat page → Auth state: checks access (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Channel API: loads channels (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Message API: loads messages (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Chat state: dispatches chat data (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Socket client: connects and listens (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Channel list: renders (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Message list: renders (evidence: `frontend/src/pages/MainPage.jsx`)
- Chat page → Message composer: renders (evidence: `frontend/src/pages/MainPage.jsx`)
- Channel list → Chat state: reads channels (evidence: `frontend/src/components/Channels/ChannelsList.jsx`)
- Channel list → Channel item: renders (evidence: `frontend/src/components/Channels/ChannelsList.jsx`)
- Channel list → Add channel: opens (evidence: `frontend/src/components/Channels/ChannelsList.jsx`)
- Channel list → Rename channel: opens (evidence: `frontend/src/components/Channels/ChannelsList.jsx`)
- Channel list → Remove channel: opens (evidence: `frontend/src/components/Channels/ChannelsList.jsx`)
- Add channel → Channel API: creates channel (evidence: `frontend/src/components/Modals/AddChannelModal.jsx`)
- Add channel → Chat state: updates state (evidence: `frontend/src/components/Modals/AddChannelModal.jsx`)
- Add channel → Form validation: validates with (evidence: `frontend/src/components/Modals/AddChannelModal.jsx`)
- Add channel → Text cleaning: cleans text (evidence: `frontend/src/components/Modals/AddChannelModal.jsx`)
- Rename channel → Channel API: renames channel (evidence: `frontend/src/components/Modals/EditChannelModal.jsx`)
- Rename channel → Chat state: updates state (evidence: `frontend/src/components/Modals/EditChannelModal.jsx`)
- Rename channel → Form validation: validates with (evidence: `frontend/src/components/Modals/EditChannelModal.jsx`)
- Rename channel → Text cleaning: cleans text (evidence: `frontend/src/components/Modals/EditChannelModal.jsx`)
- Remove channel → Channel API: deletes channel (evidence: `frontend/src/components/Modals/RemoveChannelModal.jsx`)
- Remove channel → Chat state: updates state (evidence: `frontend/src/components/Modals/RemoveChannelModal.jsx`)
- Message list → Message item: renders (evidence: `frontend/src/components/Messages/MessagesList.jsx`)
- Message composer → Message API: sends message (evidence: `frontend/src/components/Messages/MessageForm.jsx`)
- Message composer → Text cleaning: cleans text (evidence: `frontend/src/components/Messages/MessageForm.jsx`)
- Auth API → REST client: uses client (evidence: `frontend/src/api/auth.js`)
- Channel API → REST client: uses client (evidence: `frontend/src/api/channels.js`)
- Message API → REST client: uses client (evidence: `frontend/src/api/messages.js`)
- REST client → Chat backend: sends REST requests
- Socket client → Chat backend: exchanges events
