# riyakandwal/veyra architecture

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

- Interactive diagram: https://gitdiagram.com/riyakandwal/veyra
- Repository: https://github.com/riyakandwal/veyra

## Overview

#### Purpose and Entry Points
This repository is a small AI/vision application with a browser frontend and Python backend. The deployable serverless entry point is `api/index.py`; backend application startup is likely centralized in `backend/main.py`. The browser starts from `frontend/index.html` and loads client behavior from `frontend/script.js`.

#### Frontend Experience
The frontend is a static HTML/CSS/JavaScript application:
- `frontend/index.html`
- `frontend/script.js`
- `frontend/style.css`

It also has vision-specific browser logic in `frontend/vision.js`, indicating client-side capture, rendering, or interaction around visual input. A 3D skull asset at `frontend/models/human_skull.glb` is a material UI/domain artifact and likely supports anatomical visualization.

#### API and Deployment Boundary
`api/index.py` is the boundary between the hosting platform and backend code. `vercel.json` indicates Vercel deployment, likely exposing the Python API as a serverless function. This boundary should remain thin: request adaptation and backend invocation belong here, while application behavior belongs under `backend/`.

#### Backend Application Layer
`backend/main.py` is the probable backend composition point, coordinating API-facing operations with AI, memory, and vision subsystems:
- `backend/main.py`
- `backend/__init__.py`
- `backend/requirements.txt`

The backend is Python-based, with dependencies scoped in `backend/requirements.txt`; a root `requirements.txt` may support platform-level installation or local execution.

#### AI and Memory Subsystems
The core AI module is `backend/core/ai.py`, organized under `backend/core/`. Persistent or conversational/context state is isolated under `backend/memory/`, especially `backend/memory/memory.py`.

Primary control flow is expected to be: incoming API request → `backend/main.py` orchestration → AI processing and optional memory retrieval/update → response returned through `api/index.py`. The separation makes memory an explicit boundary rather than embedding state directly in request handlers.

#### Vision Processing
Vision responsibilities are isolated in:
- `backend/vision/vision.py`
- `backend/yolo11n.pt`

The included YOLO model weights establish an on-server object-detection inference capability. Backend vision results can feed the AI layer, API response, or frontend visualization, while browser-side vision behavior remains separately located in `frontend/vision.js`.

#### Key Runtime Boundaries
The system spans two runtimes:
1. Browser runtime: static frontend, visual interaction, and 3D asset usage.
2. Python/serverless runtime: API handling, AI orchestration, memory, and YOLO inference.

Material external infrastructure is Vercel (`vercel.json`). No README-defined database, model API provider, authentication service, or messaging service is present, so such integrations should not be assumed without inspecting implementation files.

Main entry points: [`backend/main.py`](https://github.com/riyakandwal/veyra/blob/main/backend/main.py) (Backend orchestration), [`api/index.py`](https://github.com/riyakandwal/veyra/blob/main/api/index.py) (Serverless API adapter), [`frontend/index.html`](https://github.com/riyakandwal/veyra/blob/main/frontend/index.html) (Frontend shell), [`frontend/vision.js`](https://github.com/riyakandwal/veyra/blob/main/frontend/vision.js) (Browser vision)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser runtime"]
  node_frontend_html["Frontend shell<br/>HTML entry<br/>[index.html]"]
  node_frontend_client["Client behavior<br/>JavaScript<br/>[script.js]"]
  node_frontend_vision["Browser vision<br/>JavaScript<br/>[vision.js]"]
  node_frontend_style["UI styles<br/>CSS<br/>[style.css]"]
  node_skull_model["Skull model<br/>3D asset<br/>[human_skull.glb]"]
end

subgraph group_server["Python serverless runtime"]
  node_api_entry["Serverless API adapter<br/>Python entry<br/>[index.py]"]
  node_backend_main["Backend orchestration<br/>Python application<br/>[main.py]"]
  node_ai["AI processing<br/>Python module<br/>[ai.py]"]
  node_memory[("Context memory<br/>Python state module<br/>[memory.py]")]
  node_vision["Vision inference<br/>Python module<br/>[vision.py]"]
  node_yolo_weights["YOLO model weights<br/>model artifact<br/>[yolo11n.pt]"]
  node_backend_deps["Backend dependencies<br/>Python dependencies<br/>[requirements.txt]"]
end

node_vercel{{"Vercel deployment<br/>hosting config<br/>[vercel.json]"}}

node_vercel -->|"serves"| node_frontend_html
node_vercel -->|"invokes"| node_api_entry
node_frontend_html -->|"loads"| node_frontend_client
node_frontend_html -->|"loads"| node_frontend_vision
node_frontend_html -->|"applies"| node_frontend_style
node_frontend_vision -->|"uses"| node_skull_model
node_frontend_client -->|"API requests"| node_api_entry
node_frontend_vision -.->|"visual input/results"| node_api_entry
node_api_entry -->|"delegates"| node_backend_main
node_backend_main -->|"orchestrates"| node_ai
node_backend_main -->|"reads and updates"| node_memory
node_backend_main -->|"invokes"| node_vision
node_vision -->|"loads"| node_yolo_weights
node_backend_main -->|"response"| node_api_entry
node_backend_deps -.->|"provides runtime packages"| node_backend_main

click node_frontend_html "https://github.com/riyakandwal/veyra/blob/main/frontend/index.html"
click node_frontend_client "https://github.com/riyakandwal/veyra/blob/main/frontend/script.js"
click node_frontend_vision "https://github.com/riyakandwal/veyra/blob/main/frontend/vision.js"
click node_frontend_style "https://github.com/riyakandwal/veyra/blob/main/frontend/style.css"
click node_skull_model "https://github.com/riyakandwal/veyra/blob/main/frontend/models/human_skull.glb"
click node_vercel "https://github.com/riyakandwal/veyra/blob/main/vercel.json"
click node_api_entry "https://github.com/riyakandwal/veyra/blob/main/api/index.py"
click node_backend_main "https://github.com/riyakandwal/veyra/blob/main/backend/main.py"
click node_ai "https://github.com/riyakandwal/veyra/blob/main/backend/core/ai.py"
click node_memory "https://github.com/riyakandwal/veyra/blob/main/backend/memory/memory.py"
click node_vision "https://github.com/riyakandwal/veyra/blob/main/backend/vision/vision.py"
click node_yolo_weights "https://github.com/riyakandwal/veyra/blob/main/backend/yolo11n.pt"
click node_backend_deps "https://github.com/riyakandwal/veyra/blob/main/backend/requirements.txt"

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_frontend_html,node_frontend_client,node_frontend_vision,node_frontend_style,node_skull_model toneBlue
class node_api_entry,node_backend_main,node_ai,node_memory,node_vision,node_yolo_weights,node_backend_deps toneAmber
class node_vercel toneNeutral
```

## Components

### Browser runtime

- [Frontend shell](https://github.com/riyakandwal/veyra/blob/main/frontend/index.html): HTML entry · `frontend/index.html`
- [Client behavior](https://github.com/riyakandwal/veyra/blob/main/frontend/script.js): JavaScript · `frontend/script.js`
- [Browser vision](https://github.com/riyakandwal/veyra/blob/main/frontend/vision.js): JavaScript · Handles visual input or rendering interactions. · `frontend/vision.js`
- [UI styles](https://github.com/riyakandwal/veyra/blob/main/frontend/style.css): CSS · `frontend/style.css`
- [Skull model](https://github.com/riyakandwal/veyra/blob/main/frontend/models/human_skull.glb): 3D asset · Anatomical visualization asset. · `frontend/models/human_skull.glb`

### Python serverless runtime

- [Serverless API adapter](https://github.com/riyakandwal/veyra/blob/main/api/index.py): Python entry · Adapts hosting requests to backend application behavior. · `api/index.py`
- [Backend orchestration](https://github.com/riyakandwal/veyra/blob/main/backend/main.py): Python application · Coordinates API-facing AI, memory, and vision operations. · `backend/main.py`
- [AI processing](https://github.com/riyakandwal/veyra/blob/main/backend/core/ai.py): Python module · `backend/core/ai.py`
- [Context memory](https://github.com/riyakandwal/veyra/blob/main/backend/memory/memory.py): Python state module · Retrieves and updates conversational or contextual state. · `backend/memory/memory.py`
- [Vision inference](https://github.com/riyakandwal/veyra/blob/main/backend/vision/vision.py): Python module · Runs server-side visual processing. · `backend/vision/vision.py`
- [YOLO model weights](https://github.com/riyakandwal/veyra/blob/main/backend/yolo11n.pt): model artifact · Object-detection inference model. · `backend/yolo11n.pt`
- [Backend dependencies](https://github.com/riyakandwal/veyra/blob/main/backend/requirements.txt): Python dependencies · `backend/requirements.txt`

### Other components

- [Vercel deployment](https://github.com/riyakandwal/veyra/blob/main/vercel.json): hosting config · Deploys the static frontend and serverless API. · `vercel.json`

## Connections

- Vercel deployment → Frontend shell: serves
- Vercel deployment → Serverless API adapter: invokes
- Frontend shell → Client behavior: loads
- Frontend shell → Browser vision: loads
- Frontend shell → UI styles: applies
- Browser vision → Skull model: uses
- Client behavior → Serverless API adapter: API requests
- Browser vision → Serverless API adapter: visual input/results
- Serverless API adapter → Backend orchestration: delegates
- Backend orchestration → AI processing: orchestrates
- Backend orchestration → Context memory: reads and updates
- Backend orchestration → Vision inference: invokes
- Vision inference → YOLO model weights: loads
- Backend orchestration → Serverless API adapter: response
- Backend dependencies → Backend orchestration: provides runtime packages
