# timewithpotato/bazardor architecture

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

- Interactive diagram: https://gitdiagram.com/timewithpotato/bazardor
- Repository: https://github.com/timewithpotato/bazardor

## Overview

BazarDor lets Dhaka shoppers compare accepted community prices with official TCB ranges, submit reports for filtering, inspect all report statuses, and view market-wide summaries. The frontend routes those workflows through a shared API client; FastAPI provides catalog, reporting, feed, trend, and overview endpoints backed by SQLAlchemy and SQLite. The README documents the main capabilities and report-filter behavior; some backend route implementations and frontend pages were not excerpted, so their links are limited to documented API calls and routing.

Main entry points: [`backend/app/main.py`](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py) (HTTP API), [`frontend/src/App.jsx`](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/App.jsx) (App navigation), [`frontend/src/pages/ComparePage.jsx`](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/ComparePage.jsx) (Area comparison), [`frontend/src/api.js`](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Shopper interface"]
  node_app["App navigation<br/>[App.jsx]"]
  node_compare["Area comparison<br/>[ComparePage.jsx]"]
  node_report["Price reporting<br/>[ReportPage.jsx]"]
  node_live["Live reports<br/>[FeedPage.jsx]"]
  node_overview["Market overview<br/>[OverviewPage.jsx]"]
  node_ruler["Price ruler<br/>[PriceRuler.jsx]"]
  node_picker["Product picker<br/>[ProductPicker.jsx]"]
  node_sparkline["Price trend chart<br/>[Sparkline.jsx]"]
  node_ui_states["Status and errors<br/>[States.jsx]"]
  node_async["Async state helpers<br/>[hooks.js]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_backend["Price services"]
  node_api["HTTP API<br/>[main.py]"]
  node_submission["Report submission<br/>[main.py]"]
  node_filter["Outlier and trust checks<br/>[outlier.py]"]
  node_area_feed["Area price feed<br/>[main.py]"]
  node_report_feed["Recent reports<br/>[main.py]"]
  node_trend["Price trend<br/>[main.py]"]
  node_market["Market overview<br/>[main.py]"]
end

subgraph group_data["Catalog and persistence"]
  node_database[("DB sessions<br/>[database.py]")]
  node_models["Domain models<br/>[models.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_seed["Demo data seeding<br/>[seed.py]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_compare
node_app -->|"routes to"| node_report
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_overview
node_app -->|"loads catalog via"| node_client
node_app -->|"tracks loading via"| node_async
node_compare -->|"requests prices via"| node_client
node_compare -->|"renders"| node_ruler
node_compare -->|"renders"| node_picker
node_compare -->|"renders"| node_sparkline
node_compare -->|"loads data with"| node_async
node_report -->|"submits reports via"| node_client
node_live -->|"requests reports via"| node_client
node_overview -->|"requests summary via"| node_client
node_compare -->|"shows errors via"| node_ui_states
node_report -->|"shows status via"| node_ui_states
node_live -->|"shows status via"| node_ui_states
node_overview -->|"shows states via"| node_ui_states
node_client -->|"requests endpoints"| node_api
node_api -->|"dispatches submit"| node_submission
node_api -->|"dispatches feed"| node_area_feed
node_api -->|"dispatches recent"| node_report_feed
node_api -->|"dispatches trend"| node_trend
node_api -->|"dispatches overview"| node_market
node_api -->|"queries domain data"| node_models
node_submission -->|"evaluates report"| node_filter
node_filter -->|"returns verdict"| node_submission
node_submission -.->|"persists report"| node_database
node_area_feed -->|"reads accepted reports"| node_database
node_report_feed -->|"reads submissions"| node_database
node_trend -.->|"reads accepted reports"| node_database
node_market -.->|"reads market data"| node_database
node_database -->|"provides ORM base"| node_models
node_seed -->|"creates demo records"| node_models
node_seed -->|"evaluates sample reports"| node_filter
node_api -->|"validates responses"| node_schemas

click node_app "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/App.jsx"
click node_compare "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/ComparePage.jsx"
click node_report "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/ReportPage.jsx"
click node_live "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/FeedPage.jsx"
click node_overview "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/OverviewPage.jsx"
click node_ruler "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/PriceRuler.jsx"
click node_picker "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/ProductPicker.jsx"
click node_sparkline "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/Sparkline.jsx"
click node_ui_states "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/States.jsx"
click node_async "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/hooks.js"
click node_client "https://github.com/timewithpotato/bazardor/blob/main/frontend/src/api.js"
click node_api "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_submission "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_filter "https://github.com/timewithpotato/bazardor/blob/main/backend/app/outlier.py"
click node_area_feed "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_report_feed "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_trend "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_market "https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py"
click node_database "https://github.com/timewithpotato/bazardor/blob/main/backend/app/database.py"
click node_models "https://github.com/timewithpotato/bazardor/blob/main/backend/app/models.py"
click node_schemas "https://github.com/timewithpotato/bazardor/blob/main/backend/app/schemas.py"
click node_seed "https://github.com/timewithpotato/bazardor/blob/main/backend/app/seed.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_app,node_compare,node_report,node_live,node_overview,node_ruler,node_picker,node_sparkline,node_ui_states,node_async,node_client toneBlue
class node_api,node_submission,node_filter,node_area_feed,node_report_feed,node_trend,node_market toneAmber
class node_database,node_models,node_schemas,node_seed toneMint
class node_shopper toneIndigo
```

## Components

### Shopper interface

- [App navigation](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Area comparison](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/ComparePage.jsx): `frontend/src/pages/ComparePage.jsx`
- [Price reporting](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/ReportPage.jsx): `frontend/src/pages/ReportPage.jsx`
- [Live reports](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/FeedPage.jsx): `frontend/src/pages/FeedPage.jsx`
- [Market overview](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/pages/OverviewPage.jsx): `frontend/src/pages/OverviewPage.jsx`
- [Price ruler](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/PriceRuler.jsx): `frontend/src/components/PriceRuler.jsx`
- [Product picker](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/ProductPicker.jsx): `frontend/src/components/ProductPicker.jsx`
- [Price trend chart](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/Sparkline.jsx): `frontend/src/components/Sparkline.jsx`
- [Status and errors](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/components/States.jsx): `frontend/src/components/States.jsx`
- [Async state helpers](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/hooks.js): `frontend/src/hooks.js`
- [API client](https://github.com/timewithpotato/bazardor/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Price services

- [HTTP API](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`
- [Report submission](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`
- [Outlier and trust checks](https://github.com/timewithpotato/bazardor/blob/main/backend/app/outlier.py): `backend/app/outlier.py`
- [Area price feed](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`
- [Recent reports](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`
- [Price trend](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`
- [Market overview](https://github.com/timewithpotato/bazardor/blob/main/backend/app/main.py): `backend/app/main.py`

### Catalog and persistence

- [DB sessions](https://github.com/timewithpotato/bazardor/blob/main/backend/app/database.py): `backend/app/database.py`
- [Domain models](https://github.com/timewithpotato/bazardor/blob/main/backend/app/models.py): `backend/app/models.py`
- [API schemas](https://github.com/timewithpotato/bazardor/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Demo data seeding](https://github.com/timewithpotato/bazardor/blob/main/backend/app/seed.py): `backend/app/seed.py`

### Other components

- **Shopper**

## Connections

- Shopper → App navigation: uses (evidence: `README.md`)
- App navigation → Area comparison: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Price reporting: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Live reports: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Market overview: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → API client: loads catalog via (evidence: `frontend/src/App.jsx`)
- App navigation → Async state helpers: tracks loading via (evidence: `frontend/src/App.jsx`)
- Area comparison → API client: requests prices via (evidence: `frontend/src/pages/ComparePage.jsx`)
- Area comparison → Price ruler: renders (evidence: `frontend/src/pages/ComparePage.jsx`)
- Area comparison → Product picker: renders (evidence: `frontend/src/pages/ComparePage.jsx`)
- Area comparison → Price trend chart: renders (evidence: `frontend/src/pages/ComparePage.jsx`)
- Area comparison → Async state helpers: loads data with (evidence: `frontend/src/pages/ComparePage.jsx`)
- Price reporting → API client: submits reports via (evidence: `frontend/src/pages/ReportPage.jsx`)
- Live reports → API client: requests reports via (evidence: `frontend/src/pages/FeedPage.jsx`)
- Market overview → API client: requests summary via (evidence: `frontend/src/pages/OverviewPage.jsx`)
- Area comparison → Status and errors: shows errors via (evidence: `frontend/src/pages/ComparePage.jsx`)
- Price reporting → Status and errors: shows status via (evidence: `frontend/src/pages/ReportPage.jsx`)
- Live reports → Status and errors: shows status via (evidence: `frontend/src/pages/FeedPage.jsx`)
- Market overview → Status and errors: shows states via (evidence: `frontend/src/pages/OverviewPage.jsx`)
- API client → HTTP API: requests endpoints (evidence: `frontend/src/api.js`)
- HTTP API → Report submission: dispatches submit (evidence: `README.md`)
- HTTP API → Area price feed: dispatches feed (evidence: `README.md`)
- HTTP API → Recent reports: dispatches recent (evidence: `README.md`)
- HTTP API → Price trend: dispatches trend (evidence: `backend/app/main.py`)
- HTTP API → Market overview: dispatches overview (evidence: `README.md`)
- HTTP API → Domain models: queries domain data (evidence: `backend/app/main.py`)
- Report submission → Outlier and trust checks: evaluates report (evidence: `README.md`)
- Outlier and trust checks → Report submission: returns verdict (evidence: `README.md`)
- Report submission → DB sessions: persists report (evidence: `backend/app/main.py`)
- Area price feed → DB sessions: reads accepted reports (evidence: `backend/app/main.py`)
- Recent reports → DB sessions: reads submissions (evidence: `backend/app/main.py`)
- Price trend → DB sessions: reads accepted reports (evidence: `backend/app/main.py`)
- Market overview → DB sessions: reads market data (evidence: `backend/app/main.py`)
- DB sessions → Domain models: provides ORM base (evidence: `backend/app/models.py`)
- Demo data seeding → Domain models: creates demo records (evidence: `backend/app/seed.py`)
- Demo data seeding → Outlier and trust checks: evaluates sample reports (evidence: `backend/app/seed.py`)
- HTTP API → API schemas: validates responses (evidence: `backend/app/main.py`)
