# harshpatel2414/chat-assist architecture

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

- Interactive diagram: https://gitdiagram.com/harshpatel2414/chat-assist
- Repository: https://github.com/harshpatel2414/chat-assist

## Overview

This is a Next.js assistance-chat application with Google sign-in, an admin chat workspace, and a user-facing support assistant. The main workflow is sign-in and role-based routing, then chat selection and live conversation; messages can include uploaded images or videos. The tree and sampled code show Firebase Auth, Firestore, and Storage integrations, plus message translation. ChatContext and several chat components are present but their implementations were not sampled, so uncertain wiring between them is omitted.

Main entry points: [`src/firebase/chat.js`](https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/chat.js) (Chat service), [`src/components/chat/ChatContainer.jsx`](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatContainer.jsx) (Conversation view), [`src/components/chat/ChatInput.jsx`](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatInput.jsx) (Message composer), [`src/app/page.js`](https://github.com/harshpatel2414/chat-assist/blob/master/src/app/page.js) (Sign-in page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and routing"]
  node_login["Sign-in page<br/>[page.js]"]
  node_authctx["Auth context<br/>[AuthContext.js]"]
  node_support["Support page<br/>[page.jsx]"]
  node_adminroute["Admin chat route<br/>[page.jsx]"]
end

subgraph group_workspace["Admin workspace"]
  node_adminlayout["Chat layout<br/>[layout.jsx]"]
  node_sidebar["Chat sidebar<br/>[Sidebar.jsx]"]
  node_search["User search<br/>[Searchbar.jsx]"]
  node_chatlist["Chat list<br/>[Chats.jsx]"]
  node_profile["Chat profile<br/>[Profile.jsx]"]
  node_tagmodal["Chat tagging<br/>[TagModal.jsx]"]
end

subgraph group_messaging["Chat and messaging"]
  node_assistant["Support assistant<br/>[Assistant.jsx]"]
  node_assistantmsg["Assistant message"]
  node_chatcontainer["Conversation view<br/>[ChatContainer.jsx]"]
  node_chatinput["Message composer<br/>[ChatInput.jsx]"]
  node_chatcontext["Chat state<br/>[ChatContext.js]"]
end

subgraph group_services["Firebase services"]
  node_firebaseauth[("Firebase Auth")]
  node_chatservice["Chat service<br/>[chat.js]"]
  node_firestore[("Cloud Firestore<br/>[firebaseConfig.js]")]
  node_storage[("Firebase Storage<br/>[firebaseConfig.js]")]
end

node_visitor(("User"))
node_translator["Translation API"]

node_visitor -->|"signs in"| node_login
node_login -->|"Google sign-in"| node_firebaseauth
node_firebaseauth -->|"auth state"| node_authctx
node_authctx -->|"routes admin"| node_adminroute
node_authctx -->|"routes user"| node_support
node_login -->|"creates or updates user"| node_firestore
node_support -->|"opens assistant"| node_assistant
node_assistantmsg -.->|"requests translation"| node_translator
node_adminlayout -->|"renders"| node_sidebar
node_sidebar -->|"renders"| node_search
node_search -->|"searches users"| node_firestore
node_search -->|"adds selected user"| node_chatservice
node_sidebar -->|"renders"| node_chatlist
node_adminroute -->|"renders conversation"| node_chatcontainer
node_chatcontainer -->|"uses chat state"| node_chatcontext
node_chatinput -->|"reads selected chat"| node_chatcontext
node_chatinput -->|"sends messages"| node_chatservice
node_chatinput -->|"uploads media"| node_chatservice
node_chatservice -->|"reads and writes chats"| node_firestore
node_chatservice -->|"uploads media"| node_storage
node_chatcontainer -->|"shows profile"| node_profile
node_chatcontainer -->|"opens tagging"| node_tagmodal

click node_login "https://github.com/harshpatel2414/chat-assist/blob/master/src/app/page.js"
click node_authctx "https://github.com/harshpatel2414/chat-assist/blob/master/src/context/AuthContext.js"
click node_support "https://github.com/harshpatel2414/chat-assist/blob/master/src/app/support/page.jsx"
click node_adminroute "https://github.com/harshpatel2414/chat-assist/blob/master/src/app/admin/chat/page.jsx"
click node_assistant "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/assistant/Assistant.jsx"
click node_assistantmsg "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/assistant/AssistantMessage.jsx"
click node_adminlayout "https://github.com/harshpatel2414/chat-assist/blob/master/src/app/admin/chat/layout.jsx"
click node_sidebar "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Sidebar.jsx"
click node_search "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Searchbar.jsx"
click node_chatlist "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Chats.jsx"
click node_chatcontainer "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatContainer.jsx"
click node_chatinput "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatInput.jsx"
click node_profile "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/Profile.jsx"
click node_tagmodal "https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/TagModal.jsx"
click node_chatcontext "https://github.com/harshpatel2414/chat-assist/blob/master/src/context/ChatContext.js"
click node_chatservice "https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/chat.js"
click node_firestore "https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/firebaseConfig.js"
click node_storage "https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/firebaseConfig.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_login,node_authctx,node_support,node_adminroute,node_visitor toneBlue
class node_adminlayout,node_sidebar,node_search,node_chatlist,node_profile,node_tagmodal toneAmber
class node_assistant,node_assistantmsg,node_chatcontainer,node_chatinput,node_chatcontext,node_translator toneMint
class node_firebaseauth,node_chatservice,node_firestore,node_storage toneRose
```

## Components

### Identity and routing

- [Sign-in page](https://github.com/harshpatel2414/chat-assist/blob/master/src/app/page.js): `src/app/page.js`
- [Auth context](https://github.com/harshpatel2414/chat-assist/blob/master/src/context/AuthContext.js): `src/context/AuthContext.js`
- [Support page](https://github.com/harshpatel2414/chat-assist/blob/master/src/app/support/page.jsx): `src/app/support/page.jsx`
- [Admin chat route](https://github.com/harshpatel2414/chat-assist/blob/master/src/app/admin/chat/page.jsx): `src/app/admin/chat/page.jsx`

### Admin workspace

- [Chat layout](https://github.com/harshpatel2414/chat-assist/blob/master/src/app/admin/chat/layout.jsx): `src/app/admin/chat/layout.jsx`
- [Chat sidebar](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Sidebar.jsx): `src/components/sidebar/Sidebar.jsx`
- [User search](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Searchbar.jsx): `src/components/sidebar/Searchbar.jsx`
- [Chat list](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/sidebar/Chats.jsx): `src/components/sidebar/Chats.jsx`
- [Chat profile](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/Profile.jsx): `src/components/chat/Profile.jsx`
- [Chat tagging](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/TagModal.jsx): `src/components/chat/TagModal.jsx`

### Chat and messaging

- [Support assistant](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/assistant/Assistant.jsx): `src/components/assistant/Assistant.jsx`
- [Assistant message](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/assistant/AssistantMessage.jsx): `src/components/assistant/AssistantMessage.jsx`
- [Conversation view](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatContainer.jsx): `src/components/chat/ChatContainer.jsx`
- [Message composer](https://github.com/harshpatel2414/chat-assist/blob/master/src/components/chat/ChatInput.jsx): `src/components/chat/ChatInput.jsx`
- [Chat state](https://github.com/harshpatel2414/chat-assist/blob/master/src/context/ChatContext.js): `src/context/ChatContext.js`

### Firebase services

- **Firebase Auth**
- [Chat service](https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/chat.js): `src/firebase/chat.js`
- [Cloud Firestore](https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/firebaseConfig.js): `src/firebase/firebaseConfig.js`
- [Firebase Storage](https://github.com/harshpatel2414/chat-assist/blob/master/src/firebase/firebaseConfig.js): `src/firebase/firebaseConfig.js`

### Other components

- **User**
- **Translation API**

## Connections

- User → Sign-in page: signs in
- Sign-in page → Firebase Auth: Google sign-in
- Firebase Auth → Auth context: auth state
- Auth context → Admin chat route: routes admin
- Auth context → Support page: routes user
- Sign-in page → Cloud Firestore: creates or updates user
- Support page → Support assistant: opens assistant
- Assistant message → Translation API: requests translation
- Chat layout → Chat sidebar: renders
- Chat sidebar → User search: renders
- User search → Cloud Firestore: searches users
- User search → Chat service: adds selected user
- Chat sidebar → Chat list: renders
- Admin chat route → Conversation view: renders conversation
- Conversation view → Chat state: uses chat state
- Message composer → Chat state: reads selected chat
- Message composer → Chat service: sends messages
- Message composer → Chat service: uploads media
- Chat service → Cloud Firestore: reads and writes chats
- Chat service → Firebase Storage: uploads media
- Conversation view → Chat profile: shows profile
- Conversation view → Chat tagging: opens tagging
