# korean-deamon/qadr architecture

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

- Interactive diagram: https://gitdiagram.com/korean-deamon/qadr
- Repository: https://github.com/korean-deamon/qadr

## Overview

Qadr is a multilingual neighborhood borrowing marketplace. A user discovers nearby listings, contacts an owner or submits a borrow request, then participants manage approval, loan return, messages, and notifications; administrators review reports and listings. The graph combines the documented product areas with source-indexed backend routes and services. Several frontend-to-API and unsampled feature connections are not visible in the excerpts, so they are shown as unverified rather than asserted as calls.

Main entry points: [`server/app/api/v1/router.py`](https://github.com/korean-deamon/qadr/blob/main/server/app/api/v1/router.py) (API v1 router), [`server/app/db/models`](https://github.com/korean-deamon/qadr/tree/main/server/app/db/models) (PostgreSQL data), [`client/src/app/[locale]`](https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D) (Localized web app), [`client/src/lib/api.ts`](https://github.com/korean-deamon/qadr/blob/main/client/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Localized web app"]
  node_discovery["Listing discovery<br/>[page.tsx]"]
  node_listingui["Listing management"]
  node_borrowui["Borrowing views<br/>[page.tsx]"]
  node_inboxui["Messages and alerts"]
  node_adminui["Moderation panel<br/>[page.tsx]"]
  node_apiclient["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_apiapp["FastAPI application<br/>[main.py]"]
  node_router["API v1 router<br/>[router.py]"]
  node_auth["Authentication<br/>[service.py]"]
  node_identity["User profiles<br/>[routes.py]"]
end

subgraph group_market["Marketplace lifecycle"]
  node_listing["Listings and saved items<br/>[service.py]"]
  node_categories["Categories<br/>[routes.py]"]
  node_borrowing["Borrow requests<br/>[service.py]"]
  node_loans["Loan tracking<br/>[service.py]"]
end

subgraph group_community["Communication and trust"]
  node_messages["Direct messages and calls<br/>[service.py]"]
  node_notifications["Notifications<br/>[service.py]"]
  node_moderation["Reports and moderation<br/>[routes.py]"]
  node_telegram["Telegram integration<br/>[service.py]"]
end

subgraph group_runtime["Runtime services"]
  node_realtime["Realtime delivery<br/>[event_bus.py]"]
  node_tasks["Scheduled jobs"]
  node_database[("PostgreSQL data")]
end

node_neighbor(("Neighbor"))

node_neighbor -->|"uses"| node_webapp
node_webapp -->|"browses"| node_discovery
node_webapp -->|"manages listings"| node_listingui
node_webapp -->|"manages borrowing"| node_borrowui
node_webapp -->|"communicates"| node_inboxui
node_webapp -->|"moderates"| node_adminui
node_discovery -.->|"requests data"| node_apiclient
node_listingui -.->|"submits changes"| node_apiclient
node_borrowui -.->|"requests borrowing"| node_apiclient
node_inboxui -.->|"loads messages"| node_apiclient
node_adminui -.->|"loads reports"| node_apiclient
node_apiclient -.->|"calls API"| node_apiapp
node_apiapp -->|"mounts routes"| node_router
node_router -->|"routes to"| node_auth
node_router -->|"routes to"| node_identity
node_router -->|"routes to"| node_listing
node_router -->|"routes to"| node_categories
node_router -->|"routes to"| node_borrowing
node_router -->|"routes to"| node_loans
node_router -->|"routes to"| node_messages
node_router -->|"routes to"| node_notifications
node_router -->|"routes to"| node_moderation
node_router -->|"routes to"| node_telegram
node_borrowing -->|"uses listing service"| node_listing
node_borrowing -->|"creates alerts"| node_notifications
node_listing -->|"publishes events"| node_realtime
node_notifications -->|"publishes events"| node_realtime
node_moderation -->|"creates alerts"| node_notifications
node_telegram -.->|"bot interaction"| node_neighbor
node_auth -->|"reads and writes"| node_database
node_identity -->|"reads and writes"| node_database
node_listing -->|"reads and writes"| node_database
node_categories -->|"reads data"| node_database
node_borrowing -->|"reads and writes"| node_database
node_loans -.->|"updates loans"| node_database
node_messages -->|"reads and writes"| node_database
node_notifications -->|"reads and writes"| node_database
node_moderation -->|"reads and writes"| node_database
node_tasks -.->|"sends reminders"| node_neighbor

click node_webapp "https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D"
click node_discovery "https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/explore/page.tsx"
click node_listingui "https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D/items"
click node_borrowui "https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/borrowings/page.tsx"
click node_inboxui "https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D/messages"
click node_adminui "https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/admin/reports/page.tsx"
click node_apiclient "https://github.com/korean-deamon/qadr/blob/main/client/src/lib/api.ts"
click node_apiapp "https://github.com/korean-deamon/qadr/blob/main/server/app/main.py"
click node_router "https://github.com/korean-deamon/qadr/blob/main/server/app/api/v1/router.py"
click node_auth "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/auth/service.py"
click node_identity "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/users/routes.py"
click node_listing "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/listings/service.py"
click node_categories "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/categories/routes.py"
click node_borrowing "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/borrowing/service.py"
click node_loans "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/loans/service.py"
click node_messages "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/messages/service.py"
click node_notifications "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/notifications/service.py"
click node_moderation "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/moderation/routes.py"
click node_telegram "https://github.com/korean-deamon/qadr/blob/main/server/app/modules/telegram/service.py"
click node_realtime "https://github.com/korean-deamon/qadr/blob/main/server/app/realtime/event_bus.py"
click node_tasks "https://github.com/korean-deamon/qadr/tree/main/server/app/tasks"
click node_database "https://github.com/korean-deamon/qadr/tree/main/server/app/db/models"

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_webapp,node_discovery,node_listingui,node_borrowui,node_inboxui,node_adminui,node_apiclient toneBlue
class node_apiapp,node_router,node_auth,node_identity toneAmber
class node_listing,node_categories,node_borrowing,node_loans toneMint
class node_messages,node_notifications,node_moderation,node_telegram toneRose
class node_realtime,node_tasks,node_database,node_neighbor toneIndigo
```

## Components

### Web experience

- [Localized web app](https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D): `client/src/app/[locale]`
- [Listing discovery](https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/explore/page.tsx): `client/src/app/[locale]/explore/page.tsx`
- [Listing management](https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D/items): `client/src/app/[locale]/items`
- [Borrowing views](https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/borrowings/page.tsx): `client/src/app/[locale]/borrowings/page.tsx`
- [Messages and alerts](https://github.com/korean-deamon/qadr/tree/main/client/src/app/%5Blocale%5D/messages): `client/src/app/[locale]/messages`
- [Moderation panel](https://github.com/korean-deamon/qadr/blob/main/client/src/app/%5Blocale%5D/admin/reports/page.tsx): `client/src/app/[locale]/admin/reports/page.tsx`
- [API client](https://github.com/korean-deamon/qadr/blob/main/client/src/lib/api.ts): `client/src/lib/api.ts`

### API and identity

- [FastAPI application](https://github.com/korean-deamon/qadr/blob/main/server/app/main.py): `server/app/main.py`
- [API v1 router](https://github.com/korean-deamon/qadr/blob/main/server/app/api/v1/router.py): `server/app/api/v1/router.py`
- [Authentication](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/auth/service.py): `server/app/modules/auth/service.py`
- [User profiles](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/users/routes.py): `server/app/modules/users/routes.py`

### Marketplace lifecycle

- [Listings and saved items](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/listings/service.py): `server/app/modules/listings/service.py`
- [Categories](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/categories/routes.py): `server/app/modules/categories/routes.py`
- [Borrow requests](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/borrowing/service.py): `server/app/modules/borrowing/service.py`
- [Loan tracking](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/loans/service.py): `server/app/modules/loans/service.py`

### Communication and trust

- [Direct messages and calls](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/messages/service.py): `server/app/modules/messages/service.py`
- [Notifications](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/notifications/service.py): `server/app/modules/notifications/service.py`
- [Reports and moderation](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/moderation/routes.py): `server/app/modules/moderation/routes.py`
- [Telegram integration](https://github.com/korean-deamon/qadr/blob/main/server/app/modules/telegram/service.py): `server/app/modules/telegram/service.py`

### Runtime services

- [Realtime delivery](https://github.com/korean-deamon/qadr/blob/main/server/app/realtime/event_bus.py): `server/app/realtime/event_bus.py`
- [Scheduled jobs](https://github.com/korean-deamon/qadr/tree/main/server/app/tasks): `server/app/tasks`
- [PostgreSQL data](https://github.com/korean-deamon/qadr/tree/main/server/app/db/models): `server/app/db/models`

### Other components

- **Neighbor**

## Connections

- Neighbor → Localized web app: uses (evidence: `README.md`)
- Localized web app → Listing discovery: browses (evidence: `README.md`)
- Localized web app → Listing management: manages listings (evidence: `README.md`)
- Localized web app → Borrowing views: manages borrowing (evidence: `README.md`)
- Localized web app → Messages and alerts: communicates (evidence: `README.md`)
- Localized web app → Moderation panel: moderates (evidence: `README.md`)
- Listing discovery → API client: requests data
- Listing management → API client: submits changes
- Borrowing views → API client: requests borrowing
- Messages and alerts → API client: loads messages
- Moderation panel → API client: loads reports
- API client → FastAPI application: calls API
- FastAPI application → API v1 router: mounts routes (evidence: `server/app/main.py`)
- API v1 router → Authentication: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → User profiles: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Listings and saved items: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Categories: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Borrow requests: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Loan tracking: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Direct messages and calls: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Notifications: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Reports and moderation: routes to (evidence: `server/app/api/v1/router.py`)
- API v1 router → Telegram integration: routes to (evidence: `server/app/api/v1/router.py`)
- Borrow requests → Listings and saved items: uses listing service (evidence: `server/app/modules/borrowing/service.py`)
- Borrow requests → Notifications: creates alerts (evidence: `server/app/modules/borrowing/service.py`)
- Listings and saved items → Realtime delivery: publishes events (evidence: `server/app/modules/listings/service.py`)
- Notifications → Realtime delivery: publishes events (evidence: `server/app/modules/notifications/service.py`)
- Reports and moderation → Notifications: creates alerts (evidence: `server/app/modules/moderation/routes.py`)
- Telegram integration → Neighbor: bot interaction
- Authentication → PostgreSQL data: reads and writes (evidence: `server/app/modules/auth/service.py`)
- User profiles → PostgreSQL data: reads and writes (evidence: `server/app/modules/users/routes.py`)
- Listings and saved items → PostgreSQL data: reads and writes (evidence: `server/app/modules/listings/service.py`)
- Categories → PostgreSQL data: reads data (evidence: `server/app/modules/categories/routes.py`)
- Borrow requests → PostgreSQL data: reads and writes (evidence: `server/app/modules/borrowing/service.py`)
- Loan tracking → PostgreSQL data: updates loans
- Direct messages and calls → PostgreSQL data: reads and writes (evidence: `server/app/modules/messages/service.py`)
- Notifications → PostgreSQL data: reads and writes (evidence: `server/app/modules/notifications/service.py`)
- Reports and moderation → PostgreSQL data: reads and writes (evidence: `server/app/modules/moderation/routes.py`)
- Scheduled jobs → Neighbor: sends reminders
