# yashhhseella/mirrormuse-public architecture

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

- Interactive diagram: https://gitdiagram.com/yashhhseella/mirrormuse-public
- Repository: https://github.com/yashhhseella/mirrormuse-public

## Overview

MirrorMuse is a local, voice-first smart-mirror assistant: users speak or type in the browser, chat requests pass through Next.js proxy routes to the Fastify backend, and the backend enriches prompts with RAG before local-LLM inference and MCP tool execution. Separate branches serve dashboard data, named briefings, live SSE events, Spotify controls, and speech synthesis. The README documents the broad service wiring; source excerpts and the index confirm selected calls. LuxTTS internals and several UI routes were not sampled, so those links are shown only where documented.

Main entry points: [`apps/server/src/index.ts`](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/index.ts) (Fastify routes), [`apps/server/src/services/dashboard.ts`](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/dashboard.ts) (Dashboard aggregator), [`apps/ui/app/page.tsx`](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/page.tsx) (Next.js screens), [`apps/server/src/services/mcp.ts`](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/mcp.ts) (MCP tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Mirror UI"]
  node_ui["Next.js screens<br/>[page.tsx]"]
  node_voice["Voice interface<br/>[VoiceAgent.tsx]"]
  node_chatproxy["Chat proxy<br/>[route.ts]"]
  node_streamproxy["Chat stream proxy<br/>[route.ts]"]
  node_dashboardproxy["Dashboard proxy<br/>[route.ts]"]
  node_sseproxy["SSE proxy<br/>[route.ts]"]
  node_ttsproxy["TTS proxy<br/>[route.ts]"]
end

subgraph group_backend["Backend workflows"]
  node_backend["Fastify routes<br/>[index.ts]"]
  node_rag[("RAG retrieval<br/>[rag.ts]")]
  node_llm["Local LLM<br/>[llm.ts]"]
  node_mcp["MCP tools<br/>[mcp.ts]"]
  node_protocols["Briefing workflows<br/>[protocols.ts]"]
  node_sse["Event broadcast<br/>[index.ts]"]
end

subgraph group_services["Data and integrations"]
  node_dashboard["Dashboard aggregator<br/>[dashboard.ts]"]
  node_news["News feeds<br/>[news.ts]"]
  node_calendar[("Calendar cache<br/>[calendarCache.ts]")]
  node_traffic["Traffic data<br/>[traffic.ts]"]
  node_spotify["Spotify integration<br/>[spotifyAuth.ts]"]
  node_events[("Countdown events<br/>[events.ts]")]
end

subgraph group_speech["Speech synthesis"]
  node_ttsserver["TTS runtime<br/>[lux_tts_server.py]"]
  node_luxvoice["LuxVoice engine<br/>[luxvoice.py]"]
end

node_browser(("Mirror user"))
node_external{{"External APIs"}}
node_localmodel{{"Local inference endpoint"}}

node_browser -->|"uses"| node_ui
node_browser -->|"speaks to"| node_voice
node_voice -.->|"sends chat"| node_chatproxy
node_ui -->|"polls"| node_dashboardproxy
node_ui -->|"listens on"| node_sseproxy
node_chatproxy -->|"proxies to"| node_backend
node_streamproxy -->|"proxies to"| node_backend
node_dashboardproxy -->|"proxies to"| node_backend
node_sseproxy -->|"proxies to"| node_backend
node_backend -->|"searches"| node_rag
node_backend -->|"builds and streams"| node_llm
node_backend -->|"dispatches tools"| node_mcp
node_llm -->|"requests inference"| node_localmodel
node_backend -->|"serves dashboard"| node_dashboard
node_dashboard -->|"uses news data"| node_news
node_dashboard -->|"uses cached events"| node_calendar
node_backend -->|"builds briefings"| node_protocols
node_protocols -->|"broadcasts results"| node_sse
node_backend -->|"reads and writes"| node_events
node_mcp -->|"fetches weather"| node_dashboard
node_mcp -->|"fetches traffic"| node_traffic
node_backend -->|"routes playback"| node_spotify
node_dashboard -->|"fetches feed data"| node_external
node_news -->|"fetches news"| node_external
node_traffic -->|"queries route data"| node_external
node_calendar -->|"loads calendar data"| node_external
node_spotify -->|"uses Spotify API"| node_external
node_ttsproxy -->|"proxies speech"| node_backend
node_backend -->|"selects TTS provider"| node_ttsserver
node_ttsserver -->|"invokes engine"| node_luxvoice

click node_ui "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/page.tsx"
click node_voice "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/components/VoiceAgent.tsx"
click node_chatproxy "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/chat/route.ts"
click node_streamproxy "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/chat/stream/route.ts"
click node_dashboardproxy "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/dashboard/route.ts"
click node_sseproxy "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/sse/route.ts"
click node_backend "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/index.ts"
click node_rag "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/rag.ts"
click node_llm "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/llm.ts"
click node_mcp "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/mcp.ts"
click node_protocols "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/protocols.ts"
click node_sse "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/index.ts"
click node_dashboard "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/dashboard.ts"
click node_news "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/news.ts"
click node_calendar "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/calendarCache.ts"
click node_traffic "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/traffic.ts"
click node_spotify "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/spotifyAuth.ts"
click node_events "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/events.ts"
click node_ttsproxy "https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/tts/route.ts"
click node_ttsserver "https://github.com/yashhhseella/mirrormuse-public/blob/main/runtime/lux_tts_server.py"
click node_luxvoice "https://github.com/yashhhseella/mirrormuse-public/blob/main/LuxTTS/zipvoice/luxvoice.py"

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_ui,node_voice,node_chatproxy,node_streamproxy,node_dashboardproxy,node_sseproxy,node_ttsproxy,node_browser toneBlue
class node_backend,node_rag,node_llm,node_mcp,node_protocols,node_sse toneAmber
class node_dashboard,node_news,node_calendar,node_traffic,node_spotify,node_events,node_external toneMint
class node_ttsserver,node_luxvoice toneRose
class node_localmodel toneIndigo
```

## Components

### Mirror UI

- [Next.js screens](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/page.tsx): `apps/ui/app/page.tsx`
- [Voice interface](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/components/VoiceAgent.tsx): `apps/ui/components/VoiceAgent.tsx`
- [Chat proxy](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/chat/route.ts): `apps/ui/app/api/chat/route.ts`
- [Chat stream proxy](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/chat/stream/route.ts): `apps/ui/app/api/chat/stream/route.ts`
- [Dashboard proxy](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/dashboard/route.ts): `apps/ui/app/api/dashboard/route.ts`
- [SSE proxy](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/sse/route.ts): `apps/ui/app/api/sse/route.ts`
- [TTS proxy](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/ui/app/api/tts/route.ts): `apps/ui/app/api/tts/route.ts`

### Backend workflows

- [Fastify routes](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/index.ts): `apps/server/src/index.ts`
- [RAG retrieval](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/rag.ts): `apps/server/src/services/rag.ts`
- [Local LLM](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/llm.ts): `apps/server/src/services/llm.ts`
- [MCP tools](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/mcp.ts): `apps/server/src/services/mcp.ts`
- [Briefing workflows](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/protocols.ts): `apps/server/src/services/protocols.ts`
- [Event broadcast](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/index.ts): `apps/server/src/index.ts`

### Data and integrations

- [Dashboard aggregator](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/dashboard.ts): `apps/server/src/services/dashboard.ts`
- [News feeds](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/news.ts): `apps/server/src/services/news.ts`
- [Calendar cache](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/calendarCache.ts): `apps/server/src/services/calendarCache.ts`
- [Traffic data](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/traffic.ts): `apps/server/src/services/traffic.ts`
- [Spotify integration](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/spotifyAuth.ts): `apps/server/src/services/spotifyAuth.ts`
- [Countdown events](https://github.com/yashhhseella/mirrormuse-public/blob/main/apps/server/src/services/events.ts): `apps/server/src/services/events.ts`

### Speech synthesis

- [TTS runtime](https://github.com/yashhhseella/mirrormuse-public/blob/main/runtime/lux_tts_server.py): `runtime/lux_tts_server.py`
- [LuxVoice engine](https://github.com/yashhhseella/mirrormuse-public/blob/main/LuxTTS/zipvoice/luxvoice.py): `LuxTTS/zipvoice/luxvoice.py`

### Other components

- **Mirror user**
- **External APIs**
- **Local inference endpoint**

## Connections

- Mirror user → Next.js screens: uses
- Mirror user → Voice interface: speaks to
- Voice interface → Chat proxy: sends chat
- Next.js screens → Dashboard proxy: polls
- Next.js screens → SSE proxy: listens on
- Chat proxy → Fastify routes: proxies to
- Chat stream proxy → Fastify routes: proxies to
- Dashboard proxy → Fastify routes: proxies to
- SSE proxy → Fastify routes: proxies to
- Fastify routes → RAG retrieval: searches (evidence: `apps/server/src/index.ts`)
- Fastify routes → Local LLM: builds and streams (evidence: `apps/server/src/index.ts`)
- Fastify routes → MCP tools: dispatches tools (evidence: `apps/server/src/index.ts`)
- Local LLM → Local inference endpoint: requests inference (evidence: `apps/server/src/services/llm.ts`)
- Fastify routes → Dashboard aggregator: serves dashboard (evidence: `apps/server/src/index.ts`)
- Dashboard aggregator → News feeds: uses news data (evidence: `apps/server/src/services/dashboard.ts`)
- Dashboard aggregator → Calendar cache: uses cached events (evidence: `apps/server/src/services/dashboard.ts`)
- Fastify routes → Briefing workflows: builds briefings (evidence: `apps/server/src/index.ts`)
- Briefing workflows → Event broadcast: broadcasts results (evidence: `apps/server/src/index.ts`)
- Fastify routes → Countdown events: reads and writes (evidence: `apps/server/src/index.ts`)
- MCP tools → Dashboard aggregator: fetches weather (evidence: `apps/server/src/services/mcp.ts`)
- MCP tools → Traffic data: fetches traffic (evidence: `apps/server/src/services/mcp.ts`)
- Fastify routes → Spotify integration: routes playback (evidence: `apps/server/src/index.ts`)
- Dashboard aggregator → External APIs: fetches feed data
- News feeds → External APIs: fetches news (evidence: `apps/server/src/services/news.ts`)
- Traffic data → External APIs: queries route data
- Calendar cache → External APIs: loads calendar data
- Spotify integration → External APIs: uses Spotify API
- TTS proxy → Fastify routes: proxies speech
- Fastify routes → TTS runtime: selects TTS provider
- TTS runtime → LuxVoice engine: invokes engine (evidence: `runtime/lux_tts_server.py`)
