# greg-moiola/enclave architecture

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

- Interactive diagram: https://gitdiagram.com/greg-moiola/enclave
- Repository: https://github.com/greg-moiola/enclave

## Overview

The repository combines an Enclave web application—account access and messaging—with NEXUS visual-analysis tools and browser-side AI engines. The NEXUS workflow is to choose an analysis mode, provide an image, video, or live input, and inspect results; the sampled code directly confirms image and subject-search engine use. Enclave source excerpts show Firebase-backed authentication and chat-related writes. Several product files are indexed but not excerpted, so their finer behavior and some links are intentionally omitted.

Main entry points: [`tools/nexus-studio/src/App.tsx`](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/App.tsx) (Studio navigation), [`js/script.js`](https://github.com/greg-moiola/enclave/blob/main_1/js/script.js) (Enclave interface), [`js/auth.js`](https://github.com/greg-moiola/enclave/blob/main_1/js/auth.js) (Account access), [`js/firebase.js`](https://github.com/greg-moiola/enclave/blob/main_1/js/firebase.js) (Firebase setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_enclave["Enclave application"]
  node_enclave_app["Enclave interface<br/>[script.js]"]
  node_accounts["Account access<br/>[auth.js]"]
  node_firebase_config["Firebase setup<br/>[firebase.js]"]
  node_voice["Voice feature<br/>[enclave-voice.js]"]
  node_future_mode["Future mode<br/>[future-mode.js]"]
end

subgraph group_nexus_ui["NEXUS Studio"]
  node_studio_app["Studio navigation<br/>[App.tsx]"]
  node_image_ui["Image analysis<br/>[ImageAnalysis.tsx]"]
  node_live_ui["Live analysis<br/>[LiveAnalysis.tsx]"]
  node_video_ui["Video analysis<br/>[VideoAnalysis.tsx]"]
  node_search_ui["Subject search<br/>[SubjectSearch.tsx]"]
  node_settings_ui["Settings<br/>[SettingsPage.tsx]"]
  node_studio_human["Face and emotion engine<br/>[humanEngine.ts]"]
  node_studio_search["Subject matching engine"]
end

subgraph group_engine_package["NEXUS engine package"]
  node_pkg_human["Face and emotion engine<br/>[humanEngine.ts]"]
  node_pkg_search["Subject matching engine"]
  node_engine_api["Engine API<br/>[index.ts]"]
end

subgraph group_engine_runtime["Engine runtime"]
  node_browser_engine["Browser engine API<br/>[nexus-engine.js]"]
  node_human_bundle["Human engine bundle"]
  node_search_bundle["Subject search bundle"]
end

node_user(("User"))
node_firebase_auth["Firebase Auth"]
node_firestore[("Cloud Firestore")]
node_studio_user(("Studio user"))

node_user -->|"uses"| node_enclave_app
node_enclave_app -->|"handles access"| node_accounts
node_accounts -->|"uses services"| node_firebase_config
node_enclave_app -->|"uses services"| node_firebase_config
node_firebase_config -->|"initializes"| node_firebase_auth
node_firebase_config -->|"initializes"| node_firestore
node_accounts -->|"authenticates"| node_firebase_auth
node_accounts -->|"reads and writes"| node_firestore
node_enclave_app -->|"stores chat data"| node_firestore
node_studio_user -->|"uses"| node_studio_app
node_studio_app -->|"shows mode"| node_image_ui
node_studio_app -->|"shows mode"| node_live_ui
node_studio_app -->|"shows mode"| node_video_ui
node_studio_app -->|"shows mode"| node_search_ui
node_studio_app -->|"shows mode"| node_settings_ui
node_image_ui -->|"analyzes image"| node_studio_human
node_search_ui -->|"runs search"| node_studio_search
node_video_ui -.->|"analyzes video"| node_studio_search
node_engine_api -->|"exports engine"| node_pkg_human
node_engine_api -->|"exports engine"| node_pkg_search
node_browser_engine -->|"loads dynamically"| node_human_bundle
node_browser_engine -->|"loads dynamically"| node_search_bundle

click node_enclave_app "https://github.com/greg-moiola/enclave/blob/main_1/js/script.js"
click node_accounts "https://github.com/greg-moiola/enclave/blob/main_1/js/auth.js"
click node_firebase_config "https://github.com/greg-moiola/enclave/blob/main_1/js/firebase.js"
click node_voice "https://github.com/greg-moiola/enclave/blob/main_1/js/enclave-voice.js"
click node_future_mode "https://github.com/greg-moiola/enclave/blob/main_1/js/future-mode.js"
click node_studio_app "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/App.tsx"
click node_image_ui "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/ImageAnalysis.tsx"
click node_live_ui "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/LiveAnalysis.tsx"
click node_video_ui "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/VideoAnalysis.tsx"
click node_search_ui "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/SubjectSearch.tsx"
click node_settings_ui "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/SettingsPage.tsx"
click node_studio_human "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/ai/humanEngine.ts"
click node_studio_search "https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/ai/subjectSearchEngine.ts"
click node_pkg_human "https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/humanEngine.ts"
click node_pkg_search "https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/subjectSearchEngine.ts"
click node_engine_api "https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/index.ts"
click node_browser_engine "https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/nexus-engine.js"
click node_human_bundle "https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/assets/humanEngine-I5UjYiTY.js"
click node_search_bundle "https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/assets/subjectSearchEngine-BAwZycqC.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_enclave_app,node_accounts,node_firebase_config,node_voice,node_future_mode,node_user,node_studio_user toneBlue
class node_studio_app,node_image_ui,node_live_ui,node_video_ui,node_search_ui,node_settings_ui,node_studio_human,node_studio_search,node_firestore toneAmber
class node_pkg_human,node_pkg_search,node_engine_api toneMint
class node_browser_engine,node_human_bundle,node_search_bundle toneRose
class node_firebase_auth toneIndigo
```

## Components

### Enclave application

- [Enclave interface](https://github.com/greg-moiola/enclave/blob/main_1/js/script.js): `js/script.js`
- [Account access](https://github.com/greg-moiola/enclave/blob/main_1/js/auth.js): `js/auth.js`
- [Firebase setup](https://github.com/greg-moiola/enclave/blob/main_1/js/firebase.js): `js/firebase.js`
- [Voice feature](https://github.com/greg-moiola/enclave/blob/main_1/js/enclave-voice.js): `js/enclave-voice.js`
- [Future mode](https://github.com/greg-moiola/enclave/blob/main_1/js/future-mode.js): `js/future-mode.js`

### NEXUS Studio

- [Studio navigation](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/App.tsx): `tools/nexus-studio/src/App.tsx`
- [Image analysis](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/ImageAnalysis.tsx): `tools/nexus-studio/src/components/ImageAnalysis.tsx`
- [Live analysis](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/LiveAnalysis.tsx): `tools/nexus-studio/src/components/LiveAnalysis.tsx`
- [Video analysis](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/VideoAnalysis.tsx): `tools/nexus-studio/src/components/VideoAnalysis.tsx`
- [Subject search](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/SubjectSearch.tsx): `tools/nexus-studio/src/components/SubjectSearch.tsx`
- [Settings](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/components/SettingsPage.tsx): `tools/nexus-studio/src/components/SettingsPage.tsx`
- [Face and emotion engine](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/ai/humanEngine.ts): `tools/nexus-studio/src/ai/humanEngine.ts`
- [Subject matching engine](https://github.com/greg-moiola/enclave/blob/main_1/tools/nexus-studio/src/ai/subjectSearchEngine.ts): `tools/nexus-studio/src/ai/subjectSearchEngine.ts`

### NEXUS engine package

- [Face and emotion engine](https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/humanEngine.ts): `packages/nexus-engine/src/humanEngine.ts`
- [Subject matching engine](https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/subjectSearchEngine.ts): `packages/nexus-engine/src/subjectSearchEngine.ts`
- [Engine API](https://github.com/greg-moiola/enclave/blob/main_1/packages/nexus-engine/src/index.ts): `packages/nexus-engine/src/index.ts`

### Engine runtime

- [Browser engine API](https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/nexus-engine.js): `nexus-engine/nexus-engine.js`
- [Human engine bundle](https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/assets/humanEngine-I5UjYiTY.js): `nexus-engine/assets/humanEngine-I5UjYiTY.js`
- [Subject search bundle](https://github.com/greg-moiola/enclave/blob/main_1/nexus-engine/assets/subjectSearchEngine-BAwZycqC.js): `nexus-engine/assets/subjectSearchEngine-BAwZycqC.js`

### Other components

- **User**
- **Firebase Auth**
- **Cloud Firestore**
- **Studio user**

## Connections

- User → Enclave interface: uses (evidence: `js/script.js`)
- Enclave interface → Account access: handles access (evidence: `js/script.js`)
- Account access → Firebase setup: uses services (evidence: `js/auth.js`)
- Enclave interface → Firebase setup: uses services (evidence: `js/script.js`)
- Firebase setup → Firebase Auth: initializes (evidence: `js/firebase.js`)
- Firebase setup → Cloud Firestore: initializes (evidence: `js/firebase.js`)
- Account access → Firebase Auth: authenticates (evidence: `js/auth.js`)
- Account access → Cloud Firestore: reads and writes (evidence: `js/auth.js`)
- Enclave interface → Cloud Firestore: stores chat data (evidence: `js/script.js`)
- Studio user → Studio navigation: uses (evidence: `tools/nexus-studio/src/App.tsx`)
- Studio navigation → Image analysis: shows mode (evidence: `tools/nexus-studio/src/App.tsx`)
- Studio navigation → Live analysis: shows mode (evidence: `tools/nexus-studio/src/App.tsx`)
- Studio navigation → Video analysis: shows mode (evidence: `tools/nexus-studio/src/App.tsx`)
- Studio navigation → Subject search: shows mode (evidence: `tools/nexus-studio/src/App.tsx`)
- Studio navigation → Settings: shows mode (evidence: `tools/nexus-studio/src/App.tsx`)
- Image analysis → Face and emotion engine: analyzes image (evidence: `tools/nexus-studio/src/components/ImageAnalysis.tsx`)
- Subject search → Subject matching engine: runs search (evidence: `tools/nexus-studio/src/components/SubjectSearch.tsx`)
- Video analysis → Subject matching engine: analyzes video
- Engine API → Face and emotion engine: exports engine (evidence: `packages/nexus-engine/src/index.ts`)
- Engine API → Subject matching engine: exports engine (evidence: `packages/nexus-engine/src/index.ts`)
- Browser engine API → Human engine bundle: loads dynamically (evidence: `nexus-engine/nexus-engine.js`)
- Browser engine API → Subject search bundle: loads dynamically (evidence: `nexus-engine/nexus-engine.js`)
