# ananyapt2005/chatapp architecture

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

- Interactive diagram: https://gitdiagram.com/ananyapt2005/chatapp
- Repository: https://github.com/ananyapt2005/chatapp

## Overview

Connect is a browser-based direct and group chat application. Users restore or create a session, browse people and conversations, open or create a chat, load message history, and exchange live messages over a WebSocket. The frontend also exposes authenticated HTTP operations for users, conversations, and messages. Backend controllers, services, persistence, and Redis/WebSocket components are represented from the repository tree, but their internal wiring is not shown in the supplied excerpts; those relationships are therefore omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/App.jsx) (Application shell), [`frontend/src/hooks/useChat.js`](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/hooks/useChat.js) (Chat state), [`frontend/src/api/client.js`](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/client.js) (HTTP client), [`frontend/src/components/Sidebar.jsx`](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/Sidebar.jsx) (Conversation sidebar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Chat interface"]
  node_app["Application shell<br/>[App.jsx]"]
  node_authscreen["Authentication screen<br/>[AuthScreen.jsx]"]
  node_sidebar["Conversation sidebar<br/>[Sidebar.jsx]"]
  node_groupform["Group creation form"]
  node_chatwindow["Chat window<br/>[ChatWindow.jsx]"]
end

subgraph group_frontend["Frontend state and API"]
  node_authhook["Authentication state<br/>[useAuth.js]"]
  node_chathook["Chat state<br/>[useChat.js]"]
  node_authapi["Authentication API<br/>[auth.js]"]
  node_conversationapi["Conversation API<br/>[conversations.js]"]
  node_messageapi["Message history API<br/>[messages.js]"]
  node_usersapi["User directory API<br/>[users.js]"]
  node_httpclient["HTTP client<br/>[client.js]"]
end

subgraph group_server["Backend application"]
  node_authcontroller["Authentication endpoints"]
  node_conversationcontroller["Conversation endpoints"]
  node_messagecontroller["Message endpoints"]
  node_usercontroller["User endpoints"]
  node_authservice["Authentication service<br/>[AuthService.java]"]
  node_conversationservice["Conversation service"]
  node_messageservice["Message service"]
end

subgraph group_realtime["Persistence and realtime"]
  node_websockethandler["WebSocket handler"]
  node_redispublisher["Redis chat publisher"]
  node_redissubscriber["Redis chat subscriber"]
  node_userstore[("User repository")]
  node_conversationstore[("Conversation repositories")]
  node_messagestore[("Message repository")]
end

node_user(("Chat user"))

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_authhook
node_app -->|"initializes"| node_chathook
node_app -->|"renders"| node_authscreen
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_chatwindow
node_sidebar -->|"renders"| node_groupform
node_authhook -->|"calls"| node_authapi
node_chathook -->|"loads users"| node_usersapi
node_chathook -->|"loads conversations"| node_conversationapi
node_chathook -->|"loads history"| node_messageapi
node_authapi -->|"requests"| node_httpclient
node_conversationapi -->|"requests"| node_httpclient
node_messageapi -->|"requests"| node_httpclient
node_usersapi -->|"requests"| node_httpclient

click node_app "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/App.jsx"
click node_authscreen "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/AuthScreen.jsx"
click node_sidebar "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/Sidebar.jsx"
click node_groupform "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/GroupCreateForm.jsx"
click node_chatwindow "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/ChatWindow.jsx"
click node_authhook "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/hooks/useAuth.js"
click node_chathook "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/hooks/useChat.js"
click node_authapi "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/auth.js"
click node_conversationapi "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/conversations.js"
click node_messageapi "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/messages.js"
click node_usersapi "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/users.js"
click node_httpclient "https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/client.js"
click node_authcontroller "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/AuthController.java"
click node_conversationcontroller "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/ConversationController.java"
click node_messagecontroller "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/ChatMessageController.java"
click node_usercontroller "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/UserController.java"
click node_authservice "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/AuthService.java"
click node_conversationservice "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ConversationService.java"
click node_messageservice "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ChatMessageService.java"
click node_websockethandler "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ChatWebSocketHandler.java"
click node_redispublisher "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/RedisChatPublisher.java"
click node_redissubscriber "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/RedisChatSubscriber.java"
click node_userstore "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/UserRepository.java"
click node_conversationstore "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/ConversationRepository.java"
click node_messagestore "https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/ChatMessageRepository.java"

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_authscreen,node_sidebar,node_groupform,node_chatwindow,node_user toneBlue
class node_authhook,node_chathook,node_authapi,node_conversationapi,node_messageapi,node_usersapi,node_httpclient toneAmber
class node_authcontroller,node_conversationcontroller,node_messagecontroller,node_usercontroller,node_authservice,node_conversationservice,node_messageservice toneMint
class node_websockethandler,node_redispublisher,node_redissubscriber,node_userstore,node_conversationstore,node_messagestore toneRose
```

## Components

### Chat interface

- [Application shell](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication screen](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/AuthScreen.jsx): `frontend/src/components/AuthScreen.jsx`
- [Conversation sidebar](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Group creation form](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/GroupCreateForm.jsx): `frontend/src/components/GroupCreateForm.jsx`
- [Chat window](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/components/ChatWindow.jsx): `frontend/src/components/ChatWindow.jsx`

### Frontend state and API

- [Authentication state](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Chat state](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/hooks/useChat.js): `frontend/src/hooks/useChat.js`
- [Authentication API](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Conversation API](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/conversations.js): `frontend/src/api/conversations.js`
- [Message history API](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/messages.js): `frontend/src/api/messages.js`
- [User directory API](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/users.js): `frontend/src/api/users.js`
- [HTTP client](https://github.com/ananyapt2005/chatapp/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### Backend application

- [Authentication endpoints](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/AuthController.java): `src/main/java/com/example/chatApp/controller/AuthController.java`
- [Conversation endpoints](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/ConversationController.java): `src/main/java/com/example/chatApp/controller/ConversationController.java`
- [Message endpoints](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/ChatMessageController.java): `src/main/java/com/example/chatApp/controller/ChatMessageController.java`
- [User endpoints](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/controller/UserController.java): `src/main/java/com/example/chatApp/controller/UserController.java`
- [Authentication service](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/AuthService.java): `src/main/java/com/example/chatApp/service/AuthService.java`
- [Conversation service](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ConversationService.java): `src/main/java/com/example/chatApp/service/ConversationService.java`
- [Message service](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ChatMessageService.java): `src/main/java/com/example/chatApp/service/ChatMessageService.java`

### Persistence and realtime

- [WebSocket handler](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/ChatWebSocketHandler.java): `src/main/java/com/example/chatApp/service/ChatWebSocketHandler.java`
- [Redis chat publisher](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/RedisChatPublisher.java): `src/main/java/com/example/chatApp/service/RedisChatPublisher.java`
- [Redis chat subscriber](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/service/RedisChatSubscriber.java): `src/main/java/com/example/chatApp/service/RedisChatSubscriber.java`
- [User repository](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/UserRepository.java): `src/main/java/com/example/chatApp/repository/UserRepository.java`
- [Conversation repositories](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/ConversationRepository.java): `src/main/java/com/example/chatApp/repository/ConversationRepository.java`
- [Message repository](https://github.com/ananyapt2005/chatapp/blob/main/src/main/java/com/example/chatApp/repository/ChatMessageRepository.java): `src/main/java/com/example/chatApp/repository/ChatMessageRepository.java`

### Other components

- **Chat user**

## Connections

- Chat user → Application shell: uses
- Application shell → Authentication state: initializes (evidence: `frontend/src/App.jsx`)
- Application shell → Chat state: initializes (evidence: `frontend/src/App.jsx`)
- Application shell → Authentication screen: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Conversation sidebar: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Chat window: renders (evidence: `frontend/src/App.jsx`)
- Conversation sidebar → Group creation form: renders (evidence: `frontend/src/components/Sidebar.jsx`)
- Authentication state → Authentication API: calls (evidence: `frontend/src/hooks/useAuth.js`)
- Chat state → User directory API: loads users (evidence: `frontend/src/hooks/useChat.js`)
- Chat state → Conversation API: loads conversations (evidence: `frontend/src/hooks/useChat.js`)
- Chat state → Message history API: loads history (evidence: `frontend/src/hooks/useChat.js`)
- Authentication API → HTTP client: requests (evidence: `frontend/src/api/auth.js`)
- Conversation API → HTTP client: requests (evidence: `frontend/src/api/conversations.js`)
- Message history API → HTTP client: requests (evidence: `frontend/src/api/messages.js`)
- User directory API → HTTP client: requests (evidence: `frontend/src/api/users.js`)
