# prachee-n16/memora architecture

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

- Interactive diagram: https://gitdiagram.com/prachee-n16/memora
- Repository: https://github.com/prachee-n16/memora

## Overview

1. **System shape**
   - This repo is a prototype for a personal memory assistant (“memora”) with a clear split between a **React client**, a **Python/Flask API**, and a set of **ML/vision/audio pipelines**.
   - The runtime path is: user interacts in the browser/mobile UI → frontend calls Flask endpoints → backend/ML scripts process face, image, audio, and chat data → results are returned to the UI.

2. **Frontend application**
   - `client/` is a React single-page app.
   - Main screens/components are organized by user workflow: `Landing`, `SignInPage`, `SignUpPage`, `Dashboard`, `ChatApp`, `Memories`, `Relationships`, `Profile`, plus navigation (`Navbar`, `Sidebar`, `Searchbar`).
   - `RootLayout` and `config.js` suggest routed views and a configurable API base URL; the frontend is the primary presentation layer and request initiator.

3. **Backend/API boundary**
   - `client/api/app.py` is the main Flask backend entry point, with `requirements.txt` and `.flaskenv` showing a standard Python API service.
   - This backend is the integration boundary for the client: it likely exposes endpoints for authentication, memory retrieval, face recognition, and assistant/chat interactions.
   - The repo does not show a separate database server or cloud backend; most persistence appears to be local files and serialized model artifacts.

4. **Face recognition subsystem**
   - Face identification is a major subsystem and is implemented with **DeepFace/OpenCV-based embeddings**.
   - The repo contains serialized embedding/model artifacts in `database/`, `face_database/`, and per-person folders such as `database/John` and `database/Sherlock`.
   - File names like `ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl` indicate a **Facenet512 embedding pipeline** with OpenCV detection and alignment, used to match observed faces against known individuals.

5. **Face pipeline development and experiments**
   - `deepface_dev/`, `traditional/`, `face_rec.py`, and `flask_face_backend.py` show multiple iterations of the face-recognition implementation.
   - `traditional/` appears to contain older or alternative recognition approaches, while `deepface_dev/` contains DeepFace-specific experiments and notebooks.
   - This makes the face stack an R&D-heavy area rather than a single clean production service.

6. **Memory ingestion and summarization**
   - The README describes capturing **photos, conversations, and surrounding context**, then turning them into concise summaries.
   - Image understanding is described as using **Qwen** for image-to-text description generation.
   - Conversations are transcribed to text and then stored for later retrieval, forming the “memory” corpus the assistant can search.

7. **Retrieval and chatbot flow**
   - The assistant is described as using **GPT-style prompting** to search over stored memories and return relevant information.
   - Architecturally, this is a retrieval-augmented flow: user query → search over stored transcripts/image descriptions/embeddings → prompt construction → generated answer.
   - The `ChatApp` UI and `Memories` views likely sit on top of this retrieval layer.

8. **Voice interaction subsystem**
   - The repo includes `whisper/` and `livekit/`, indicating a speech pipeline and real-time communication/assistant work.
   - `whisper/stt.ipynb` suggests speech-to-text experimentation, while `livekit/assistant.py` suggests a real-time assistant or audio-session integration.
   - This subsystem supports conversational input/output rather than purely text-based chat.

9. **Data and artifact boundaries**
   - Most persisted artifacts are local: face embedding pickles, numpy arrays, notebooks, and image/audio experiment outputs.
   - There is no obvious standalone database service in the tree; instead, the project relies on serialized files and folders as the storage boundary.
   - The README’s “vector database” concept is present architecturally, but in this repo it appears to be implemented through local artifacts and scripts rather than a dedicated server package.

10. **Deployment/model packaging and experiments**
   - `truss/` with `config.yaml` and `model/hf-model.py` suggests packaging a Hugging Face model for deployment.
   - `facenet512_conversion/` and `iris/` are supporting experiment/tooling areas, not core application runtime paths.
   - `App/` and `index.html` look like ancillary notebooks or standalone experiments rather than the main product surface.

11. **How to draw the architecture**
   - A good diagram would show four main blocks: **React UI**, **Flask API**, **ML services/pipelines** (face, STT, image captioning, retrieval), and **local artifact storage** (embeddings, summaries, model files).
   - Data flows should emphasize that the UI submits media/query data to the API, the API delegates to recognition/summarization components, and the returned results populate dashboard/chat/memory views.

Main entry points: [`client/src/layouts/RootLayout.jsx`](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/layouts/RootLayout.jsx) (Root Layout), [`client/api/app.py`](https://github.com/prachee-n16/memora/blob/frontend_v2/client/api/app.py) (Flask API), [`client/src/index.js`](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/index.js) (React App), [`deepface_dev/deepface_sys.py`](https://github.com/prachee-n16/memora/blob/frontend_v2/deepface_dev/deepface_sys.py) (DeepFace Stack)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Client UI"]
  node_client_app["React App<br/>spa<br/>[index.js]"]
  node_root_layout["Root Layout<br/>routing shell<br/>[RootLayout.jsx]"]
  node_dashboard["Dashboard<br/>screen<br/>[Dashboard.jsx]"]
  node_chat_app["Chat<br/>screen<br/>[ChatApp.jsx]"]
  node_memories["Memories<br/>screen<br/>[Memories.jsx]"]
  node_relationships["Relationships<br/>screen<br/>[Relationships.jsx]"]
  node_profile["Profile<br/>screen<br/>[Profile.jsx]"]
  node_nav_shell["Nav Shell<br/>navigation<br/>[Navbar.jsx]"]
  node_config["Client Config<br/>settings<br/>[config.js]"]
end

subgraph group_backend["API Boundary"]
  node_api_app["Flask API<br/>[app.py]"]
end

subgraph group_ml["ML Pipelines"]
  node_face_backend["Face Backend<br/>vision service"]
  node_deepface_stack["DeepFace Stack<br/>vision pipeline<br/>[deepface_sys.py]"]
  node_traditional_stack["Traditional CV<br/>vision pipeline<br/>[face_recog.ipynb]"]
  node_whisper_stt["Speech STT<br/>audio pipeline<br/>[stt.ipynb]"]
  node_livekit_assistant["LiveKit Assistant<br/>realtime audio<br/>[assistant.py]"]
  node_truss_model["Model Pack<br/>deployment package<br/>[hf-model.py]"]
end

subgraph group_storage["Local Artifacts"]
  node_face_db[("Face DB<br/>artifact store")]
  node_person_db[("Known People<br/>artifact store")]
  node_handcrafted_faces[("Legacy Face Data<br/>artifact store")]
end

node_client_app -->|"routes through"| node_root_layout
node_root_layout -->|"shows"| node_dashboard
node_root_layout -->|"shows"| node_chat_app
node_root_layout -->|"shows"| node_memories
node_root_layout -->|"shows"| node_relationships
node_root_layout -->|"shows"| node_profile
node_nav_shell -->|"wraps"| node_root_layout
node_client_app -->|"reads"| node_config
node_client_app -->|"calls"| node_api_app
node_api_app -->|"delegates vision"| node_face_backend
node_api_app -->|"delegates faces"| node_deepface_stack
node_api_app -->|"delegates audio"| node_whisper_stt
node_api_app -->|"streams voice"| node_livekit_assistant
node_api_app -->|"invokes model"| node_truss_model
node_deepface_stack -->|"matches against"| node_face_db
node_deepface_stack -->|"loads identities"| node_person_db
node_traditional_stack -->|"reads"| node_handcrafted_faces
node_face_backend -.->|"persists"| node_face_db

click node_client_app "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/index.js"
click node_root_layout "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/layouts/RootLayout.jsx"
click node_dashboard "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Dashboard.jsx"
click node_chat_app "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/ChatApp.jsx"
click node_memories "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Memories.jsx"
click node_relationships "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Relationships.jsx"
click node_profile "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Profile.jsx"
click node_nav_shell "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Navbar.jsx"
click node_api_app "https://github.com/prachee-n16/memora/blob/frontend_v2/client/api/app.py"
click node_config "https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/config.js"
click node_face_backend "https://github.com/prachee-n16/memora/blob/frontend_v2/flask_face_backend.py"
click node_deepface_stack "https://github.com/prachee-n16/memora/blob/frontend_v2/deepface_dev/deepface_sys.py"
click node_traditional_stack "https://github.com/prachee-n16/memora/blob/frontend_v2/traditional/face_recog.ipynb"
click node_whisper_stt "https://github.com/prachee-n16/memora/blob/frontend_v2/whisper/stt.ipynb"
click node_livekit_assistant "https://github.com/prachee-n16/memora/blob/frontend_v2/livekit/assistant.py"
click node_truss_model "https://github.com/prachee-n16/memora/blob/frontend_v2/truss/model/hf-model.py"
click node_face_db "https://github.com/prachee-n16/memora/blob/frontend_v2/face_database/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl"
click node_person_db "https://github.com/prachee-n16/memora/blob/frontend_v2/database/John/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl"
click node_handcrafted_faces "https://github.com/prachee-n16/memora/blob/frontend_v2/traditional/face_embeddings.npy"

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_client_app,node_root_layout,node_dashboard,node_chat_app,node_memories,node_relationships,node_profile,node_nav_shell,node_config toneBlue
class node_api_app toneAmber
class node_face_backend,node_deepface_stack,node_traditional_stack,node_whisper_stt,node_livekit_assistant,node_truss_model toneMint
class node_face_db,node_person_db,node_handcrafted_faces toneRose
```

## Components

### Client UI

React presentation layer and routed user workflows

- [React App](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/index.js): spa · Main browser/mobile client and entry to the product · `client/src/index.js`
- [Root Layout](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/layouts/RootLayout.jsx): routing shell · Top-level routed layout for the client app · `client/src/layouts/RootLayout.jsx`
- [Dashboard](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Dashboard.jsx): screen · Primary overview screen for the assistant · `client/src/components/Dashboard.jsx`
- [Chat](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/ChatApp.jsx): screen · Conversation and query experience · `client/src/components/ChatApp.jsx`
- [Memories](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Memories.jsx): screen · Memory browsing and retrieval view · `client/src/components/Memories.jsx`
- [Relationships](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Relationships.jsx): screen · People-centric memory and identity view · `client/src/components/Relationships.jsx`
- [Profile](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Profile.jsx): screen · User settings and profile surface · `client/src/components/Profile.jsx`
- [Nav Shell](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/components/Navbar.jsx): navigation · Shared navigation and search controls · `client/src/components/Navbar.jsx`
- [Client Config](https://github.com/prachee-n16/memora/blob/frontend_v2/client/src/config.js): settings · Frontend runtime configuration such as API base URL · `client/src/config.js`

### API Boundary

Flask service that brokers requests from the UI

- [Flask API](https://github.com/prachee-n16/memora/blob/frontend_v2/client/api/app.py): service · Main backend entry point for client requests · `client/api/app.py`

### ML Pipelines

Face, speech, and memory-processing experiments and services

- [Face Backend](https://github.com/prachee-n16/memora/blob/frontend_v2/flask_face_backend.py): vision service · Flask-facing face recognition entry point and integration code · `flask_face_backend.py`
- [DeepFace Stack](https://github.com/prachee-n16/memora/blob/frontend_v2/deepface_dev/deepface_sys.py): vision pipeline · DeepFace/OpenCV face embedding and recognition experiments · `deepface_dev/deepface_sys.py`
- [Traditional CV](https://github.com/prachee-n16/memora/blob/frontend_v2/traditional/face_recog.ipynb): vision pipeline · Older or alternative face recognition approaches · `traditional/face_recog.ipynb`
- [Speech STT](https://github.com/prachee-n16/memora/blob/frontend_v2/whisper/stt.ipynb): audio pipeline · Speech-to-text experimentation for voice input · `whisper/stt.ipynb`
- [LiveKit Assistant](https://github.com/prachee-n16/memora/blob/frontend_v2/livekit/assistant.py): realtime audio · Real-time assistant and audio-session integration · `livekit/assistant.py`
- [Model Pack](https://github.com/prachee-n16/memora/blob/frontend_v2/truss/model/hf-model.py): deployment package · Packaged Hugging Face model for deployment · `truss/model/hf-model.py`

### Local Artifacts

Serialized embeddings, models, and other persisted repo-local data

- [Face DB](https://github.com/prachee-n16/memora/blob/frontend_v2/face_database/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl): artifact store · Serialized face embeddings and identity matches · `face_database/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl`
- [Known People](https://github.com/prachee-n16/memora/blob/frontend_v2/database/John/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl): artifact store · Per-person face embedding artifacts · `database/John/ds_model_facenet512_detector_opencv_aligned_normalization_base_expand_0.pkl`
- [Legacy Face Data](https://github.com/prachee-n16/memora/blob/frontend_v2/traditional/face_embeddings.npy): artifact store · Older embeddings and face-recognition data artifacts · `traditional/face_embeddings.npy`

## Connections

- React App → Root Layout: routes through · Client UI is organized by routed views and shared layout
- Root Layout → Dashboard: shows · Primary landing for signed-in users
- Root Layout → Chat: shows · Conversation workflow
- Root Layout → Memories: shows · Memory browsing workflow
- Root Layout → Relationships: shows · People and relationship workflow
- Root Layout → Profile: shows · Profile and settings workflow
- Nav Shell → Root Layout: wraps · Shared navigation appears across client screens
- React App → Client Config: reads · Frontend uses configurable API base settings
- React App → Flask API: calls · Browser app initiates API requests
- Flask API → Face Backend: delegates vision · Backend boundary hands face work to recognition code
- Flask API → DeepFace Stack: delegates faces · DeepFace pipeline performs embedding and matching
- Flask API → Speech STT: delegates audio · Speech input is transcribed for assistant use
- Flask API → LiveKit Assistant: streams voice · Real-time assistant/session integration
- Flask API → Model Pack: invokes model · Packaged model can serve generated responses or inference
- DeepFace Stack → Face DB: matches against · Face embeddings are compared to stored identities
- DeepFace Stack → Known People: loads identities · Per-person artifacts extend the known-face set
- Traditional CV → Legacy Face Data: reads · Legacy recognition experiments use saved embedding arrays
- Face Backend → Face DB: persists · Face backend writes or consumes serialized face artifacts
