# rohit0265/covo-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/rohit0265/covo-ai-assistant
- Repository: https://github.com/rohit0265/covo-ai-assistant

## Overview

Covo AI is a multi-model assistant with a React chat interface backed by an Express gateway and separate authentication, conversation, agent, and billing services. A user signs in, works with conversations, submits prompts for routed agent responses, and can purchase credits. The README documents the gateway-to-service architecture; sampled controller and UI excerpts show key calls and persistence. Several feature implementations were not sampled, so their internal relationships are shown only where documented or evidenced by the source index.

Main entry points: [`backend/gateway/index.js`](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/gateway/index.js) (API gateway), [`frontend/src/pages/Home.jsx`](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/pages/Home.jsx) (Home and login), [`backend/services/auth/controllers/auth.controllers.js`](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/auth/controllers/auth.controllers.js) (Authentication), [`backend/services/billing/controllers/billing.controller.js`](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/billing/controllers/billing.controller.js) (Billing service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat interface"]
  node_home["Home and login<br/>[Home.jsx]"]
  node_chatui["Chat interface<br/>[chatArea.jsx]"]
  node_sidebar["Conversation sidebar<br/>[sideBar.jsx]"]
  node_artifacts["Artifact viewer<br/>[artifacts.jsx]"]
  node_clientstate["User state<br/>[userSlice.js]"]
end

subgraph group_gateway["API gateway"]
  node_gatewayapi["API gateway<br/>[index.js]"]
  node_sessionguard["Session guard<br/>[auth.middleware.js]"]
end

subgraph group_identity["Identity and sessions"]
  node_redis[("Session cache<br/>[redis.js]")]
  node_auth["Authentication"]
  node_users[("User records<br/>[users.model.js]")]
end

subgraph group_assistant["AI and conversations"]
  node_chatservice["Conversation service<br/>[chat.controller.js]"]
  node_conversations[("Conversation records")]
  node_messages[("Message records<br/>[message.model.js]")]
  node_agentapi["Agent endpoint"]
  node_workflow["LangGraph workflow<br/>[graph.js]"]
  node_router["Intent router<br/>[router.js]"]
  node_workers["Agent capabilities"]
end

subgraph group_commerce["Billing"]
  node_billing["Billing service"]
  node_payments[("Payment records<br/>[payment.models.js]")]
end

node_user(("User"))
node_firebase["Firebase Auth"]
node_llms["LLM providers"]
node_razorpay["Razorpay"]

node_user -->|"uses"| node_home
node_home -->|"renders"| node_chatui
node_home -->|"renders"| node_sidebar
node_home -->|"renders"| node_artifacts
node_home -->|"authenticates via"| node_gatewayapi
node_home -->|"updates"| node_clientstate
node_chatui -->|"requests chat"| node_gatewayapi
node_chatui -->|"updates artifacts"| node_artifacts
node_gatewayapi -->|"checks sessions"| node_sessionguard
node_sessionguard -->|"reads session"| node_redis
node_gatewayapi -->|"proxies auth"| node_auth
node_gatewayapi -->|"proxies chat"| node_chatservice
node_gatewayapi -->|"proxies agent"| node_agentapi
node_gatewayapi -->|"proxies billing"| node_billing
node_auth -->|"verifies token"| node_firebase
node_auth -->|"reads and writes"| node_users
node_auth -->|"stores session"| node_redis
node_chatservice -->|"reads and writes"| node_conversations
node_chatservice -->|"reads and writes"| node_messages
node_agentapi -->|"saves messages"| node_chatservice
node_agentapi -->|"invokes graph"| node_workflow
node_workflow -->|"routes intent"| node_router
node_workflow -->|"dispatches agents"| node_workers
node_router -->|"classifies prompt"| node_llms
node_billing -->|"creates orders"| node_razorpay
node_billing -->|"records payment"| node_payments
node_billing -->|"updates account"| node_auth

click node_home "https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/pages/Home.jsx"
click node_chatui "https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/chatArea.jsx"
click node_sidebar "https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/sideBar.jsx"
click node_artifacts "https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/artifacts.jsx"
click node_clientstate "https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/redux/userSlice.js"
click node_gatewayapi "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/gateway/index.js"
click node_sessionguard "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/gateway/middleware/auth.middleware.js"
click node_redis "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/shared/redis/redis.js"
click node_auth "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/auth/controllers/auth.controllers.js"
click node_users "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/auth/models/users.model.js"
click node_chatservice "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/controllers/chat.controller.js"
click node_conversations "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/model/conversation.models.js"
click node_messages "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/model/message.model.js"
click node_agentapi "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/controllers/agent.controller.js"
click node_workflow "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/graph/graph.js"
click node_router "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/graph/router.js"
click node_workers "https://github.com/rohit0265/covo-ai-assistant/tree/main/backend/services/agent/agents"
click node_billing "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/billing/controllers/billing.controller.js"
click node_payments "https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/billing/models/payment.models.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_home,node_chatui,node_sidebar,node_artifacts,node_clientstate,node_user toneBlue
class node_gatewayapi,node_sessionguard toneAmber
class node_redis,node_auth,node_users toneMint
class node_chatservice,node_conversations,node_messages,node_agentapi,node_workflow,node_router,node_workers toneRose
class node_billing,node_payments,node_firebase,node_llms,node_razorpay toneIndigo
```

## Components

### Chat interface

- [Home and login](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Chat interface](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/chatArea.jsx): `frontend/src/components/chatArea.jsx`
- [Conversation sidebar](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/sideBar.jsx): `frontend/src/components/sideBar.jsx`
- [Artifact viewer](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/components/artifacts.jsx): `frontend/src/components/artifacts.jsx`
- [User state](https://github.com/rohit0265/covo-ai-assistant/blob/main/frontend/src/redux/userSlice.js): `frontend/src/redux/userSlice.js`

### API gateway

- [API gateway](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/gateway/index.js): `backend/gateway/index.js`
- [Session guard](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/gateway/middleware/auth.middleware.js): `backend/gateway/middleware/auth.middleware.js`

### Identity and sessions

- [Session cache](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/shared/redis/redis.js): `backend/shared/redis/redis.js`
- [Authentication](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/auth/controllers/auth.controllers.js): `backend/services/auth/controllers/auth.controllers.js`
- [User records](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/auth/models/users.model.js): `backend/services/auth/models/users.model.js`

### AI and conversations

- [Conversation service](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/controllers/chat.controller.js): `backend/services/chat/controllers/chat.controller.js`
- [Conversation records](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/model/conversation.models.js): `backend/services/chat/model/conversation.models.js`
- [Message records](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/chat/model/message.model.js): `backend/services/chat/model/message.model.js`
- [Agent endpoint](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/controllers/agent.controller.js): `backend/services/agent/controllers/agent.controller.js`
- [LangGraph workflow](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/graph/graph.js): `backend/services/agent/graph/graph.js`
- [Intent router](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/agent/graph/router.js): `backend/services/agent/graph/router.js`
- [Agent capabilities](https://github.com/rohit0265/covo-ai-assistant/tree/main/backend/services/agent/agents): `backend/services/agent/agents`

### Billing

- [Billing service](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/billing/controllers/billing.controller.js): `backend/services/billing/controllers/billing.controller.js`
- [Payment records](https://github.com/rohit0265/covo-ai-assistant/blob/main/backend/services/billing/models/payment.models.js): `backend/services/billing/models/payment.models.js`

### Other components

- **User**
- **Firebase Auth**
- **LLM providers**
- **Razorpay**

## Connections

- User → Home and login: uses (evidence: `README.md`)
- Home and login → Chat interface: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home and login → Conversation sidebar: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home and login → Artifact viewer: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home and login → API gateway: authenticates via (evidence: `frontend/src/pages/Home.jsx`)
- Home and login → User state: updates (evidence: `frontend/src/pages/Home.jsx`)
- Chat interface → API gateway: requests chat (evidence: `frontend/src/components/chatArea.jsx`)
- Chat interface → Artifact viewer: updates artifacts (evidence: `frontend/src/components/chatArea.jsx`)
- API gateway → Session guard: checks sessions (evidence: `README.md`)
- Session guard → Session cache: reads session (evidence: `backend/gateway/middleware/auth.middleware.js`)
- API gateway → Authentication: proxies auth (evidence: `README.md`)
- API gateway → Conversation service: proxies chat (evidence: `README.md`)
- API gateway → Agent endpoint: proxies agent (evidence: `README.md`)
- API gateway → Billing service: proxies billing (evidence: `README.md`)
- Authentication → Firebase Auth: verifies token (evidence: `backend/services/auth/controllers/auth.controllers.js`)
- Authentication → User records: reads and writes (evidence: `backend/services/auth/controllers/auth.controllers.js`)
- Authentication → Session cache: stores session (evidence: `backend/services/auth/controllers/auth.controllers.js`)
- Conversation service → Conversation records: reads and writes (evidence: `backend/services/chat/controllers/chat.controller.js`)
- Conversation service → Message records: reads and writes (evidence: `backend/services/chat/controllers/chat.controller.js`)
- Agent endpoint → Conversation service: saves messages (evidence: `backend/services/agent/controllers/agent.controller.js`)
- Agent endpoint → LangGraph workflow: invokes graph (evidence: `backend/services/agent/controllers/agent.controller.js`)
- LangGraph workflow → Intent router: routes intent (evidence: `backend/services/agent/graph/graph.js`)
- LangGraph workflow → Agent capabilities: dispatches agents (evidence: `backend/services/agent/graph/graph.js`)
- Intent router → LLM providers: classifies prompt (evidence: `backend/services/agent/graph/router.js`)
- Billing service → Razorpay: creates orders (evidence: `backend/services/billing/controllers/billing.controller.js`)
- Billing service → Payment records: records payment (evidence: `backend/services/billing/controllers/billing.controller.js`)
- Billing service → Authentication: updates account (evidence: `backend/services/billing/controllers/billing.controller.js`)
