# sanjith0/sentry4d-cv architecture

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

- Interactive diagram: https://gitdiagram.com/sanjith0/sentry4d-cv
- Repository: https://github.com/sanjith0/sentry4d-cv

## Overview

Sentry4D is an interactive security-investigation console. The principal workflow is to synchronize CCTV recordings with a 3D room, calibrate camera poses, annotate subject positions from video, and inspect the resulting tracks and cross-camera evidence in the replay. Separate branches cover reconstructed appearance/avatar rendering, an AR view, and investigator tooling. The graph follows shown imports and calls plus README descriptions; several UI internals and the investigator API wiring were not sampled, so those relationships are omitted.

Main entry points: [`src/scene/Scene3D.tsx`](https://github.com/sanjith0/sentry4d-cv/blob/main/src/scene/Scene3D.tsx) (3D scene), [`src/app/App.tsx`](https://github.com/sanjith0/sentry4d-cv/blob/main/src/app/App.tsx) (Application shell), [`src/store/useReplayStore.ts`](https://github.com/sanjith0/sentry4d-cv/blob/main/src/store/useReplayStore.ts) (Master replay state), [`src/features/sentry/useEvidence.ts`](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/useEvidence.ts) (Evidence evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Investigation console"]
  node_app["Application shell<br/>[App.tsx]"]
  node_feeds["CCTV feeds<br/>[CCTVFeed.tsx]"]
  node_calibration["Camera calibration"]
  node_camera_config["Camera configuration<br/>[cameras.ts]"]
  node_timeline["Replay timeline<br/>[ReplayTimeline.tsx]"]
end

subgraph group_tracking["Annotation and tracking"]
  node_annotation_ui["Annotation panel"]
  node_annotation_store[("Annotation data")]
  node_projection["Video-floor projection<br/>[videoProjection.ts]"]
  node_subject_tracks["Subject tracks"]
  node_trajectory["Trajectory fusion<br/>[trajectory.ts]"]
  node_evidence_sync["Evidence evaluation<br/>[useEvidence.ts]"]
  node_evidence_data["Evidence rules<br/>[evidence.ts]"]
  node_subjects["Subject configuration<br/>[subjects.ts]"]
end

subgraph group_scene["3D scene and replay"]
  node_replay["Master replay state<br/>[useReplayStore.ts]"]
  node_view_state["View state<br/>[useViewStore.ts]"]
  node_scene3d["3D scene<br/>[Scene3D.tsx]"]
  node_viewport["Viewport camera<br/>[viewportCamera.ts]"]
end

subgraph group_reconstruction["Reconstruction and AR"]
  node_appearance_store["Appearance assets"]
  node_appearance_layer["Appearance rendering"]
  node_avatar_store["Avatar assets<br/>[useAvatarStore.ts]"]
  node_avatar_layer["Avatar rendering<br/>[AvatarLayer.tsx]"]
  node_ar["AR experience<br/>[ARApp.tsx]"]
end

subgraph group_investigator["Investigator tooling"]
  node_investigator_ui["Investigator panel"]
  node_investigator_backend["Investigator service<br/>[investigator.ts]"]
  node_server_entry["Server entry<br/>[entry.ts]"]
end

node_user(("Investigator"))

node_user -->|"uses"| node_app
node_app -->|"mounts"| node_scene3d
node_app -->|"mounts"| node_timeline
node_app -->|"mounts"| node_annotation_ui
node_app -->|"starts"| node_evidence_sync
node_feeds -.->|"uses camera definitions"| node_camera_config
node_calibration -->|"edits poses"| node_camera_config
node_calibration -->|"updates poses"| node_replay
node_timeline -.->|"controls playback"| node_replay
node_scene3d -->|"reads time"| node_replay
node_scene3d -->|"reads view state"| node_view_state
node_scene3d -->|"uses camera"| node_viewport
node_annotation_ui -.->|"records annotations"| node_annotation_store
node_annotation_ui -.->|"projects clicks"| node_projection
node_annotation_store -->|"reads master time"| node_replay
node_subject_tracks -->|"reads observations"| node_annotation_store
node_subject_tracks -->|"builds tracks"| node_trajectory
node_trajectory -->|"uses track settings"| node_subjects
node_evidence_sync -->|"reads observations"| node_annotation_store
node_evidence_sync -->|"builds and evaluates"| node_evidence_data
node_evidence_sync -->|"reads replay state"| node_replay
node_evidence_data -->|"uses subject definitions"| node_subjects
node_scene3d -->|"renders"| node_appearance_layer
node_appearance_store -.->|"provides assets"| node_appearance_layer
node_scene3d -.->|"renders"| node_avatar_layer
node_avatar_store -.->|"provides motion"| node_avatar_layer
node_ar -->|"renders"| node_appearance_layer
node_ar -->|"reuses scene components"| node_scene3d
node_server_entry -->|"dispatches to"| node_investigator_backend

click node_app "https://github.com/sanjith0/sentry4d-cv/blob/main/src/app/App.tsx"
click node_feeds "https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/CCTVFeed.tsx"
click node_calibration "https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/CalibrationPanel.tsx"
click node_camera_config "https://github.com/sanjith0/sentry4d-cv/blob/main/src/config/cameras.ts"
click node_replay "https://github.com/sanjith0/sentry4d-cv/blob/main/src/store/useReplayStore.ts"
click node_view_state "https://github.com/sanjith0/sentry4d-cv/blob/main/src/store/useViewStore.ts"
click node_scene3d "https://github.com/sanjith0/sentry4d-cv/blob/main/src/scene/Scene3D.tsx"
click node_viewport "https://github.com/sanjith0/sentry4d-cv/blob/main/src/scene/viewportCamera.ts"
click node_timeline "https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/ReplayTimeline.tsx"
click node_annotation_ui "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/annotation/AnnotationPanel.tsx"
click node_annotation_store "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/annotation/useAnnotationStore.ts"
click node_projection "https://github.com/sanjith0/sentry4d-cv/blob/main/src/lib/videoProjection.ts"
click node_subject_tracks "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/useSubjectTracks.ts"
click node_trajectory "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/trajectory.ts"
click node_evidence_sync "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/useEvidence.ts"
click node_evidence_data "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/evidence.ts"
click node_subjects "https://github.com/sanjith0/sentry4d-cv/blob/main/src/config/subjects.ts"
click node_appearance_store "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/useAppearanceStore.ts"
click node_appearance_layer "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/AppearanceLayer.tsx"
click node_avatar_store "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/useAvatarStore.ts"
click node_avatar_layer "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/AvatarLayer.tsx"
click node_ar "https://github.com/sanjith0/sentry4d-cv/blob/main/src/ar/ARApp.tsx"
click node_investigator_ui "https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/investigator/InvestigatorPanel.tsx"
click node_investigator_backend "https://github.com/sanjith0/sentry4d-cv/blob/main/server/investigator.ts"
click node_server_entry "https://github.com/sanjith0/sentry4d-cv/blob/main/server/vercel/entry.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_app,node_feeds,node_calibration,node_camera_config,node_timeline toneBlue
class node_annotation_ui,node_annotation_store,node_projection,node_subject_tracks,node_trajectory,node_evidence_sync,node_evidence_data,node_subjects toneAmber
class node_replay,node_view_state,node_scene3d,node_viewport toneMint
class node_appearance_store,node_appearance_layer,node_avatar_store,node_avatar_layer,node_ar toneRose
class node_investigator_ui,node_investigator_backend,node_server_entry,node_user toneIndigo
```

## Components

### Investigation console

- [Application shell](https://github.com/sanjith0/sentry4d-cv/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [CCTV feeds](https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/CCTVFeed.tsx): `src/dashboard/CCTVFeed.tsx`
- [Camera calibration](https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/CalibrationPanel.tsx): `src/dashboard/CalibrationPanel.tsx`
- [Camera configuration](https://github.com/sanjith0/sentry4d-cv/blob/main/src/config/cameras.ts): `src/config/cameras.ts`
- [Replay timeline](https://github.com/sanjith0/sentry4d-cv/blob/main/src/dashboard/ReplayTimeline.tsx): `src/dashboard/ReplayTimeline.tsx`

### Annotation and tracking

- [Annotation panel](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/annotation/AnnotationPanel.tsx): `src/features/annotation/AnnotationPanel.tsx`
- [Annotation data](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/annotation/useAnnotationStore.ts): `src/features/annotation/useAnnotationStore.ts`
- [Video-floor projection](https://github.com/sanjith0/sentry4d-cv/blob/main/src/lib/videoProjection.ts): `src/lib/videoProjection.ts`
- [Subject tracks](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/useSubjectTracks.ts): `src/features/sentry/useSubjectTracks.ts`
- [Trajectory fusion](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/trajectory.ts): `src/features/sentry/trajectory.ts`
- [Evidence evaluation](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/useEvidence.ts): `src/features/sentry/useEvidence.ts`
- [Evidence rules](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/sentry/evidence.ts): `src/features/sentry/evidence.ts`
- [Subject configuration](https://github.com/sanjith0/sentry4d-cv/blob/main/src/config/subjects.ts): `src/config/subjects.ts`

### 3D scene and replay

- [Master replay state](https://github.com/sanjith0/sentry4d-cv/blob/main/src/store/useReplayStore.ts): `src/store/useReplayStore.ts`
- [View state](https://github.com/sanjith0/sentry4d-cv/blob/main/src/store/useViewStore.ts): `src/store/useViewStore.ts`
- [3D scene](https://github.com/sanjith0/sentry4d-cv/blob/main/src/scene/Scene3D.tsx): `src/scene/Scene3D.tsx`
- [Viewport camera](https://github.com/sanjith0/sentry4d-cv/blob/main/src/scene/viewportCamera.ts): `src/scene/viewportCamera.ts`

### Reconstruction and AR

- [Appearance assets](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/useAppearanceStore.ts): `src/features/reconstruction/useAppearanceStore.ts`
- [Appearance rendering](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/AppearanceLayer.tsx): `src/features/reconstruction/AppearanceLayer.tsx`
- [Avatar assets](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/useAvatarStore.ts): `src/features/reconstruction/useAvatarStore.ts`
- [Avatar rendering](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/reconstruction/AvatarLayer.tsx): `src/features/reconstruction/AvatarLayer.tsx`
- [AR experience](https://github.com/sanjith0/sentry4d-cv/blob/main/src/ar/ARApp.tsx): `src/ar/ARApp.tsx`

### Investigator tooling

- [Investigator panel](https://github.com/sanjith0/sentry4d-cv/blob/main/src/features/investigator/InvestigatorPanel.tsx): `src/features/investigator/InvestigatorPanel.tsx`
- [Investigator service](https://github.com/sanjith0/sentry4d-cv/blob/main/server/investigator.ts): `server/investigator.ts`
- [Server entry](https://github.com/sanjith0/sentry4d-cv/blob/main/server/vercel/entry.ts): `server/vercel/entry.ts`

### Other components

- **Investigator**

## Connections

- Investigator → Application shell: uses (evidence: `src/app/App.tsx`)
- Application shell → 3D scene: mounts (evidence: `src/app/App.tsx`)
- Application shell → Replay timeline: mounts (evidence: `src/app/App.tsx`)
- Application shell → Annotation panel: mounts (evidence: `src/app/App.tsx`)
- Application shell → Evidence evaluation: starts (evidence: `src/app/App.tsx`)
- CCTV feeds → Camera configuration: uses camera definitions
- Camera calibration → Camera configuration: edits poses (evidence: `src/dashboard/CalibrationPanel.tsx`)
- Camera calibration → Master replay state: updates poses (evidence: `src/dashboard/CalibrationPanel.tsx`)
- Replay timeline → Master replay state: controls playback
- 3D scene → Master replay state: reads time (evidence: `src/scene/Scene3D.tsx`)
- 3D scene → View state: reads view state (evidence: `src/scene/Scene3D.tsx`)
- 3D scene → Viewport camera: uses camera (evidence: `src/scene/Scene3D.tsx`)
- Annotation panel → Annotation data: records annotations
- Annotation panel → Video-floor projection: projects clicks
- Annotation data → Master replay state: reads master time (evidence: `src/features/annotation/useAnnotationStore.ts`)
- Subject tracks → Annotation data: reads observations (evidence: `src/features/sentry/useSubjectTracks.ts`)
- Subject tracks → Trajectory fusion: builds tracks (evidence: `src/features/sentry/useSubjectTracks.ts`)
- Trajectory fusion → Subject configuration: uses track settings (evidence: `src/features/sentry/trajectory.ts`)
- Evidence evaluation → Annotation data: reads observations (evidence: `src/features/sentry/useEvidence.ts`)
- Evidence evaluation → Evidence rules: builds and evaluates (evidence: `src/features/sentry/useEvidence.ts`)
- Evidence evaluation → Master replay state: reads replay state (evidence: `src/features/sentry/useEvidence.ts`)
- Evidence rules → Subject configuration: uses subject definitions (evidence: `src/features/sentry/evidence.ts`)
- 3D scene → Appearance rendering: renders (evidence: `src/scene/Scene3D.tsx`)
- Appearance assets → Appearance rendering: provides assets
- 3D scene → Avatar rendering: renders (evidence: `src/scene/Scene3D.tsx`)
- Avatar assets → Avatar rendering: provides motion
- AR experience → Appearance rendering: renders (evidence: `src/ar/ARApp.tsx`)
- AR experience → 3D scene: reuses scene components (evidence: `src/ar/ARApp.tsx`)
- Server entry → Investigator service: dispatches to (evidence: `server/vercel/entry.ts`)
