# myrisol0813-gif/elementera-coast-source architecture

> Architecture diagram of the GitHub repository myrisol0813-gif/elementera-coast-source, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/myrisol0813-gif/elementera-coast-source
- Repository: https://github.com/myrisol0813-gif/elementera-coast-source
- Video tour (about a minute): https://gitdiagram.com/myrisol0813-gif/elementera-coast-source/video

## Overview

Elementera Coast is a personal, multi-window AI conversation workspace: chat is the interaction surface, while backend services manage longer-lived context, memory, tools, and visitor input. The principal flow runs from a user message through a frontend chat surface to backend chat handling, where context and tool work may inform a streamed model response. Users can then inspect or manage related memory, daily records, and model activity. The README documents these major capabilities; sampled source confirms frontend composition, selected API clients, and Android repository behavior, but not every backend dispatch or persistence connection.

Main entry points: [`apps/web/functions/chat-router.js`](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/chat-router.js) (Chat routes), [`apps/web/elementera-mcp/deploy-pages/public/app.js`](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/app.js) (PWA workspace), [`apps/web/functions/api-router.js`](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/api-router.js) (API router), [`apps/web/functions/context-assemble-clean.js`](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/context-assemble-clean.js) (Context assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_windows["User windows"]
  node_web["PWA workspace<br/>[app.js]"]
  node_android["Android app<br/>[MainActivity.kt]"]
  node_mailbox_ui["Visitor mailbox<br/>[mailbox.js]"]
end

subgraph group_conversation["Conversation flow"]
  node_chat_ui["Chat surface<br/>[chat.js]"]
  node_chat_repo["Chat repository<br/>[ChatRepository.kt]"]
  node_chat_api["Chat routes<br/>[chat-router.js]"]
  node_chat_store[("Conversation storage<br/>[chat-store.js]")]
end

subgraph group_context["Context and memory"]
  node_context_assembly["Context assembly"]
  node_memory_ui["Memory surfaces<br/>[memory.js]"]
  node_memory_client["Memory API client<br/>[memory-client.js]"]
  node_memory_routes["Memory routes<br/>[memory-router.js]"]
  node_memory_store[("Memory storage<br/>[memory-store.js]")]
  node_cross_window["Cross-window state"]
end

subgraph group_workspace["Workspace features"]
  node_daily_ui["Daily surfaces<br/>[daily.js]"]
  node_daily_api["Daily API<br/>[daily-api.js]"]
  node_daily_store[("Daily storage<br/>[daily-store.js]")]
  node_model_workspace["Model workspace<br/>[models.js]"]
  node_tool_records["Tool records<br/>[tool-run-log.js]"]
end

subgraph group_backend["Backend services"]
  node_mailbox_service["Mailbox service<br/>[mailbox-service.js]"]
  node_mailbox_store[("Mailbox storage")]
  node_api_router["API router<br/>[api-router.js]"]
end

node_owner(("Workspace user"))
node_model_provider{{"Model provider"}}
node_tool_provider{{"External tools"}}

node_owner -->|"uses"| node_web
node_owner -->|"uses"| node_android
node_owner -->|"sends input"| node_mailbox_ui
node_web -->|"creates"| node_chat_ui
node_web -->|"creates"| node_memory_ui
node_web -->|"creates"| node_daily_ui
node_web -->|"creates"| node_model_workspace
node_chat_ui -->|"requests chat"| node_chat_api
node_android -->|"hosts"| node_chat_repo
node_chat_repo -->|"streams chat"| node_chat_api
node_chat_api -->|"assembles context"| node_context_assembly
node_chat_api -->|"requests response"| node_model_provider
node_chat_api -->|"stores turns"| node_chat_store
node_chat_api -->|"records activity"| node_tool_records
node_chat_api -.->|"dispatches tools"| node_tool_provider
node_memory_ui -->|"invokes"| node_memory_client
node_memory_client -->|"requests memory"| node_memory_routes
node_memory_routes -->|"reads and writes"| node_memory_store
node_context_assembly -->|"looks up context"| node_memory_store
node_context_assembly -.->|"uses shared state"| node_cross_window
node_daily_ui -->|"requests records"| node_daily_api
node_daily_api -->|"reads and writes"| node_daily_store
node_mailbox_ui -->|"submits messages"| node_mailbox_service
node_mailbox_service -->|"stores mailbox data"| node_mailbox_store
node_web -->|"calls backend"| node_api_router
node_api_router -->|"dispatches"| node_chat_api
node_api_router -->|"dispatches"| node_memory_routes
node_api_router -->|"dispatches"| node_daily_api
node_api_router -->|"dispatches"| node_mailbox_service

click node_web "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/app.js"
click node_android "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/android/app/src/main/kotlin/com/elementeracoast/app/MainActivity.kt"
click node_mailbox_ui "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/mailbox.js"
click node_chat_ui "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/chat.js"
click node_chat_repo "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/android/app/src/main/kotlin/com/elementeracoast/app/feature/chat/ChatRepository.kt"
click node_chat_api "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/chat-router.js"
click node_chat_store "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/chat-store.js"
click node_context_assembly "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/context-assemble-clean.js"
click node_memory_ui "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/memory.js"
click node_memory_client "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/memory/memory-client.js"
click node_memory_routes "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/memory-router.js"
click node_memory_store "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/memory-store.js"
click node_cross_window "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/cross-window-service.js"
click node_daily_ui "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/daily.js"
click node_daily_api "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/daily-api.js"
click node_daily_store "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/daily-store.js"
click node_model_workspace "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/models.js"
click node_tool_records "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/tool-run-log.js"
click node_mailbox_service "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/mailbox-service.js"
click node_mailbox_store "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/mailbox-repository.js"
click node_api_router "https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/api-router.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_web,node_android,node_mailbox_ui,node_owner toneBlue
class node_chat_ui,node_chat_repo,node_chat_api,node_chat_store toneAmber
class node_context_assembly,node_memory_ui,node_memory_client,node_memory_routes,node_memory_store,node_cross_window toneMint
class node_daily_ui,node_daily_api,node_daily_store,node_model_workspace,node_tool_records toneRose
class node_mailbox_service,node_mailbox_store,node_api_router,node_model_provider,node_tool_provider toneIndigo
```

## Components

### User windows

- [PWA workspace](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/app.js): `apps/web/elementera-mcp/deploy-pages/public/app.js`
- [Android app](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/android/app/src/main/kotlin/com/elementeracoast/app/MainActivity.kt): `apps/android/app/src/main/kotlin/com/elementeracoast/app/MainActivity.kt`
- [Visitor mailbox](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/mailbox.js): `apps/web/elementera-mcp/deploy-pages/public/mailbox.js`

### Conversation flow

- [Chat surface](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/chat.js): `apps/web/elementera-mcp/deploy-pages/public/features/chat.js`
- [Chat repository](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/android/app/src/main/kotlin/com/elementeracoast/app/feature/chat/ChatRepository.kt): `apps/android/app/src/main/kotlin/com/elementeracoast/app/feature/chat/ChatRepository.kt`
- [Chat routes](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/chat-router.js): `apps/web/functions/chat-router.js`
- [Conversation storage](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/chat-store.js): `apps/web/functions/chat-store.js`

### Context and memory

- [Context assembly](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/context-assemble-clean.js): `apps/web/functions/context-assemble-clean.js`
- [Memory surfaces](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/memory.js): `apps/web/elementera-mcp/deploy-pages/public/features/memory.js`
- [Memory API client](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/memory/memory-client.js): `apps/web/elementera-mcp/deploy-pages/public/features/memory/memory-client.js`
- [Memory routes](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/memory-router.js): `apps/web/functions/memory-router.js`
- [Memory storage](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/memory-store.js): `apps/web/functions/memory-store.js`
- [Cross-window state](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/cross-window-service.js): `apps/web/functions/cross-window-service.js`

### Workspace features

- [Daily surfaces](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/daily.js): `apps/web/elementera-mcp/deploy-pages/public/features/daily.js`
- [Daily API](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/daily-api.js): `apps/web/functions/daily-api.js`
- [Daily storage](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/daily-store.js): `apps/web/functions/daily-store.js`
- [Model workspace](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/elementera-mcp/deploy-pages/public/features/models.js): `apps/web/elementera-mcp/deploy-pages/public/features/models.js`
- [Tool records](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/tool-run-log.js): `apps/web/functions/tool-run-log.js`

### Backend services

- [Mailbox service](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/mailbox-service.js): `apps/web/functions/mailbox-service.js`
- [Mailbox storage](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/mailbox-repository.js): `apps/web/functions/mailbox-repository.js`
- [API router](https://github.com/myrisol0813-gif/elementera-coast-source/blob/main/apps/web/functions/api-router.js): `apps/web/functions/api-router.js`

### Other components

- **Workspace user**
- **Model provider**
- **External tools**

## Connections

- Workspace user → PWA workspace: uses
- Workspace user → Android app: uses
- Workspace user → Visitor mailbox: sends input
- PWA workspace → Chat surface: creates
- PWA workspace → Memory surfaces: creates
- PWA workspace → Daily surfaces: creates
- PWA workspace → Model workspace: creates
- Chat surface → Chat routes: requests chat
- Android app → Chat repository: hosts
- Chat repository → Chat routes: streams chat
- Chat routes → Context assembly: assembles context
- Chat routes → Model provider: requests response
- Chat routes → Conversation storage: stores turns
- Chat routes → Tool records: records activity
- Chat routes → External tools: dispatches tools
- Memory surfaces → Memory API client: invokes
- Memory API client → Memory routes: requests memory
- Memory routes → Memory storage: reads and writes
- Context assembly → Memory storage: looks up context
- Context assembly → Cross-window state: uses shared state
- Daily surfaces → Daily API: requests records
- Daily API → Daily storage: reads and writes
- Visitor mailbox → Mailbox service: submits messages
- Mailbox service → Mailbox storage: stores mailbox data
- PWA workspace → API router: calls backend
- API router → Chat routes: dispatches
- API router → Memory routes: dispatches
- API router → Daily API: dispatches
- API router → Mailbox service: dispatches
