# jomi087/nexora architecture

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

- Interactive diagram: https://gitdiagram.com/jomi087/nexora
- Repository: https://github.com/jomi087/nexora

## Overview

This is a chat application with a React client, NestJS API, persisted conversations, OpenRouter-generated replies, and separate MCP tool servers. The main workflow is user authentication, sending a chat message, loading and summarizing conversation history, obtaining an AI reply (with tool calls when available), and saving the result. The graph preserves the documented date/time and web-search MCP capabilities. Source excerpts show the main chat and date/time paths; MCP-client transport wiring and web-search tool registration details were not sampled, so those connections are shown as unverified or omitted.

Main entry points: [`server/src/modules/chat/chat.service.ts`](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/chat.service.ts) (Conversation service), [`server/src/modules/chat/ai/openrouter.service.ts`](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/ai/openrouter.service.ts) (AI orchestration), [`client/src/App.jsx`](https://github.com/jomi087/nexora/blob/main/client/src/App.jsx) (Page routing), [`client/src/pages/AuthPage.jsx`](https://github.com/jomi087/nexora/blob/main/client/src/pages/AuthPage.jsx) (Auth page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Client entry<br/>[main.jsx]"]
  node_router["Page routing<br/>[App.jsx]"]
  node_authpage["Auth page<br/>[AuthPage.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_authclient["Auth requests<br/>[auth.service.js]"]
  node_chatpage["Chat page<br/>[ChatPage.jsx]"]
  node_chatclient["Chat requests<br/>[chat.service.js]"]
  node_httpclient["HTTP client<br/>[api.js]"]
end

subgraph group_api["Application API"]
  node_authcontroller["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Authentication<br/>[auth.service.ts]"]
  node_authmodels["Auth contracts<br/>[signin.dto.ts]"]
  node_chatcontroller["Chat endpoints<br/>[chat.controller.ts]"]
  node_chatservice["Conversation service<br/>[chat.service.ts]"]
  node_chatmodels["Chat contracts"]
  node_chatstore[("Conversation store")]
  node_messages[("Message records<br/>[message.entity.ts]")]
  node_ai["AI orchestration"]
  node_prompts["AI prompts"]
  node_mcpclient["MCP client"]
end

subgraph group_mcp["MCP tools"]
  node_datetimehost["Date-time MCP host<br/>[server.ts]"]
  node_datetimetool["Date-time tool<br/>[datetime.tool.ts]"]
  node_searchhost["Search MCP host<br/>[index.ts]"]
  node_searchtool["Web-search tool<br/>[web-search.tool.ts]"]
end

subgraph group_providers["External services"]
  node_openrouter{{"OpenRouter"}}
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_router
node_router -->|"routes to"| node_authpage
node_router -->|"routes to"| node_chatpage
node_authpage -->|"uses"| node_authstate
node_authpage -->|"calls"| node_authclient
node_authstate -->|"calls"| node_httpclient
node_authclient -->|"sends requests"| node_httpclient
node_chatpage -.->|"calls"| node_chatclient
node_chatclient -->|"sends requests"| node_httpclient
node_user -.->|"authenticates"| node_authcontroller
node_user -.->|"sends messages"| node_chatcontroller
node_authcontroller -->|"delegates"| node_authservice
node_authservice -->|"reads and writes"| node_chatstore
node_chatcontroller -->|"delegates"| node_chatservice
node_chatservice -->|"reads and writes"| node_chatstore
node_chatservice -->|"reads and writes"| node_messages
node_chatservice -->|"requests replies"| node_ai
node_ai -->|"uses instructions"| node_prompts
node_ai -->|"requests completions"| node_openrouter
node_ai -->|"calls tools"| node_mcpclient
node_mcpclient -.->|"connects over HTTP"| node_datetimehost
node_mcpclient -.->|"connects over HTTP"| node_searchhost
node_datetimehost -->|"registers"| node_datetimetool
node_searchhost -->|"uses tool"| node_searchtool

click node_app "https://github.com/jomi087/nexora/blob/main/client/src/main.jsx"
click node_router "https://github.com/jomi087/nexora/blob/main/client/src/App.jsx"
click node_authpage "https://github.com/jomi087/nexora/blob/main/client/src/pages/AuthPage.jsx"
click node_authstate "https://github.com/jomi087/nexora/blob/main/client/src/context/AuthContext.jsx"
click node_authclient "https://github.com/jomi087/nexora/blob/main/client/src/services/auth.service.js"
click node_chatpage "https://github.com/jomi087/nexora/blob/main/client/src/pages/ChatPage.jsx"
click node_chatclient "https://github.com/jomi087/nexora/blob/main/client/src/services/chat.service.js"
click node_httpclient "https://github.com/jomi087/nexora/blob/main/client/src/services/api.js"
click node_authcontroller "https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/auth.controller.ts"
click node_authservice "https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/auth.service.ts"
click node_authmodels "https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/dto/signin.dto.ts"
click node_chatcontroller "https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/chat.controller.ts"
click node_chatservice "https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/chat.service.ts"
click node_chatmodels "https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/dto/send-message.dto.ts"
click node_chatstore "https://github.com/jomi087/nexora/blob/main/server/src/infrastructure/database/entities/conversation.entity.ts"
click node_messages "https://github.com/jomi087/nexora/blob/main/server/src/infrastructure/database/entities/message.entity.ts"
click node_ai "https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/ai/openrouter.service.ts"
click node_prompts "https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/ai/prompts/system-instruction.ts"
click node_mcpclient "https://github.com/jomi087/nexora/blob/main/server/src/modules/mcp/mcp-client.service.ts"
click node_datetimehost "https://github.com/jomi087/nexora/blob/main/datetime-mcp-server/src/server.ts"
click node_datetimetool "https://github.com/jomi087/nexora/blob/main/datetime-mcp-server/src/tools/datetime.tool.ts"
click node_searchhost "https://github.com/jomi087/nexora/blob/main/web-search-mcp-server/src/index.ts"
click node_searchtool "https://github.com/jomi087/nexora/blob/main/web-search-mcp-server/src/tools/web-search.tool.ts"

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_router,node_authpage,node_authstate,node_authclient,node_chatpage,node_chatclient,node_httpclient,node_user toneBlue
class node_authcontroller,node_authservice,node_authmodels,node_chatcontroller,node_chatservice,node_chatmodels,node_chatstore,node_messages,node_ai,node_prompts,node_mcpclient toneAmber
class node_datetimehost,node_datetimetool,node_searchhost,node_searchtool toneMint
class node_openrouter toneRose
```

## Components

### Web client

- [Client entry](https://github.com/jomi087/nexora/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [Page routing](https://github.com/jomi087/nexora/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth page](https://github.com/jomi087/nexora/blob/main/client/src/pages/AuthPage.jsx): `client/src/pages/AuthPage.jsx`
- [Auth state](https://github.com/jomi087/nexora/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Auth requests](https://github.com/jomi087/nexora/blob/main/client/src/services/auth.service.js): `client/src/services/auth.service.js`
- [Chat page](https://github.com/jomi087/nexora/blob/main/client/src/pages/ChatPage.jsx): `client/src/pages/ChatPage.jsx`
- [Chat requests](https://github.com/jomi087/nexora/blob/main/client/src/services/chat.service.js): `client/src/services/chat.service.js`
- [HTTP client](https://github.com/jomi087/nexora/blob/main/client/src/services/api.js): `client/src/services/api.js`

### Application API

- [Auth endpoints](https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/auth.controller.ts): `server/src/modules/auth/auth.controller.ts`
- [Authentication](https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/auth.service.ts): `server/src/modules/auth/auth.service.ts`
- [Auth contracts](https://github.com/jomi087/nexora/blob/main/server/src/modules/auth/dto/signin.dto.ts): `server/src/modules/auth/dto/signin.dto.ts`
- [Chat endpoints](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/chat.controller.ts): `server/src/modules/chat/chat.controller.ts`
- [Conversation service](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/chat.service.ts): `server/src/modules/chat/chat.service.ts`
- [Chat contracts](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/dto/send-message.dto.ts): `server/src/modules/chat/dto/send-message.dto.ts`
- [Conversation store](https://github.com/jomi087/nexora/blob/main/server/src/infrastructure/database/entities/conversation.entity.ts): `server/src/infrastructure/database/entities/conversation.entity.ts`
- [Message records](https://github.com/jomi087/nexora/blob/main/server/src/infrastructure/database/entities/message.entity.ts): `server/src/infrastructure/database/entities/message.entity.ts`
- [AI orchestration](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/ai/openrouter.service.ts): `server/src/modules/chat/ai/openrouter.service.ts`
- [AI prompts](https://github.com/jomi087/nexora/blob/main/server/src/modules/chat/ai/prompts/system-instruction.ts): `server/src/modules/chat/ai/prompts/system-instruction.ts`
- [MCP client](https://github.com/jomi087/nexora/blob/main/server/src/modules/mcp/mcp-client.service.ts): `server/src/modules/mcp/mcp-client.service.ts`

### MCP tools

- [Date-time MCP host](https://github.com/jomi087/nexora/blob/main/datetime-mcp-server/src/server.ts): `datetime-mcp-server/src/server.ts`
- [Date-time tool](https://github.com/jomi087/nexora/blob/main/datetime-mcp-server/src/tools/datetime.tool.ts): `datetime-mcp-server/src/tools/datetime.tool.ts`
- [Search MCP host](https://github.com/jomi087/nexora/blob/main/web-search-mcp-server/src/index.ts): `web-search-mcp-server/src/index.ts`
- [Web-search tool](https://github.com/jomi087/nexora/blob/main/web-search-mcp-server/src/tools/web-search.tool.ts): `web-search-mcp-server/src/tools/web-search.tool.ts`

### External services

- **OpenRouter**

### Other components

- **User**

## Connections

- User → Client entry: uses (evidence: `client/src/main.jsx`)
- Client entry → Page routing: renders (evidence: `client/src/main.jsx`)
- Page routing → Auth page: routes to (evidence: `client/src/App.jsx`)
- Page routing → Chat page: routes to (evidence: `client/src/App.jsx`)
- Auth page → Auth state: uses (evidence: `client/src/pages/AuthPage.jsx`)
- Auth page → Auth requests: calls (evidence: `client/src/pages/AuthPage.jsx`)
- Auth state → HTTP client: calls (evidence: `client/src/context/AuthContext.jsx`)
- Auth requests → HTTP client: sends requests (evidence: `client/src/services/auth.service.js`)
- Chat page → Chat requests: calls
- Chat requests → HTTP client: sends requests (evidence: `client/src/services/chat.service.js`)
- User → Auth endpoints: authenticates
- User → Chat endpoints: sends messages
- Auth endpoints → Authentication: delegates (evidence: `server/src/modules/auth/auth.controller.ts`)
- Authentication → Conversation store: reads and writes (evidence: `server/src/modules/auth/auth.service.ts`)
- Chat endpoints → Conversation service: delegates (evidence: `server/src/modules/chat/chat.controller.ts`)
- Conversation service → Conversation store: reads and writes (evidence: `server/src/modules/chat/chat.service.ts`)
- Conversation service → Message records: reads and writes (evidence: `server/src/modules/chat/chat.service.ts`)
- Conversation service → AI orchestration: requests replies (evidence: `server/src/modules/chat/chat.service.ts`)
- AI orchestration → AI prompts: uses instructions (evidence: `server/src/modules/chat/ai/openrouter.service.ts`)
- AI orchestration → OpenRouter: requests completions (evidence: `server/src/modules/chat/ai/openrouter.service.ts`)
- AI orchestration → MCP client: calls tools (evidence: `server/src/modules/chat/ai/openrouter.service.ts`)
- MCP client → Date-time MCP host: connects over HTTP
- MCP client → Search MCP host: connects over HTTP
- Date-time MCP host → Date-time tool: registers (evidence: `datetime-mcp-server/src/server.ts`)
- Search MCP host → Web-search tool: uses tool (evidence: `web-search-mcp-server/src/index.ts`)
