# vishal-dev999/recylink architecture

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

- Interactive diagram: https://gitdiagram.com/vishal-dev999/recylink
- Repository: https://github.com/vishal-dev999/recylink

## Overview

RecyLink connects field collectors with authorized recyclers through lot intake, matching, claim, weighing, consent, and verified completion. The README describes the mobile app’s offline queue, local image classification, multilingual audio, and later synchronization; the supplied tree does not include its Flutter runtime source, so those mobile components use the enclosing `mobile-app` path and their internal wiring is not inferred. Backend routes and lot-service behavior are represented from sampled source; other documented backend capabilities are shown without asserting unsampled call paths.

Main entry points: [`backend-api/app/api/v1/router.py`](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/router.py) (API Router), [`backend-api/app/services/lots.py`](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/services/lots.py) (Lot Lifecycle Service), [`mobile-app`](https://github.com/vishal-dev999/recylink/tree/main/mobile-app) (Mobile App), [`backend-api/app/database.py`](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/database.py) (Application Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Field App"]
  node_mobile_app["Mobile App"]
  node_offline_queue[("Offline Lot Queue")]
  node_local_classifier["On-Device Classifier"]
end

subgraph group_backend["Backend API"]
  node_backend_entry["API Application<br/>[main.py]"]
  node_api_router["API Router<br/>[router.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_ws_routes["Live Events<br/>[ws.py]"]
  node_ws_manager["WebSocket Fan-Out<br/>[ws_manager.py]"]
  node_database[("Application Database<br/>[database.py]")]
end

subgraph group_lotflow["Lot Lifecycle"]
  node_lots_endpoint["Lot Routes<br/>[lots.py]"]
  node_lot_service["Lot Lifecycle Service<br/>[lots.py]"]
  node_recycler_match["Recycler Matching<br/>[ranker.py]"]
end

subgraph group_insights["Trust And Insights"]
  node_pricing_service["Pricing Service<br/>[pricing.py]"]
  node_price_engine["Price Trends<br/>[price_engine.py]"]
  node_fraud_engine["Weighing Fraud Checks<br/>[fraud.py]"]
  node_compliance["Compliance And Ledger<br/>[compliance.py]"]
  node_safety["Safety Guidance<br/>[safety.py]"]
  node_audio["Spoken Prompts<br/>[audio.py]"]
  node_fraud_routes["Fraud Routes<br/>[fraud.py]"]
end

node_collector(("Collector"))
node_recycler(("Recycler"))

node_collector -->|"uses"| node_mobile_app
node_recycler -->|"uses"| node_mobile_app
node_mobile_app -->|"classifies locally"| node_local_classifier
node_mobile_app -->|"queues offline"| node_offline_queue
node_offline_queue -->|"syncs when online"| node_mobile_app
node_mobile_app -->|"syncs and requests"| node_backend_entry
node_backend_entry -->|"mounts routes"| node_api_router
node_api_router -->|"dispatches"| node_auth
node_api_router -->|"dispatches"| node_lots_endpoint
node_api_router -->|"dispatches"| node_compliance
node_api_router -->|"dispatches"| node_safety
node_api_router -->|"dispatches"| node_audio
node_api_router -->|"dispatches"| node_fraud_routes
node_api_router -->|"dispatches"| node_ws_routes
node_auth -->|"reads and writes"| node_database
node_lots_endpoint -->|"invokes lifecycle"| node_lot_service
node_lot_service -->|"reads and writes"| node_database
node_lot_service -->|"gets market band"| node_pricing_service
node_lot_service -->|"ranks recyclers"| node_recycler_match
node_lot_service -->|"assesses weighing"| node_fraud_engine
node_lot_service -->|"broadcasts lifecycle events"| node_ws_manager
node_ws_routes -->|"manages connections"| node_ws_manager
node_pricing_service -->|"summarizes trends"| node_price_engine
node_compliance -->|"serves traceability records"| node_database
node_fraud_routes -->|"serves fraud records"| node_database

click node_mobile_app "https://github.com/vishal-dev999/recylink/tree/main/mobile-app"
click node_offline_queue "https://github.com/vishal-dev999/recylink/tree/main/mobile-app"
click node_local_classifier "https://github.com/vishal-dev999/recylink/tree/main/mobile-app"
click node_backend_entry "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/main.py"
click node_api_router "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/router.py"
click node_auth "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/auth.py"
click node_lots_endpoint "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/lots.py"
click node_lot_service "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/services/lots.py"
click node_recycler_match "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/ranker.py"
click node_pricing_service "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/services/pricing.py"
click node_price_engine "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/price_engine.py"
click node_fraud_engine "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/fraud.py"
click node_compliance "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/compliance.py"
click node_safety "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/safety.py"
click node_audio "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/audio.py"
click node_fraud_routes "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/fraud.py"
click node_ws_routes "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/ws.py"
click node_ws_manager "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/core/ws_manager.py"
click node_database "https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/database.py"

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_mobile_app,node_offline_queue,node_local_classifier toneBlue
class node_backend_entry,node_api_router,node_auth,node_ws_routes,node_ws_manager,node_database toneAmber
class node_lots_endpoint,node_lot_service,node_recycler_match toneMint
class node_pricing_service,node_price_engine,node_fraud_engine,node_compliance,node_safety,node_audio,node_fraud_routes toneRose
class node_collector,node_recycler toneIndigo
```

## Components

### Field App

- [Mobile App](https://github.com/vishal-dev999/recylink/tree/main/mobile-app): `mobile-app`
- [Offline Lot Queue](https://github.com/vishal-dev999/recylink/tree/main/mobile-app): `mobile-app`
- [On-Device Classifier](https://github.com/vishal-dev999/recylink/tree/main/mobile-app): `mobile-app`

### Backend API

- [API Application](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/main.py): `backend-api/app/main.py`
- [API Router](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/router.py): `backend-api/app/api/v1/router.py`
- [Authentication](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/auth.py): `backend-api/app/api/v1/endpoints/auth.py`
- [Live Events](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/ws.py): `backend-api/app/api/v1/endpoints/ws.py`
- [WebSocket Fan-Out](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/core/ws_manager.py): `backend-api/app/core/ws_manager.py`
- [Application Database](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/database.py): `backend-api/app/database.py`

### Lot Lifecycle

- [Lot Routes](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/lots.py): `backend-api/app/api/v1/endpoints/lots.py`
- [Lot Lifecycle Service](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/services/lots.py): `backend-api/app/services/lots.py`
- [Recycler Matching](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/ranker.py): `backend-api/app/ml/ranker.py`

### Trust And Insights

- [Pricing Service](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/services/pricing.py): `backend-api/app/services/pricing.py`
- [Price Trends](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/price_engine.py): `backend-api/app/ml/price_engine.py`
- [Weighing Fraud Checks](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/ml/fraud.py): `backend-api/app/ml/fraud.py`
- [Compliance And Ledger](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/compliance.py): `backend-api/app/api/v1/endpoints/compliance.py`
- [Safety Guidance](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/safety.py): `backend-api/app/api/v1/endpoints/safety.py`
- [Spoken Prompts](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/audio.py): `backend-api/app/api/v1/endpoints/audio.py`
- [Fraud Routes](https://github.com/vishal-dev999/recylink/blob/main/backend-api/app/api/v1/endpoints/fraud.py): `backend-api/app/api/v1/endpoints/fraud.py`

### Other components

- **Collector**
- **Recycler**

## Connections

- Collector → Mobile App: uses
- Recycler → Mobile App: uses
- Mobile App → On-Device Classifier: classifies locally
- Mobile App → Offline Lot Queue: queues offline
- Offline Lot Queue → Mobile App: syncs when online
- Mobile App → API Application: syncs and requests
- API Application → API Router: mounts routes
- API Router → Authentication: dispatches
- API Router → Lot Routes: dispatches
- API Router → Compliance And Ledger: dispatches
- API Router → Safety Guidance: dispatches
- API Router → Spoken Prompts: dispatches
- API Router → Fraud Routes: dispatches
- API Router → Live Events: dispatches
- Authentication → Application Database: reads and writes
- Lot Routes → Lot Lifecycle Service: invokes lifecycle
- Lot Lifecycle Service → Application Database: reads and writes
- Lot Lifecycle Service → Pricing Service: gets market band
- Lot Lifecycle Service → Recycler Matching: ranks recyclers
- Lot Lifecycle Service → Weighing Fraud Checks: assesses weighing
- Lot Lifecycle Service → WebSocket Fan-Out: broadcasts lifecycle events
- Live Events → WebSocket Fan-Out: manages connections
- Pricing Service → Price Trends: summarizes trends
- Compliance And Ledger → Application Database: serves traceability records
- Fraud Routes → Application Database: serves fraud records
