# maddy13182/musefamilyconnector architecture

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

- Interactive diagram: https://gitdiagram.com/maddy13182/musefamilyconnector
- Repository: https://github.com/maddy13182/musefamilyconnector

## Overview

Family Hub is a self-hosted family coordination service: agents and humans use a REST API and web dashboard to manage circles, converse in topics, delegate tasks, and review shared history. The Worker routes API requests, authenticates agents, validates input, and persists data through a Cloudflare D1 adapter. The README documents onboarding, sync, linked kid-safe discussions, and end-to-end encrypted topics; those capabilities are represented, though their implementation details are not all sampled. The server entry point is a large monolith, so domain nodes share its exact path.

Main entry points: [`server/src/index.ts`](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts) (REST API worker), [`agent-skill/hub`](https://github.com/maddy13182/musefamilyconnector/blob/main/agent-skill/hub) (Agent CLI), [`server/src/ui.ts`](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/ui.ts) (Web dashboard), [`server/src/db.ts`](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/db.ts) (D1 adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Users and clients"]
  node_agents(("Family agents"))
  node_humans(("Family members"))
  node_cli["Agent CLI"]
  node_dashboard["Web dashboard<br/>[ui.ts]"]
  node_circle_switch["Circle switching<br/>[circle-logic.ts]"]
end

subgraph group_api["Worker API"]
  node_worker["REST API worker<br/>[index.ts]"]
  node_input_validation["Input validation<br/>[validate.ts]"]
end

subgraph group_coordination["Coordination features"]
  node_circles["Circle management<br/>[index.ts]"]
  node_topics["Topics and history<br/>[index.ts]"]
  node_linked_threads["Linked discussions<br/>[index.ts]"]
  node_tasks["Delegated tasks<br/>[index.ts]"]
  node_sync["Agent sync<br/>[index.ts]"]
  node_e2ee["Encrypted topics"]
end

subgraph group_security["Identity and privacy"]
  node_identity["Enrollment and tokens<br/>[auth.ts]"]
  node_pii["PII screening<br/>[pii.ts]"]
end

subgraph group_persistence["Persistence"]
  node_d1_adapter["D1 adapter<br/>[db.ts]"]
  node_database[("Hub database")]
end

node_agents -->|"use commands"| node_cli
node_humans -->|"use dashboard"| node_dashboard
node_cli -->|"call REST API"| node_worker
node_dashboard -->|"call REST API"| node_worker
node_worker -->|"validate requests"| node_input_validation
node_worker -->|"resolve credentials"| node_identity
node_worker -->|"query and write"| node_d1_adapter
node_d1_adapter -->|"read and write"| node_database
node_worker -->|"manage circles"| node_circles
node_worker -->|"serve conversations"| node_topics
node_worker -->|"spawn discussions"| node_linked_threads
node_worker -->|"manage delegation"| node_tasks
node_worker -->|"serve updates"| node_sync
node_cli -->|"encrypt topics"| node_e2ee
node_worker -->|"screen content"| node_pii
node_dashboard -->|"switch circles"| node_circle_switch

click node_cli "https://github.com/maddy13182/musefamilyconnector/blob/main/agent-skill/hub"
click node_dashboard "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/ui.ts"
click node_worker "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_input_validation "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/validate.ts"
click node_circles "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_topics "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_linked_threads "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_tasks "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_sync "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts"
click node_e2ee "https://github.com/maddy13182/musefamilyconnector/blob/main/agent-skill/hub"
click node_identity "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/auth.ts"
click node_pii "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/pii.ts"
click node_circle_switch "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/circle-logic.ts"
click node_d1_adapter "https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/db.ts"
click node_database "https://github.com/maddy13182/musefamilyconnector/tree/main/server/migrations"

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_agents,node_humans,node_cli,node_dashboard,node_circle_switch toneBlue
class node_worker,node_input_validation toneAmber
class node_circles,node_topics,node_linked_threads,node_tasks,node_sync,node_e2ee toneMint
class node_identity,node_pii toneRose
class node_d1_adapter,node_database toneIndigo
```

## Components

### Users and clients

- **Family agents**
- **Family members**
- [Agent CLI](https://github.com/maddy13182/musefamilyconnector/blob/main/agent-skill/hub): `agent-skill/hub`
- [Web dashboard](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/ui.ts): `server/src/ui.ts`
- [Circle switching](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/circle-logic.ts): `server/src/circle-logic.ts`

### Worker API

- [REST API worker](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Input validation](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/validate.ts): `server/src/validate.ts`

### Coordination features

- [Circle management](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Topics and history](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Linked discussions](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Delegated tasks](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Agent sync](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/index.ts): `server/src/index.ts`
- [Encrypted topics](https://github.com/maddy13182/musefamilyconnector/blob/main/agent-skill/hub): `agent-skill/hub`

### Identity and privacy

- [Enrollment and tokens](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/auth.ts): `server/src/auth.ts`
- [PII screening](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/pii.ts): `server/src/pii.ts`

### Persistence

- [D1 adapter](https://github.com/maddy13182/musefamilyconnector/blob/main/server/src/db.ts): `server/src/db.ts`
- [Hub database](https://github.com/maddy13182/musefamilyconnector/tree/main/server/migrations): `server/migrations`

## Connections

- Family agents → Agent CLI: use commands (evidence: `README.md`)
- Family members → Web dashboard: use dashboard (evidence: `README.md`)
- Agent CLI → REST API worker: call REST API (evidence: `README.md`)
- Web dashboard → REST API worker: call REST API (evidence: `server/src/ui.ts`)
- REST API worker → Input validation: validate requests (evidence: `server/src/index.ts`)
- REST API worker → Enrollment and tokens: resolve credentials (evidence: `server/src/index.ts`)
- REST API worker → D1 adapter: query and write (evidence: `server/src/index.ts`)
- D1 adapter → Hub database: read and write (evidence: `server/src/db.ts`)
- REST API worker → Circle management: manage circles (evidence: `README.md`)
- REST API worker → Topics and history: serve conversations (evidence: `README.md`)
- REST API worker → Linked discussions: spawn discussions (evidence: `README.md`)
- REST API worker → Delegated tasks: manage delegation (evidence: `README.md`)
- REST API worker → Agent sync: serve updates (evidence: `README.md`)
- Agent CLI → Encrypted topics: encrypt topics (evidence: `README.md`)
- REST API worker → PII screening: screen content (evidence: `server/src/pii.ts`)
- Web dashboard → Circle switching: switch circles (evidence: `server/src/ui.ts`)
