# awesomezun/fddd architecture

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

- Interactive diagram: https://gitdiagram.com/awesomezun/fddd
- Repository: https://github.com/awesomezun/fddd

## Overview

FDDD is a browser-based research demo: users inspect completed molecular docking poses while virtual flies receive score-derived rewards, run independent MaleCNS neural models, learn candidate preferences, and move among candidates. The live dashboard coordinates the colony and presents brain activity, docking, flight, and residence; recordings remain in browser storage. The graph preserves the documented screening and molecular-inspection capabilities. Several subsystem details are documented but their implementation was not sampled, so those relationships are cited to the README or left unconnected rather than inferred.

Main entry points: [`src/platform/v3.0.0/Platform.tsx`](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/Platform.tsx) (Live dashboard), [`src/lib/useContinuousColony.ts`](https://github.com/awesomezun/fddd/blob/main/src/lib/useContinuousColony.ts) (Colony orchestration), [`src/lib/useScreening.ts`](https://github.com/awesomezun/fddd/blob/main/src/lib/useScreening.ts) (Candidate screening), [`src/platform/v3.0.0/useLab.ts`](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/useLab.ts) (Lab session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Research dashboard"]
  node_dashboard["Live dashboard<br/>[Platform.tsx]"]
  node_lab["Lab session<br/>[useLab.ts]"]
end

subgraph group_domain["Experiment model"]
  node_colony["Colony orchestration"]
  node_policy["Reward and policy<br/>[colonyPolicy.ts]"]
  node_docking["Docking data<br/>[docking.ts]"]
  node_screening["Candidate screening<br/>[useScreening.ts]"]
  node_learning["Reward learning<br/>[rewardLearning.ts]"]
  node_flight["Flight dynamics<br/>[flight.ts]"]
end

subgraph group_runtime["Neural runtime"]
  node_cns["MaleCNS dataset<br/>[cnsDataset.ts]"]
  node_maleengine["MaleCNS engine<br/>[core.js]"]
  node_maleworker["MaleCNS worker<br/>[worker.js]"]
  node_malecodec["MaleCNS spike codec<br/>[spike-codec.js]"]
  node_flyengine["FlyWire engine<br/>[core.js]"]
  node_flyworker["FlyWire worker<br/>[worker.js]"]
  node_flycodec["FlyWire spike codec<br/>[spike-codec.js]"]
end

subgraph group_views["Scientific views"]
  node_habitat["Colony habitat<br/>[ColonyHabitat.tsx]"]
  node_brain["Brain activity view<br/>[BrainGrid.tsx]"]
  node_observatory["Neural observatory"]
  node_molecule["Molecular scene<br/>[MoleculeScene.tsx]"]
  node_protein["Protein rendering<br/>[ProteinRibbon.ts]"]
end

subgraph group_records["Recording"]
  node_trace[("Neural recordings<br/>[neuralRecord.ts]")]
end

node_researcher(("Researcher"))

node_researcher -->|"uses"| node_dashboard
node_dashboard -->|"gets session"| node_lab
node_lab -->|"starts colony"| node_colony
node_colony -->|"uses policy"| node_policy
node_colony -->|"steps flights"| node_flight
node_colony -->|"records activity"| node_trace
node_policy -->|"encodes cues"| node_learning
node_policy -->|"reads metadata"| node_cns
node_flight -->|"reads dataset"| node_cns
node_dashboard -->|"renders colony"| node_habitat
node_dashboard -->|"renders activity"| node_brain
node_dashboard -->|"renders observatory"| node_observatory
node_dashboard -->|"renders poses"| node_molecule
node_molecule -->|"renders structures"| node_protein
node_lab -.->|"loads candidates"| node_docking
node_screening -->|"uses docking data"| node_docking
node_screening -->|"computes rewards"| node_learning
node_screening -->|"runs trials"| node_flight
node_screening -->|"records trials"| node_trace
node_maleworker -->|"dispatches computation"| node_maleengine
node_maleworker -->|"encodes spikes"| node_malecodec
node_flyworker -->|"dispatches computation"| node_flyengine
node_flyworker -->|"encodes spikes"| node_flycodec
node_colony -.->|"runs neural models"| node_maleworker

click node_dashboard "https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/Platform.tsx"
click node_lab "https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/useLab.ts"
click node_colony "https://github.com/awesomezun/fddd/blob/main/src/lib/useContinuousColony.ts"
click node_policy "https://github.com/awesomezun/fddd/blob/main/src/lib/colonyPolicy.ts"
click node_docking "https://github.com/awesomezun/fddd/blob/main/src/lib/docking.ts"
click node_screening "https://github.com/awesomezun/fddd/blob/main/src/lib/useScreening.ts"
click node_learning "https://github.com/awesomezun/fddd/blob/main/src/lib/rewardLearning.ts"
click node_flight "https://github.com/awesomezun/fddd/blob/main/src/lib/flight.ts"
click node_cns "https://github.com/awesomezun/fddd/blob/main/src/lib/cnsDataset.ts"
click node_maleengine "https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/core.js"
click node_maleworker "https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/worker.js"
click node_malecodec "https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/spike-codec.js"
click node_flyengine "https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/core.js"
click node_flyworker "https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/worker.js"
click node_flycodec "https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/spike-codec.js"
click node_habitat "https://github.com/awesomezun/fddd/blob/main/src/components/ColonyHabitat.tsx"
click node_brain "https://github.com/awesomezun/fddd/blob/main/src/components/BrainGrid.tsx"
click node_observatory "https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/NeuralObservatory.tsx"
click node_molecule "https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/MoleculeScene.tsx"
click node_protein "https://github.com/awesomezun/fddd/blob/main/src/components/ProteinRibbon.ts"
click node_trace "https://github.com/awesomezun/fddd/blob/main/src/lib/neuralRecord.ts"

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_dashboard,node_lab toneBlue
class node_colony,node_policy,node_docking,node_screening,node_learning,node_flight toneAmber
class node_cns,node_maleengine,node_maleworker,node_malecodec,node_flyengine,node_flyworker,node_flycodec toneMint
class node_habitat,node_brain,node_observatory,node_molecule,node_protein toneRose
class node_trace,node_researcher toneIndigo
```

## Components

### Research dashboard

- [Live dashboard](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/Platform.tsx): `src/platform/v3.0.0/Platform.tsx`
- [Lab session](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/useLab.ts): `src/platform/v3.0.0/useLab.ts`

### Experiment model

- [Colony orchestration](https://github.com/awesomezun/fddd/blob/main/src/lib/useContinuousColony.ts): `src/lib/useContinuousColony.ts`
- [Reward and policy](https://github.com/awesomezun/fddd/blob/main/src/lib/colonyPolicy.ts): `src/lib/colonyPolicy.ts`
- [Docking data](https://github.com/awesomezun/fddd/blob/main/src/lib/docking.ts): `src/lib/docking.ts`
- [Candidate screening](https://github.com/awesomezun/fddd/blob/main/src/lib/useScreening.ts): `src/lib/useScreening.ts`
- [Reward learning](https://github.com/awesomezun/fddd/blob/main/src/lib/rewardLearning.ts): `src/lib/rewardLearning.ts`
- [Flight dynamics](https://github.com/awesomezun/fddd/blob/main/src/lib/flight.ts): `src/lib/flight.ts`

### Neural runtime

- [MaleCNS dataset](https://github.com/awesomezun/fddd/blob/main/src/lib/cnsDataset.ts): `src/lib/cnsDataset.ts`
- [MaleCNS engine](https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/core.js): `public/engine/malecns/core.js`
- [MaleCNS worker](https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/worker.js): `public/engine/malecns/worker.js`
- [MaleCNS spike codec](https://github.com/awesomezun/fddd/blob/main/public/engine/malecns/spike-codec.js): `public/engine/malecns/spike-codec.js`
- [FlyWire engine](https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/core.js): `public/engine/flywire/core.js`
- [FlyWire worker](https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/worker.js): `public/engine/flywire/worker.js`
- [FlyWire spike codec](https://github.com/awesomezun/fddd/blob/main/public/engine/flywire/spike-codec.js): `public/engine/flywire/spike-codec.js`

### Scientific views

- [Colony habitat](https://github.com/awesomezun/fddd/blob/main/src/components/ColonyHabitat.tsx): `src/components/ColonyHabitat.tsx`
- [Brain activity view](https://github.com/awesomezun/fddd/blob/main/src/components/BrainGrid.tsx): `src/components/BrainGrid.tsx`
- [Neural observatory](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/NeuralObservatory.tsx): `src/platform/v3.0.0/NeuralObservatory.tsx`
- [Molecular scene](https://github.com/awesomezun/fddd/blob/main/src/platform/v3.0.0/MoleculeScene.tsx): `src/platform/v3.0.0/MoleculeScene.tsx`
- [Protein rendering](https://github.com/awesomezun/fddd/blob/main/src/components/ProteinRibbon.ts): `src/components/ProteinRibbon.ts`

### Recording

- [Neural recordings](https://github.com/awesomezun/fddd/blob/main/src/lib/neuralRecord.ts): `src/lib/neuralRecord.ts`

### Other components

- **Researcher**

## Connections

- Researcher → Live dashboard: uses (evidence: `README.md`)
- Live dashboard → Lab session: gets session (evidence: `src/platform/v3.0.0/Platform.tsx`)
- Lab session → Colony orchestration: starts colony (evidence: `src/platform/v3.0.0/useLab.ts`)
- Colony orchestration → Reward and policy: uses policy (evidence: `src/lib/useContinuousColony.ts`)
- Colony orchestration → Flight dynamics: steps flights (evidence: `src/lib/useContinuousColony.ts`)
- Colony orchestration → Neural recordings: records activity (evidence: `src/lib/useContinuousColony.ts`)
- Reward and policy → Reward learning: encodes cues (evidence: `src/lib/colonyPolicy.ts`)
- Reward and policy → MaleCNS dataset: reads metadata (evidence: `src/lib/colonyPolicy.ts`)
- Flight dynamics → MaleCNS dataset: reads dataset (evidence: `src/lib/flight.ts`)
- Live dashboard → Colony habitat: renders colony (evidence: `src/platform/v3.0.0/Platform.tsx`)
- Live dashboard → Brain activity view: renders activity (evidence: `src/platform/v3.0.0/Platform.tsx`)
- Live dashboard → Neural observatory: renders observatory (evidence: `src/platform/v3.0.0/Platform.tsx`)
- Live dashboard → Molecular scene: renders poses (evidence: `src/platform/v3.0.0/Platform.tsx`)
- Molecular scene → Protein rendering: renders structures (evidence: `src/platform/v3.0.0/MoleculeScene.tsx`)
- Lab session → Docking data: loads candidates
- Candidate screening → Docking data: uses docking data (evidence: `src/lib/useScreening.ts`)
- Candidate screening → Reward learning: computes rewards (evidence: `src/lib/useScreening.ts`)
- Candidate screening → Flight dynamics: runs trials (evidence: `src/lib/useScreening.ts`)
- Candidate screening → Neural recordings: records trials (evidence: `src/lib/useScreening.ts`)
- MaleCNS worker → MaleCNS engine: dispatches computation (evidence: `public/engine/malecns/worker.js`)
- MaleCNS worker → MaleCNS spike codec: encodes spikes (evidence: `public/engine/malecns/worker.js`)
- FlyWire worker → FlyWire engine: dispatches computation (evidence: `public/engine/flywire/worker.js`)
- FlyWire worker → FlyWire spike codec: encodes spikes (evidence: `public/engine/flywire/worker.js`)
- Colony orchestration → MaleCNS worker: runs neural models
