# prjvvl/maya-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/prjvvl/maya-ai-assistant
- Repository: https://github.com/prjvvl/maya-ai-assistant

## Overview

Maya is a browser-based talking assistant. The user speaks through the chat UI; speech controls convert input to text, the page sends it with recent conversation context to the chat endpoint, and the resulting reply is displayed and spoken aloud. The endpoint generates replies with Gemini. The graph reflects the sampled page, endpoint, and component excerpts plus README capabilities; browser speech APIs are external dependencies.

Main entry points: [`src/routes/+page.svelte`](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/%2Bpage.svelte) (Conversation coordinator), [`src/lib/ChatInterface.svelte`](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/ChatInterface.svelte) (Chat interface), [`src/routes/api/chat/+server.ts`](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/api/chat/%2Bserver.ts) (Chat endpoint), [`src/lib/speechService.ts`](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/speechService.ts) (Speech service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation UI"]
  node_page["Conversation coordinator<br/>[+page.svelte]"]
  node_chat["Chat interface"]
  node_message_types["Message types<br/>[types.ts]"]
end

subgraph group_speech["Speech I/O"]
  node_controls["Speech controls"]
  node_speech_service["Speech service<br/>[speechService.ts]"]
  node_web_speech{{"Browser Speech APIs"}}
end

subgraph group_generation["Response generation"]
  node_chat_endpoint["Chat endpoint<br/>[+server.ts]"]
  node_gemini{{"Google Gemini"}}
end

node_user(("User"))

node_user -->|"converses in"| node_chat
node_page -->|"renders"| node_chat
node_chat -->|"renders"| node_controls
node_chat -->|"emits events"| node_page
node_chat -->|"uses types"| node_message_types
node_page -->|"uses types"| node_message_types
node_controls -->|"controls"| node_speech_service
node_speech_service -->|"uses"| node_web_speech
node_page -->|"speaks replies"| node_speech_service
node_page -->|"posts message"| node_chat_endpoint
node_chat_endpoint -->|"generates reply"| node_gemini
node_chat_endpoint -->|"returns response"| node_page

click node_page "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/%2Bpage.svelte"
click node_chat "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/ChatInterface.svelte"
click node_message_types "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/types.ts"
click node_controls "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/SpeechControls.svelte"
click node_speech_service "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/speechService.ts"
click node_chat_endpoint "https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/api/chat/%2Bserver.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_page,node_chat,node_message_types,node_user toneBlue
class node_controls,node_speech_service,node_web_speech toneAmber
class node_chat_endpoint,node_gemini toneMint
```

## Components

### Conversation UI

- [Conversation coordinator](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Chat interface](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/ChatInterface.svelte): `src/lib/ChatInterface.svelte`
- [Message types](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/types.ts): `src/lib/types.ts`

### Speech I/O

- [Speech controls](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/SpeechControls.svelte): `src/lib/SpeechControls.svelte`
- [Speech service](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/lib/speechService.ts): `src/lib/speechService.ts`
- **Browser Speech APIs**

### Response generation

- [Chat endpoint](https://github.com/prjvvl/maya-ai-assistant/blob/main/src/routes/api/chat/%2Bserver.ts): `src/routes/api/chat/+server.ts`
- **Google Gemini**

### Other components

- **User**

## Connections

- User → Chat interface: converses in (evidence: `README.md`)
- Conversation coordinator → Chat interface: renders (evidence: `src/routes/+page.svelte`)
- Chat interface → Speech controls: renders (evidence: `src/lib/ChatInterface.svelte`)
- Chat interface → Conversation coordinator: emits events (evidence: `src/routes/+page.svelte`)
- Chat interface → Message types: uses types (evidence: `src/lib/ChatInterface.svelte`)
- Conversation coordinator → Message types: uses types (evidence: `src/routes/+page.svelte`)
- Speech controls → Speech service: controls (evidence: `src/lib/SpeechControls.svelte`)
- Speech service → Browser Speech APIs: uses (evidence: `README.md`)
- Conversation coordinator → Speech service: speaks replies (evidence: `src/routes/+page.svelte`)
- Conversation coordinator → Chat endpoint: posts message (evidence: `src/routes/+page.svelte`)
- Chat endpoint → Google Gemini: generates reply (evidence: `src/routes/api/chat/+server.ts`)
- Chat endpoint → Conversation coordinator: returns response (evidence: `src/routes/+page.svelte`)
