# lonewolfden/project_onion architecture

> Architecture diagram of the GitHub repository lonewolfden/project_onion, 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/lonewolfden/project_onion
- Repository: https://github.com/lonewolfden/project_onion

## Overview

Project Onion is a client/project relationship workspace: users browse or register engagements, capture identifiers and source links, then review project cards, notes, contacts and key moments. Its main UI supports editing, archiving with justification, Client 360 views, privacy controls and a grounded Smart Assistant. Documented integrations add connected-record capture and GDP/SharePoint/Excel-derived material. The graph reflects README capabilities and sampled service behavior; several adapter and governance implementations were not sampled, so their internal wiring is intentionally limited.

Main entry points: [`modules/experience-pwa/static/js/components/App.js`](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/components/App.js) (Project workspace), [`modules/platform-anchor/service.py`](https://github.com/lonewolfden/project_onion/blob/main/modules/platform-anchor/service.py) (Anchor service), [`modules/connected-bookmarklet/bookmarklet.js`](https://github.com/lonewolfden/project_onion/blob/main/modules/connected-bookmarklet/bookmarklet.js) (Connected capture), [`modules/experience-pwa/static/js/main.js`](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/main.js) (PWA entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Workspace experience"]
  node_pwa["Project workspace<br/>[App.js]"]
  node_pwa_entry["PWA entry<br/>[main.js]"]
  node_localdb[("Offline state<br/>[FailoverDB.js]")]
end

subgraph group_capture["Capture and ingest"]
  node_bookmarklet["Connected capture<br/>[bookmarklet.js]"]
  node_bookmark_service["Capture endpoint<br/>[service.py]"]
  node_gdp["GDP adapter<br/>[service.py]"]
  node_excel["Excel parser"]
  node_sharepoint["SharePoint adapter"]
end

subgraph group_domain["Project domain"]
  node_anchor["Anchor service<br/>[service.py]"]
  node_anchor_store[("Anchor records<br/>[service.py]")]
  node_cards["Cards service<br/>[service.py]"]
  node_fusion["Fusion engine<br/>[fuse.js]"]
end

subgraph group_intelligence["Search and intelligence"]
  node_assistant["Smart Assistant<br/>[App.js]"]
  node_ai_client["AI client<br/>[AiClient.js]"]
  node_vector_api["Vector search API<br/>[main.py]"]
  node_vector_store[("Vector store<br/>[store.py]")]
end

subgraph group_governance["Governance"]
  node_pii["PII screening<br/>[PiiGate.js]"]
  node_relationship_admin["Relationship model admin<br/>[service.py]"]
  node_relationship_data[("Relationship model")]
end

node_user(("Workspace user"))
node_openrouter["OpenRouter"]

node_user -->|"opens workspace"| node_pwa_entry
node_pwa_entry -->|"renders"| node_pwa
node_pwa -->|"reads and writes"| node_localdb
node_pwa -->|"manages projects"| node_anchor
node_anchor -->|"persists records"| node_anchor_store
node_pwa -.->|"loads project cards"| node_cards
node_pwa -->|"asks questions"| node_assistant
node_assistant -->|"queries context"| node_ai_client
node_ai_client -.->|"requests completion"| node_openrouter
node_assistant -->|"searches cards"| node_vector_api
node_vector_api -->|"queries and updates"| node_vector_store
node_user -->|"captures engagement"| node_bookmarklet
node_bookmarklet -->|"opens installer"| node_bookmark_service
node_bookmarklet -->|"submits identifiers"| node_anchor
node_gdp -.->|"provides engagement data"| node_anchor
node_excel -.->|"imports weekly data"| node_cards
node_sharepoint -.->|"supplies source links"| node_anchor
node_pwa -->|"screens note text"| node_pii
node_relationship_admin -->|"reads and updates"| node_relationship_data

click node_pwa "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/components/App.js"
click node_pwa_entry "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/main.js"
click node_localdb "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/FailoverDB.js"
click node_anchor "https://github.com/lonewolfden/project_onion/blob/main/modules/platform-anchor/service.py"
click node_anchor_store "https://github.com/lonewolfden/project_onion/blob/main/modules/platform-anchor/service.py"
click node_cards "https://github.com/lonewolfden/project_onion/blob/main/modules/domain-cards-store/service.py"
click node_fusion "https://github.com/lonewolfden/project_onion/blob/main/modules/domain-fusion-engine/fuse.js"
click node_bookmarklet "https://github.com/lonewolfden/project_onion/blob/main/modules/connected-bookmarklet/bookmarklet.js"
click node_bookmark_service "https://github.com/lonewolfden/project_onion/blob/main/modules/connected-bookmarklet/service.py"
click node_gdp "https://github.com/lonewolfden/project_onion/blob/main/modules/gdp-adapter/service.py"
click node_excel "https://github.com/lonewolfden/project_onion/tree/main/modules/integrations-excel-parser"
click node_sharepoint "https://github.com/lonewolfden/project_onion/tree/main/modules/integrations-sharepoint-adapter"
click node_assistant "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/components/App.js"
click node_ai_client "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/AiClient.js"
click node_vector_api "https://github.com/lonewolfden/project_onion/blob/main/modules/vector-service/main.py"
click node_vector_store "https://github.com/lonewolfden/project_onion/blob/main/modules/vector-service/store.py"
click node_pii "https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/PiiGate.js"
click node_relationship_admin "https://github.com/lonewolfden/project_onion/blob/main/modules/admin-relationship/service.py"
click node_relationship_data "https://github.com/lonewolfden/project_onion/blob/main/data/seed/relationship_model.json"

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_pwa,node_pwa_entry,node_localdb,node_user toneBlue
class node_bookmarklet,node_bookmark_service,node_gdp,node_excel,node_sharepoint toneAmber
class node_anchor,node_anchor_store,node_cards,node_fusion,node_openrouter toneMint
class node_assistant,node_ai_client,node_vector_api,node_vector_store toneRose
class node_pii,node_relationship_admin,node_relationship_data toneIndigo
```

## Components

### Workspace experience

- [Project workspace](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/components/App.js): `modules/experience-pwa/static/js/components/App.js`
- [PWA entry](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/main.js): `modules/experience-pwa/static/js/main.js`
- [Offline state](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/FailoverDB.js): `modules/experience-pwa/static/js/core/FailoverDB.js`

### Capture and ingest

- [Connected capture](https://github.com/lonewolfden/project_onion/blob/main/modules/connected-bookmarklet/bookmarklet.js): `modules/connected-bookmarklet/bookmarklet.js`
- [Capture endpoint](https://github.com/lonewolfden/project_onion/blob/main/modules/connected-bookmarklet/service.py): `modules/connected-bookmarklet/service.py`
- [GDP adapter](https://github.com/lonewolfden/project_onion/blob/main/modules/gdp-adapter/service.py): `modules/gdp-adapter/service.py`
- [Excel parser](https://github.com/lonewolfden/project_onion/tree/main/modules/integrations-excel-parser): `modules/integrations-excel-parser`
- [SharePoint adapter](https://github.com/lonewolfden/project_onion/tree/main/modules/integrations-sharepoint-adapter): `modules/integrations-sharepoint-adapter`

### Project domain

- [Anchor service](https://github.com/lonewolfden/project_onion/blob/main/modules/platform-anchor/service.py): `modules/platform-anchor/service.py`
- [Anchor records](https://github.com/lonewolfden/project_onion/blob/main/modules/platform-anchor/service.py): `modules/platform-anchor/service.py`
- [Cards service](https://github.com/lonewolfden/project_onion/blob/main/modules/domain-cards-store/service.py): `modules/domain-cards-store/service.py`
- [Fusion engine](https://github.com/lonewolfden/project_onion/blob/main/modules/domain-fusion-engine/fuse.js): `modules/domain-fusion-engine/fuse.js`

### Search and intelligence

- [Smart Assistant](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/components/App.js): `modules/experience-pwa/static/js/components/App.js`
- [AI client](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/AiClient.js): `modules/experience-pwa/static/js/core/AiClient.js`
- [Vector search API](https://github.com/lonewolfden/project_onion/blob/main/modules/vector-service/main.py): `modules/vector-service/main.py`
- [Vector store](https://github.com/lonewolfden/project_onion/blob/main/modules/vector-service/store.py): `modules/vector-service/store.py`

### Governance

- [PII screening](https://github.com/lonewolfden/project_onion/blob/main/modules/experience-pwa/static/js/core/PiiGate.js): `modules/experience-pwa/static/js/core/PiiGate.js`
- [Relationship model admin](https://github.com/lonewolfden/project_onion/blob/main/modules/admin-relationship/service.py): `modules/admin-relationship/service.py`
- [Relationship model](https://github.com/lonewolfden/project_onion/blob/main/data/seed/relationship_model.json): `data/seed/relationship_model.json`

### Other components

- **Workspace user**
- **OpenRouter**

## Connections

- Workspace user → PWA entry: opens workspace
- PWA entry → Project workspace: renders
- Project workspace → Offline state: reads and writes
- Project workspace → Anchor service: manages projects
- Anchor service → Anchor records: persists records
- Project workspace → Cards service: loads project cards
- Project workspace → Smart Assistant: asks questions
- Smart Assistant → AI client: queries context
- AI client → OpenRouter: requests completion
- Smart Assistant → Vector search API: searches cards
- Vector search API → Vector store: queries and updates
- Workspace user → Connected capture: captures engagement
- Connected capture → Capture endpoint: opens installer
- Connected capture → Anchor service: submits identifiers
- GDP adapter → Anchor service: provides engagement data
- Excel parser → Cards service: imports weekly data
- SharePoint adapter → Anchor service: supplies source links
- Project workspace → PII screening: screens note text
- Relationship model admin → Relationship model: reads and updates
