# sengtha/normsar-silo architecture

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

- Interactive diagram: https://gitdiagram.com/sengtha/normsar-silo
- Repository: https://github.com/sengtha/normsar-silo

## Overview

Normsar-Silo is a self-hosted Supabase-backed node for sovereign messaging federated with the Normsar Hub. A Hub ticket is redeemed to mint a short-lived Silo JWT; authenticated members use room messaging, optional AI document ingestion and chat assistance, daily briefings, and Lit-based E2EE access. The SQL schema provides the documented data and governance layer. The graph reflects the sampled function calls and README-described capabilities; unsampled deployment wiring and feature internals are not inferred.

Main entry points: [`supabase/setup/schema/normsar_silo_schema.sql`](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/schema/normsar_silo_schema.sql) (Silo data schema), [`supabase/setup/functions/sponsor-lit-action/index.ts`](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/sponsor-lit-action/index.ts) (Lit key action), [`supabase/setup/functions/send-message/index.ts`](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/send-message/index.ts) (Message actions), [`supabase/setup/functions/feed-ai/index.ts`](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/feed-ai/index.ts) (Document ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Federated identity"]
  node_auth["Hub ticket auth<br/>[index.ts]"]
end

subgraph group_messaging["Room messaging"]
  node_chat["Message actions<br/>[index.ts]"]
  node_push["Push relay<br/>[index.ts]"]
end

subgraph group_ai["AI features"]
  node_feed["Document ingestion<br/>[index.ts]"]
  node_assistant["Room AI assistant<br/>[index.ts]"]
  node_briefing["Daily briefing<br/>[index.ts]"]
end

subgraph group_security["E2EE access"]
  node_e2ee_status["E2EE status<br/>[index.ts]"]
  node_lit_action["Lit key action<br/>[index.ts]"]
  node_membership["Membership verifier<br/>[index.ts]"]
end

subgraph group_data["Silo platform"]
  node_schema[("Silo data schema")]
  node_gateway["Edge function gateway<br/>[index.ts]"]
  node_pooler["Database pooler<br/>[pooler.exs]"]
end

node_member(("Silo member"))
node_hub["Normsar Hub"]
node_gemini["Google Gemini"]
node_lit["Lit Protocol"]
node_google["Google token service"]

node_member -.->|"redeems ticket"| node_auth
node_auth -->|"redeems ticket"| node_hub
node_member -.->|"sends actions"| node_chat
node_chat -->|"reads and writes"| node_schema
node_chat -->|"relays alert"| node_push
node_push -->|"sends alert"| node_hub
node_member -.->|"feeds documents"| node_feed
node_feed -->|"reads and stores"| node_schema
node_feed -->|"requests embeddings"| node_gemini
node_member -.->|"asks room question"| node_assistant
node_assistant -->|"queries and inserts"| node_schema
node_assistant -->|"embeds and generates"| node_gemini
node_member -.->|"requests briefing"| node_briefing
node_briefing -->|"reads and records"| node_schema
node_briefing -->|"generates summary"| node_gemini
node_member -.->|"checks configuration"| node_e2ee_status
node_member -.->|"requests room key"| node_lit_action
node_lit_action -->|"validates token"| node_google
node_lit_action -->|"requests verification"| node_membership
node_membership -->|"validates token"| node_google
node_membership -->|"checks membership"| node_schema
node_lit_action -->|"executes action"| node_lit
node_gateway -.->|"dispatches requests"| node_member

click node_auth "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/authenticate-hub-user/index.ts"
click node_chat "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/send-message/index.ts"
click node_push "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/send-message/index.ts"
click node_e2ee_status "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/check-e2ee-status/index.ts"
click node_lit_action "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/sponsor-lit-action/index.ts"
click node_membership "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/verify-membership/index.ts"
click node_feed "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/feed-ai/index.ts"
click node_assistant "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/normsar-ai/index.ts"
click node_briefing "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/silo-daily-briefing/index.ts"
click node_schema "https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/schema/normsar_silo_schema.sql"
click node_gateway "https://github.com/sengtha/normsar-silo/blob/main/docker/volumes/functions/main/index.ts"
click node_pooler "https://github.com/sengtha/normsar-silo/blob/main/docker/volumes/pooler/pooler.exs"

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_auth toneBlue
class node_chat,node_push toneAmber
class node_feed,node_assistant,node_briefing toneMint
class node_e2ee_status,node_lit_action,node_membership toneRose
class node_schema,node_gateway,node_pooler,node_member,node_hub,node_gemini,node_lit,node_google toneIndigo
```

## Components

### Federated identity

- [Hub ticket auth](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/authenticate-hub-user/index.ts): `supabase/setup/functions/authenticate-hub-user/index.ts`

### Room messaging

- [Message actions](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/send-message/index.ts): `supabase/setup/functions/send-message/index.ts`
- [Push relay](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/send-message/index.ts): `supabase/setup/functions/send-message/index.ts`

### AI features

- [Document ingestion](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/feed-ai/index.ts): `supabase/setup/functions/feed-ai/index.ts`
- [Room AI assistant](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/normsar-ai/index.ts): `supabase/setup/functions/normsar-ai/index.ts`
- [Daily briefing](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/silo-daily-briefing/index.ts): `supabase/setup/functions/silo-daily-briefing/index.ts`

### E2EE access

- [E2EE status](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/check-e2ee-status/index.ts): `supabase/setup/functions/check-e2ee-status/index.ts`
- [Lit key action](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/sponsor-lit-action/index.ts): `supabase/setup/functions/sponsor-lit-action/index.ts`
- [Membership verifier](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/functions/verify-membership/index.ts): `supabase/setup/functions/verify-membership/index.ts`

### Silo platform

- [Silo data schema](https://github.com/sengtha/normsar-silo/blob/main/supabase/setup/schema/normsar_silo_schema.sql): `supabase/setup/schema/normsar_silo_schema.sql`
- [Edge function gateway](https://github.com/sengtha/normsar-silo/blob/main/docker/volumes/functions/main/index.ts): `docker/volumes/functions/main/index.ts`
- [Database pooler](https://github.com/sengtha/normsar-silo/blob/main/docker/volumes/pooler/pooler.exs): `docker/volumes/pooler/pooler.exs`

### Other components

- **Silo member**
- **Normsar Hub**
- **Google Gemini**
- **Lit Protocol**
- **Google token service**

## Connections

- Silo member → Hub ticket auth: redeems ticket (evidence: `README.md`)
- Hub ticket auth → Normsar Hub: redeems ticket (evidence: `supabase/setup/functions/authenticate-hub-user/index.ts`)
- Silo member → Message actions: sends actions (evidence: `README.md`)
- Message actions → Silo data schema: reads and writes (evidence: `supabase/setup/functions/send-message/index.ts`)
- Message actions → Push relay: relays alert (evidence: `supabase/setup/functions/send-message/index.ts`)
- Push relay → Normsar Hub: sends alert (evidence: `supabase/setup/functions/send-message/index.ts`)
- Silo member → Document ingestion: feeds documents (evidence: `README.md`)
- Document ingestion → Silo data schema: reads and stores (evidence: `supabase/setup/functions/feed-ai/index.ts`)
- Document ingestion → Google Gemini: requests embeddings (evidence: `supabase/setup/functions/feed-ai/index.ts`)
- Silo member → Room AI assistant: asks room question (evidence: `README.md`)
- Room AI assistant → Silo data schema: queries and inserts (evidence: `supabase/setup/functions/normsar-ai/index.ts`)
- Room AI assistant → Google Gemini: embeds and generates (evidence: `supabase/setup/functions/normsar-ai/index.ts`)
- Silo member → Daily briefing: requests briefing (evidence: `README.md`)
- Daily briefing → Silo data schema: reads and records (evidence: `supabase/setup/functions/silo-daily-briefing/index.ts`)
- Daily briefing → Google Gemini: generates summary (evidence: `supabase/setup/functions/silo-daily-briefing/index.ts`)
- Silo member → E2EE status: checks configuration (evidence: `README.md`)
- Silo member → Lit key action: requests room key (evidence: `README.md`)
- Lit key action → Google token service: validates token (evidence: `supabase/setup/functions/sponsor-lit-action/index.ts`)
- Lit key action → Membership verifier: requests verification (evidence: `supabase/setup/functions/sponsor-lit-action/index.ts`)
- Membership verifier → Google token service: validates token (evidence: `supabase/setup/functions/verify-membership/index.ts`)
- Membership verifier → Silo data schema: checks membership (evidence: `supabase/setup/functions/verify-membership/index.ts`)
- Lit key action → Lit Protocol: executes action (evidence: `supabase/setup/functions/sponsor-lit-action/index.ts`)
- Edge function gateway → Silo member: dispatches requests (evidence: `README.md`)
