# kumardhananjaya/lyraxproducthackathon architecture

> Architecture diagram of the GitHub repository kumardhananjaya/lyraxproducthackathon, 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/kumardhananjaya/lyraxproducthackathon
- Repository: https://github.com/kumardhananjaya/lyraxproducthackathon

## Overview

BondBack is a rental-bond dispute evidence and rebuttal product. Its primary workflow takes a tenant’s claim and supporting documents through evidence extraction, chronological review, statutory liability calculation, and dossier export. The repository contains a Next.js demo/interface and a FastAPI engine; the sampled material does not establish that the frontend is wired to the backend, so they are shown as separate branches. Several backend router relationships are supported by the source index rather than inspected router excerpts.

Main entry points: [`bondback/app/page.tsx`](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/page.tsx) (Case workspace), [`backend/app/services/workflow_orchestrator.py`](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/workflow_orchestrator.py) (Dispute orchestrator), [`backend/app/models/schemas.py`](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/models/schemas.py) (API data contracts), [`backend/app/routers/upload.py`](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/upload.py) (Upload endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Tenant experience"]
  node_home["Case workspace<br/>[page.tsx]"]
  node_hero["Demo launcher<br/>[Hero.tsx]"]
  node_upload_ui["Upload dialog<br/>[UploadModal.tsx]"]
  node_forensic_ui["Forensic miner<br/>[ForensicMiner.tsx]"]
  node_timeline["Timeline and gaps<br/>[TimelineView.tsx]"]
  node_calculator_ui["Wear calculator"]
  node_dossier["Dossier export<br/>[DossierExport.tsx]"]
  node_case_data["Sample case data<br/>[mockData.ts]"]
end

subgraph group_evidence["Evidence processing"]
  node_storage[("Secure file ingestion<br/>[storage.py]")]
  node_ai["Claim and vision AI<br/>[ai_service.py]"]
  node_miner_api["Evidence mining API<br/>[route.ts]"]
end

subgraph group_legal["Legal analysis"]
  node_depreciation_api_ui["Depreciation API<br/>[route.ts]"]
  node_depreciation["Statutory rules engine"]
  node_depreciation_ui["Frontend depreciation<br/>[depreciation.ts]"]
end

subgraph group_backend["API and workflow"]
  node_upload_api["Upload endpoint<br/>[upload.py]"]
  node_analyze_api["Analysis endpoint<br/>[analyze.py]"]
  node_depreciation_api["Depreciation endpoint<br/>[depreciation.py]"]
  node_app["FastAPI application<br/>[main.py]"]
  node_workflow["Dispute orchestrator"]
  node_schemas["API data contracts<br/>[schemas.py]"]
end

node_tenant(("Tenant"))
node_landlord["Landlord claim and evidence"]
node_tribunal["Tribunal-ready dossier"]

node_tenant -->|"opens"| node_home
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_upload_ui
node_home -->|"renders"| node_forensic_ui
node_home -->|"renders"| node_timeline
node_home -->|"renders"| node_calculator_ui
node_home -->|"renders"| node_dossier
node_home -->|"loads"| node_case_data
node_landlord -->|"submits files"| node_upload_api
node_app -->|"registers"| node_upload_api
node_app -->|"registers"| node_analyze_api
node_app -->|"registers"| node_depreciation_api
node_upload_api -->|"stores uploads"| node_storage
node_upload_api -->|"starts workflow"| node_workflow
node_analyze_api -->|"reads files"| node_storage
node_analyze_api -->|"runs analysis"| node_workflow
node_depreciation_api -->|"calculates liability"| node_depreciation
node_workflow -->|"reads documents"| node_storage
node_workflow -->|"extracts and mines"| node_ai
node_workflow -->|"calculates caps"| node_depreciation
node_workflow -->|"uses contracts"| node_schemas
node_storage -->|"creates document records"| node_schemas
node_ai -->|"returns findings"| node_schemas
node_depreciation -->|"returns calculation"| node_schemas
node_tenant -.->|"requests mining"| node_miner_api
node_tenant -.->|"requests calculation"| node_depreciation_api_ui
node_calculator_ui -->|"uses formula"| node_depreciation_ui
node_depreciation_ui -.->|"models rebuttal data"| node_schemas
node_dossier -->|"exports PDF"| node_tribunal
node_workflow -->|"prepares metrics"| node_tribunal

click node_home "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/page.tsx"
click node_hero "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/Hero.tsx"
click node_upload_ui "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/UploadModal.tsx"
click node_forensic_ui "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/ForensicMiner.tsx"
click node_timeline "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/TimelineView.tsx"
click node_calculator_ui "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/WearAndTearCalculator.tsx"
click node_dossier "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/DossierExport.tsx"
click node_case_data "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/lib/mockData.ts"
click node_upload_api "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/upload.py"
click node_analyze_api "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/analyze.py"
click node_depreciation_api "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/depreciation.py"
click node_app "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/main.py"
click node_workflow "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/workflow_orchestrator.py"
click node_schemas "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/models/schemas.py"
click node_storage "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/storage.py"
click node_ai "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/ai_service.py"
click node_miner_api "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/api/mine-evidence/route.ts"
click node_depreciation_api_ui "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/api/calculate-depreciation/route.ts"
click node_depreciation "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/depreciation_service.py"
click node_depreciation_ui "https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/lib/depreciation.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_home,node_hero,node_upload_ui,node_forensic_ui,node_timeline,node_calculator_ui,node_dossier,node_case_data toneBlue
class node_storage,node_ai,node_miner_api toneAmber
class node_depreciation_api_ui,node_depreciation,node_depreciation_ui toneMint
class node_upload_api,node_analyze_api,node_depreciation_api,node_app,node_workflow,node_schemas toneRose
class node_tenant,node_landlord,node_tribunal toneIndigo
```

## Components

### Tenant experience

- [Case workspace](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/page.tsx): `bondback/app/page.tsx`
- [Demo launcher](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/Hero.tsx): `bondback/components/Hero.tsx`
- [Upload dialog](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/UploadModal.tsx): `bondback/components/UploadModal.tsx`
- [Forensic miner](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/ForensicMiner.tsx): `bondback/components/ForensicMiner.tsx`
- [Timeline and gaps](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/TimelineView.tsx): `bondback/components/TimelineView.tsx`
- [Wear calculator](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/WearAndTearCalculator.tsx): `bondback/components/WearAndTearCalculator.tsx`
- [Dossier export](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/components/DossierExport.tsx): `bondback/components/DossierExport.tsx`
- [Sample case data](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/lib/mockData.ts): `bondback/lib/mockData.ts`

### Evidence processing

- [Secure file ingestion](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Claim and vision AI](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/ai_service.py): `backend/app/services/ai_service.py`
- [Evidence mining API](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/api/mine-evidence/route.ts): `bondback/app/api/mine-evidence/route.ts`

### Legal analysis

- [Depreciation API](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/app/api/calculate-depreciation/route.ts): `bondback/app/api/calculate-depreciation/route.ts`
- [Statutory rules engine](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/depreciation_service.py): `backend/app/services/depreciation_service.py`
- [Frontend depreciation](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/bondback/lib/depreciation.ts): `bondback/lib/depreciation.ts`

### API and workflow

- [Upload endpoint](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/upload.py): `backend/app/routers/upload.py`
- [Analysis endpoint](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/analyze.py): `backend/app/routers/analyze.py`
- [Depreciation endpoint](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/routers/depreciation.py): `backend/app/routers/depreciation.py`
- [FastAPI application](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/main.py): `backend/main.py`
- [Dispute orchestrator](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/services/workflow_orchestrator.py): `backend/app/services/workflow_orchestrator.py`
- [API data contracts](https://github.com/kumardhananjaya/lyraxproducthackathon/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`

### Other components

- **Tenant**
- **Landlord claim and evidence**
- **Tribunal-ready dossier**

## Connections

- Tenant → Case workspace: opens (evidence: `README.md`)
- Case workspace → Demo launcher: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Upload dialog: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Forensic miner: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Timeline and gaps: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Wear calculator: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Dossier export: renders (evidence: `bondback/app/page.tsx`)
- Case workspace → Sample case data: loads (evidence: `bondback/app/page.tsx`)
- Landlord claim and evidence → Upload endpoint: submits files (evidence: `README.md`)
- FastAPI application → Upload endpoint: registers (evidence: `backend/main.py`)
- FastAPI application → Analysis endpoint: registers (evidence: `backend/main.py`)
- FastAPI application → Depreciation endpoint: registers (evidence: `backend/main.py`)
- Upload endpoint → Secure file ingestion: stores uploads (evidence: `backend/app/routers/upload.py`)
- Upload endpoint → Dispute orchestrator: starts workflow (evidence: `backend/app/routers/upload.py`)
- Analysis endpoint → Secure file ingestion: reads files (evidence: `backend/app/routers/analyze.py`)
- Analysis endpoint → Dispute orchestrator: runs analysis (evidence: `backend/app/routers/analyze.py`)
- Depreciation endpoint → Statutory rules engine: calculates liability (evidence: `backend/app/routers/depreciation.py`)
- Dispute orchestrator → Secure file ingestion: reads documents (evidence: `backend/app/services/workflow_orchestrator.py`)
- Dispute orchestrator → Claim and vision AI: extracts and mines (evidence: `backend/app/services/workflow_orchestrator.py`)
- Dispute orchestrator → Statutory rules engine: calculates caps (evidence: `backend/app/services/workflow_orchestrator.py`)
- Dispute orchestrator → API data contracts: uses contracts (evidence: `backend/app/services/workflow_orchestrator.py`)
- Secure file ingestion → API data contracts: creates document records (evidence: `backend/app/services/storage.py`)
- Claim and vision AI → API data contracts: returns findings (evidence: `backend/app/services/ai_service.py`)
- Statutory rules engine → API data contracts: returns calculation (evidence: `backend/app/services/depreciation_service.py`)
- Tenant → Evidence mining API: requests mining
- Tenant → Depreciation API: requests calculation
- Wear calculator → Frontend depreciation: uses formula (evidence: `bondback/components/WearAndTearCalculator.tsx`)
- Frontend depreciation → API data contracts: models rebuttal data
- Dossier export → Tribunal-ready dossier: exports PDF (evidence: `README.md`)
- Dispute orchestrator → Tribunal-ready dossier: prepares metrics (evidence: `backend/app/services/workflow_orchestrator.py`)
