# myassistantapps/myassistant-backend architecture

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

- Interactive diagram: https://gitdiagram.com/myassistantapps/myassistant-backend
- Repository: https://github.com/myassistantapps/myassistant-backend

## Overview

MYASSISTANT is a voice-first personal assistant backend: the app sends authenticated chat or voice turns, Hari interprets them, selects capabilities, and returns spoken or streamed results while recording consequential actions. Separate product branches handle real-world errands, inbound and outbound calls, knowledge retrieval, meetings, payments, Google services, and avatar sessions. The README documents several capabilities whose implementation was not sampled; those appear as subsystem nodes without speculative internal wiring. Edges are limited to shown imports/calls or README-described relationships.

Main entry points: [`src/agents/runtime.js`](https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/runtime.js) (Agent runtime), [`src/db.js`](https://github.com/myassistantapps/myassistant-backend/blob/main/src/db.js) (PostgreSQL data), [`src/assistant/routes.js`](https://github.com/myassistantapps/myassistant-backend/blob/main/src/assistant/routes.js) (Realtime voice loop), [`src/server.js`](https://github.com/myassistantapps/myassistant-backend/blob/main/src/server.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and conversation"]
  node_api["Express API<br/>[server.js]"]
  node_voice["Realtime voice loop<br/>[routes.js]"]
  node_chat["Chat and intents<br/>[chat.js]"]
end

subgraph group_agent["Agent execution"]
  node_runtime["Agent runtime<br/>[runtime.js]"]
  node_registry["Tool registry<br/>[registry.js]"]
  node_ai["Gemini services<br/>[router.js]"]
end

subgraph group_capabilities["Assistant capabilities"]
  node_knowledge["Knowledge retrieval<br/>[engine.js]"]
  node_fulfillment["Errand fulfillment<br/>[service.js]"]
  node_meetings["Meeting negotiation<br/>[service.js]"]
  node_travel["Flight fares<br/>[fares.js]"]
  node_interpreter["Interpreter mode<br/>[mode.js]"]
  node_reminders["Reminders<br/>[routes.js]"]
end

subgraph group_integrations["External integrations"]
  node_agentcalls["Outbound agent calls<br/>[agentCall.js]"]
  node_inbound["Inbound call screening<br/>[receptionist.js]"]
  node_mcp["MCP integrations<br/>[manager.js]"]
  node_google["Google services<br/>[routes.js]"]
  node_payments["Payment collection<br/>[service.js]"]
  node_avatar["Avatar sessions<br/>[session.js]"]
end

subgraph group_state["User state and records"]
  node_context["User context<br/>[context.js]"]
  node_memory["Personal memory<br/>[memory.js]"]
  node_actions[("Executed actions<br/>[store.js]")]
  node_audit[("Action audit<br/>[log.js]")]
  node_database[("PostgreSQL data<br/>[db.js]")]
end

node_app(("MYASSISTANT app"))

node_app -->|"sends requests"| node_api
node_api -->|"mounts routes"| node_voice
node_app -->|"streams voice turns"| node_voice
node_voice -->|"runs turns"| node_runtime
node_voice -->|"uses intents"| node_chat
node_runtime -->|"selects tools"| node_registry
node_runtime -->|"requests generation"| node_ai
node_runtime -->|"loads context"| node_context
node_runtime -->|"uses memory"| node_memory
node_runtime -->|"records execution"| node_actions
node_registry -.->|"accepts user tools"| node_mcp
node_fulfillment -->|"places calls"| node_agentcalls
node_fulfillment -->|"stores errands"| node_database
node_inbound -->|"receives webhooks"| node_api
node_meetings -->|"analyzes transcripts"| node_ai
node_google -->|"serves endpoints"| node_api
node_payments -->|"stores payment state"| node_database
node_avatar -->|"provides sessions"| node_app
node_knowledge -->|"loads entries"| node_database
node_memory -.->|"persists memories"| node_database
node_audit -->|"writes audit log"| node_database
node_reminders -.->|"stores reminders"| node_database
node_travel -.->|"offers fare search"| node_app
node_interpreter -.->|"translates speech"| node_app

click node_api "https://github.com/myassistantapps/myassistant-backend/blob/main/src/server.js"
click node_voice "https://github.com/myassistantapps/myassistant-backend/blob/main/src/assistant/routes.js"
click node_chat "https://github.com/myassistantapps/myassistant-backend/blob/main/src/routes/chat.js"
click node_runtime "https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/runtime.js"
click node_registry "https://github.com/myassistantapps/myassistant-backend/blob/main/src/tools/registry.js"
click node_ai "https://github.com/myassistantapps/myassistant-backend/blob/main/src/services/ai/router.js"
click node_context "https://github.com/myassistantapps/myassistant-backend/blob/main/src/users/context.js"
click node_memory "https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/memory.js"
click node_actions "https://github.com/myassistantapps/myassistant-backend/blob/main/src/actions/store.js"
click node_audit "https://github.com/myassistantapps/myassistant-backend/blob/main/src/audit/log.js"
click node_database "https://github.com/myassistantapps/myassistant-backend/blob/main/src/db.js"
click node_knowledge "https://github.com/myassistantapps/myassistant-backend/blob/main/src/knowledge/engine.js"
click node_fulfillment "https://github.com/myassistantapps/myassistant-backend/blob/main/src/fulfillment/service.js"
click node_agentcalls "https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/agentCall.js"
click node_inbound "https://github.com/myassistantapps/myassistant-backend/blob/main/src/inbound/receptionist.js"
click node_mcp "https://github.com/myassistantapps/myassistant-backend/blob/main/src/mcp/manager.js"
click node_google "https://github.com/myassistantapps/myassistant-backend/blob/main/src/google/routes.js"
click node_meetings "https://github.com/myassistantapps/myassistant-backend/blob/main/src/meetings/service.js"
click node_payments "https://github.com/myassistantapps/myassistant-backend/blob/main/src/payments/service.js"
click node_avatar "https://github.com/myassistantapps/myassistant-backend/blob/main/src/avatar/session.js"
click node_travel "https://github.com/myassistantapps/myassistant-backend/blob/main/src/travel/fares.js"
click node_interpreter "https://github.com/myassistantapps/myassistant-backend/blob/main/src/interpreter/mode.js"
click node_reminders "https://github.com/myassistantapps/myassistant-backend/blob/main/src/reminders/routes.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_api,node_voice,node_chat toneBlue
class node_runtime,node_registry,node_ai toneAmber
class node_knowledge,node_fulfillment,node_meetings,node_travel,node_interpreter,node_reminders toneMint
class node_agentcalls,node_inbound,node_mcp,node_google,node_payments,node_avatar toneRose
class node_context,node_memory,node_actions,node_audit,node_database,node_app toneIndigo
```

## Components

### API and conversation

- [Express API](https://github.com/myassistantapps/myassistant-backend/blob/main/src/server.js): `src/server.js`
- [Realtime voice loop](https://github.com/myassistantapps/myassistant-backend/blob/main/src/assistant/routes.js): `src/assistant/routes.js`
- [Chat and intents](https://github.com/myassistantapps/myassistant-backend/blob/main/src/routes/chat.js): `src/routes/chat.js`

### Agent execution

- [Agent runtime](https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/runtime.js): `src/agents/runtime.js`
- [Tool registry](https://github.com/myassistantapps/myassistant-backend/blob/main/src/tools/registry.js): `src/tools/registry.js`
- [Gemini services](https://github.com/myassistantapps/myassistant-backend/blob/main/src/services/ai/router.js): `src/services/ai/router.js`

### Assistant capabilities

- [Knowledge retrieval](https://github.com/myassistantapps/myassistant-backend/blob/main/src/knowledge/engine.js): `src/knowledge/engine.js`
- [Errand fulfillment](https://github.com/myassistantapps/myassistant-backend/blob/main/src/fulfillment/service.js): `src/fulfillment/service.js`
- [Meeting negotiation](https://github.com/myassistantapps/myassistant-backend/blob/main/src/meetings/service.js): `src/meetings/service.js`
- [Flight fares](https://github.com/myassistantapps/myassistant-backend/blob/main/src/travel/fares.js): `src/travel/fares.js`
- [Interpreter mode](https://github.com/myassistantapps/myassistant-backend/blob/main/src/interpreter/mode.js): `src/interpreter/mode.js`
- [Reminders](https://github.com/myassistantapps/myassistant-backend/blob/main/src/reminders/routes.js): `src/reminders/routes.js`

### External integrations

- [Outbound agent calls](https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/agentCall.js): `src/agents/agentCall.js`
- [Inbound call screening](https://github.com/myassistantapps/myassistant-backend/blob/main/src/inbound/receptionist.js): `src/inbound/receptionist.js`
- [MCP integrations](https://github.com/myassistantapps/myassistant-backend/blob/main/src/mcp/manager.js): `src/mcp/manager.js`
- [Google services](https://github.com/myassistantapps/myassistant-backend/blob/main/src/google/routes.js): `src/google/routes.js`
- [Payment collection](https://github.com/myassistantapps/myassistant-backend/blob/main/src/payments/service.js): `src/payments/service.js`
- [Avatar sessions](https://github.com/myassistantapps/myassistant-backend/blob/main/src/avatar/session.js): `src/avatar/session.js`

### User state and records

- [User context](https://github.com/myassistantapps/myassistant-backend/blob/main/src/users/context.js): `src/users/context.js`
- [Personal memory](https://github.com/myassistantapps/myassistant-backend/blob/main/src/agents/memory.js): `src/agents/memory.js`
- [Executed actions](https://github.com/myassistantapps/myassistant-backend/blob/main/src/actions/store.js): `src/actions/store.js`
- [Action audit](https://github.com/myassistantapps/myassistant-backend/blob/main/src/audit/log.js): `src/audit/log.js`
- [PostgreSQL data](https://github.com/myassistantapps/myassistant-backend/blob/main/src/db.js): `src/db.js`

### Other components

- **MYASSISTANT app**

## Connections

- MYASSISTANT app → Express API: sends requests (evidence: `README.md`)
- Express API → Realtime voice loop: mounts routes (evidence: `src/server.js`)
- MYASSISTANT app → Realtime voice loop: streams voice turns (evidence: `README.md`)
- Realtime voice loop → Agent runtime: runs turns (evidence: `src/assistant/routes.js`)
- Realtime voice loop → Chat and intents: uses intents (evidence: `src/assistant/routes.js`)
- Agent runtime → Tool registry: selects tools (evidence: `src/agents/runtime.js`)
- Agent runtime → Gemini services: requests generation (evidence: `src/agents/runtime.js`)
- Agent runtime → User context: loads context (evidence: `src/agents/runtime.js`)
- Agent runtime → Personal memory: uses memory (evidence: `src/agents/runtime.js`)
- Agent runtime → Executed actions: records execution (evidence: `src/agents/runtime.js`)
- Tool registry → MCP integrations: accepts user tools (evidence: `README.md`)
- Errand fulfillment → Outbound agent calls: places calls (evidence: `src/fulfillment/service.js`)
- Errand fulfillment → PostgreSQL data: stores errands (evidence: `src/fulfillment/service.js`)
- Inbound call screening → Express API: receives webhooks
- Meeting negotiation → Gemini services: analyzes transcripts (evidence: `src/meetings/service.js`)
- Google services → Express API: serves endpoints (evidence: `src/google/routes.js`)
- Payment collection → PostgreSQL data: stores payment state (evidence: `src/payments/service.js`)
- Avatar sessions → MYASSISTANT app: provides sessions (evidence: `README.md`)
- Knowledge retrieval → PostgreSQL data: loads entries (evidence: `src/knowledge/engine.js`)
- Personal memory → PostgreSQL data: persists memories
- Action audit → PostgreSQL data: writes audit log (evidence: `src/audit/log.js`)
- Reminders → PostgreSQL data: stores reminders
- Flight fares → MYASSISTANT app: offers fare search (evidence: `README.md`)
- Interpreter mode → MYASSISTANT app: translates speech (evidence: `README.md`)
