# swapnaniltripathy/memoryos architecture

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

- Interactive diagram: https://gitdiagram.com/swapnaniltripathy/memoryos
- Repository: https://github.com/swapnaniltripathy/memoryos

## Overview

MEMORYOS is a camera-based physical-memory prototype. A user enables the browser camera, captures a frame, and sends it to the frontend’s memory-frame API; the backend then detects objects, matches identities, and records their positions and movement in JSON-backed memory. Returned detections appear in the frontend with labels, IDs, and location. The graph follows the sampled runtime code; broader product capabilities are not documented in the provided README, and the database files are created at runtime rather than present in the tree.

Main entry points: [`backend/server.py`](https://github.com/swapnaniltripathy/memoryos/blob/main/backend/server.py) (Memory-frame API), [`frontend/src/Camera.jsx`](https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/Camera.jsx) (Camera capture), [`frontend/src/App.jsx`](https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/App.jsx) (App shell), [`vision/identity.py`](https://github.com/swapnaniltripathy/memoryos/blob/main/vision/identity.py) (Object identity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Camera interface"]
  node_app_entry["React entry<br/>[main.jsx]"]
  node_app["App shell<br/>[App.jsx]"]
  node_camera["Camera capture<br/>[Camera.jsx]"]
end

subgraph group_backend["Frame processing"]
  node_server["Memory-frame API<br/>[server.py]"]
end

subgraph group_vision["Vision and memory"]
  node_detector["Object detection<br/>[detector.py]"]
  node_identity["Object identity<br/>[identity.py]"]
  node_spatial["Spatial memory<br/>[spatial.py]"]
end

subgraph group_storage["Persistent memory"]
  node_identity_store[("Identity records")]
  node_spatial_store[("Spatial observations")]
end

node_user(("User"))
node_browser_camera["Browser camera"]

node_user -->|"captures frame"| node_camera
node_camera -->|"requests stream"| node_browser_camera
node_app_entry -->|"renders"| node_app
node_app -->|"renders"| node_camera
node_camera -->|"posts frame"| node_server
node_server -->|"detects objects"| node_detector
node_server -->|"matches identities"| node_identity
node_server -->|"records positions"| node_spatial
node_identity -->|"reads and writes"| node_identity_store
node_spatial -->|"reads and writes"| node_spatial_store
node_server -->|"returns detections"| node_camera

click node_app_entry "https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/App.jsx"
click node_camera "https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/Camera.jsx"
click node_server "https://github.com/swapnaniltripathy/memoryos/blob/main/backend/server.py"
click node_detector "https://github.com/swapnaniltripathy/memoryos/blob/main/vision/detector.py"
click node_identity "https://github.com/swapnaniltripathy/memoryos/blob/main/vision/identity.py"
click node_spatial "https://github.com/swapnaniltripathy/memoryos/blob/main/vision/spatial.py"
click node_identity_store "https://github.com/swapnaniltripathy/memoryos/tree/main/database"
click node_spatial_store "https://github.com/swapnaniltripathy/memoryos/tree/main/database"

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_entry,node_app,node_camera,node_user,node_browser_camera toneBlue
class node_server toneAmber
class node_detector,node_identity,node_spatial toneMint
class node_identity_store,node_spatial_store toneRose
```

## Components

### Camera interface

- [React entry](https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [App shell](https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Camera capture](https://github.com/swapnaniltripathy/memoryos/blob/main/frontend/src/Camera.jsx): `frontend/src/Camera.jsx`

### Frame processing

- [Memory-frame API](https://github.com/swapnaniltripathy/memoryos/blob/main/backend/server.py): `backend/server.py`

### Vision and memory

- [Object detection](https://github.com/swapnaniltripathy/memoryos/blob/main/vision/detector.py): `vision/detector.py`
- [Object identity](https://github.com/swapnaniltripathy/memoryos/blob/main/vision/identity.py): `vision/identity.py`
- [Spatial memory](https://github.com/swapnaniltripathy/memoryos/blob/main/vision/spatial.py): `vision/spatial.py`

### Persistent memory

- [Identity records](https://github.com/swapnaniltripathy/memoryos/tree/main/database): `database`
- [Spatial observations](https://github.com/swapnaniltripathy/memoryos/tree/main/database): `database`

### Other components

- **User**
- **Browser camera**

## Connections

- User → Camera capture: captures frame (evidence: `frontend/src/Camera.jsx`)
- Camera capture → Browser camera: requests stream (evidence: `frontend/src/Camera.jsx`)
- React entry → App shell: renders (evidence: `frontend/src/main.jsx`)
- App shell → Camera capture: renders (evidence: `frontend/src/App.jsx`)
- Camera capture → Memory-frame API: posts frame (evidence: `frontend/src/Camera.jsx`)
- Memory-frame API → Object detection: detects objects (evidence: `backend/server.py`)
- Memory-frame API → Object identity: matches identities (evidence: `backend/server.py`)
- Memory-frame API → Spatial memory: records positions (evidence: `backend/server.py`)
- Object identity → Identity records: reads and writes (evidence: `vision/identity.py`)
- Spatial memory → Spatial observations: reads and writes (evidence: `vision/spatial.py`)
- Memory-frame API → Camera capture: returns detections (evidence: `frontend/src/Camera.jsx`)
