# dhanuprithika/aruva architecture

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

- Interactive diagram: https://gitdiagram.com/dhanuprithika/aruva
- Repository: https://github.com/dhanuprithika/aruva

## Overview

Aruva is an agricultural marketplace with farmer listings, buyer and retailer discovery, interest requests, account/profile management, and notifications. The main journey runs from a role-based user through the React app and API to authentication, crop or marketplace operations, and PostgreSQL-backed records. README also describes market intelligence, AI recommendations, and Tamil accessibility, but sampled runtime sources do not show those implementations, so they are represented only as documented capabilities. Frontend request wiring is evidenced; finer unsampled routes and integrations are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/dhanuprithika/aruva/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/dependencies/auth.py`](https://github.com/dhanuprithika/aruva/blob/main/backend/app/dependencies/auth.py) (JWT and role checks), [`backend/app/models/models.py`](https://github.com/dhanuprithika/aruva/blob/main/backend/app/models/models.py) (Domain records), [`backend/app/services/marketplace_service.py`](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/marketplace_service.py) (Discovery and interests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User application"]
  node_webapp["Marketplace UI<br/>[App.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
  node_i18n["English and Tamil<br/>[App.tsx]"]
end

subgraph group_api["API and access"]
  node_apiapp["FastAPI application<br/>[main.py]"]
  node_authguard["JWT and role checks<br/>[auth.py]"]
end

subgraph group_market["Marketplace workflows"]
  node_farmerroute["Farmer routes<br/>[farmer.py]"]
  node_buyerroute["Buyer routes<br/>[buyer.py]"]
  node_retailerroute["Retailer routes<br/>[retailer.py]"]
  node_cropservice["Crop listings<br/>[crop_service.py]"]
  node_marketservice["Discovery and interests"]
  node_notifroute["Notification routes<br/>[notifications.py]"]
  node_notifservice["Notification service"]
  node_marketintel["Market intelligence"]
  node_ai["AI recommendations"]
end

subgraph group_identity["Identity and profiles"]
  node_authroute["Authentication routes<br/>[auth.py]"]
  node_profileroute["Profile routes<br/>[profile.py]"]
  node_security["Token security<br/>[security.py]"]
  node_authsvc["Registration and login<br/>[auth_service.py]"]
  node_usersvc["User profiles<br/>[user_service.py]"]
end

subgraph group_data["Persistence"]
  node_models["Domain records<br/>[models.py]"]
  node_session["Async database session<br/>[session.py]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Farmers, buyers, retailers"))

node_user -->|"uses"| node_webapp
node_webapp -->|"requests"| node_webapi
node_webapi -.->|"calls API"| node_apiapp
node_apiapp -->|"registers"| node_authroute
node_apiapp -->|"registers"| node_profileroute
node_apiapp -->|"registers"| node_farmerroute
node_apiapp -->|"registers"| node_buyerroute
node_apiapp -->|"registers"| node_retailerroute
node_apiapp -->|"registers"| node_notifroute
node_authroute -->|"calls"| node_authsvc
node_authroute -->|"calls"| node_usersvc
node_profileroute -->|"calls"| node_usersvc
node_authsvc -->|"creates tokens"| node_security
node_authguard -->|"decodes token"| node_security
node_authguard -->|"queries user"| node_session
node_farmerroute -->|"requires role"| node_authguard
node_buyerroute -->|"requires role"| node_authguard
node_retailerroute -->|"requires role"| node_authguard
node_notifroute -->|"requires user"| node_authguard
node_farmerroute -->|"calls"| node_cropservice
node_farmerroute -->|"calls"| node_marketservice
node_buyerroute -->|"calls"| node_marketservice
node_buyerroute -->|"calls"| node_cropservice
node_retailerroute -->|"calls"| node_marketservice
node_retailerroute -->|"calls"| node_cropservice
node_notifroute -->|"calls"| node_notifservice
node_marketservice -->|"reads and writes"| node_models
node_cropservice -->|"reads and writes"| node_models
node_authsvc -->|"creates records"| node_models
node_usersvc -->|"updates records"| node_models
node_notifservice -->|"uses records"| node_models
node_models -->|"extends base"| node_session
node_apiapp -->|"disposes engine"| node_session
node_session -.->|"persists data"| node_postgres
node_marketservice -.->|"creates notifications"| node_notifservice
node_user -.->|"uses insights"| node_marketintel
node_user -.->|"requests recommendations"| node_ai
node_user -.->|"selects language"| node_i18n

click node_webapp "https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/App.tsx"
click node_webapi "https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/api.ts"
click node_apiapp "https://github.com/dhanuprithika/aruva/blob/main/backend/app/main.py"
click node_authroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/auth.py"
click node_profileroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/profile.py"
click node_authguard "https://github.com/dhanuprithika/aruva/blob/main/backend/app/dependencies/auth.py"
click node_security "https://github.com/dhanuprithika/aruva/blob/main/backend/app/core/security.py"
click node_authsvc "https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/auth_service.py"
click node_usersvc "https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/user_service.py"
click node_farmerroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/farmer.py"
click node_buyerroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/buyer.py"
click node_retailerroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/retailer.py"
click node_cropservice "https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/crop_service.py"
click node_marketservice "https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/marketplace_service.py"
click node_notifroute "https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/notifications.py"
click node_notifservice "https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/notification_service.py"
click node_models "https://github.com/dhanuprithika/aruva/blob/main/backend/app/models/models.py"
click node_session "https://github.com/dhanuprithika/aruva/blob/main/backend/app/database/session.py"
click node_marketintel "https://github.com/dhanuprithika/aruva/tree/main/backend/app"
click node_ai "https://github.com/dhanuprithika/aruva/tree/main/backend/app"
click node_i18n "https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/App.tsx"

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_webapi,node_i18n toneBlue
class node_apiapp,node_authguard toneAmber
class node_farmerroute,node_buyerroute,node_retailerroute,node_cropservice,node_marketservice,node_notifroute,node_notifservice,node_marketintel,node_ai toneMint
class node_authroute,node_profileroute,node_security,node_authsvc,node_usersvc toneRose
class node_models,node_session,node_postgres,node_user toneIndigo
```

## Components

### User application

- [Marketplace UI](https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [API client](https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/api.ts): `frontend/src/app/api.ts`
- [English and Tamil](https://github.com/dhanuprithika/aruva/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`

### API and access

- [FastAPI application](https://github.com/dhanuprithika/aruva/blob/main/backend/app/main.py): `backend/app/main.py`
- [JWT and role checks](https://github.com/dhanuprithika/aruva/blob/main/backend/app/dependencies/auth.py): `backend/app/dependencies/auth.py`

### Marketplace workflows

- [Farmer routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/farmer.py): `backend/app/routers/farmer.py`
- [Buyer routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/buyer.py): `backend/app/routers/buyer.py`
- [Retailer routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/retailer.py): `backend/app/routers/retailer.py`
- [Crop listings](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/crop_service.py): `backend/app/services/crop_service.py`
- [Discovery and interests](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/marketplace_service.py): `backend/app/services/marketplace_service.py`
- [Notification routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/notifications.py): `backend/app/routers/notifications.py`
- [Notification service](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/notification_service.py): `backend/app/services/notification_service.py`
- [Market intelligence](https://github.com/dhanuprithika/aruva/tree/main/backend/app): `backend/app`
- [AI recommendations](https://github.com/dhanuprithika/aruva/tree/main/backend/app): `backend/app`

### Identity and profiles

- [Authentication routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Profile routes](https://github.com/dhanuprithika/aruva/blob/main/backend/app/routers/profile.py): `backend/app/routers/profile.py`
- [Token security](https://github.com/dhanuprithika/aruva/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Registration and login](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [User profiles](https://github.com/dhanuprithika/aruva/blob/main/backend/app/services/user_service.py): `backend/app/services/user_service.py`

### Persistence

- [Domain records](https://github.com/dhanuprithika/aruva/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [Async database session](https://github.com/dhanuprithika/aruva/blob/main/backend/app/database/session.py): `backend/app/database/session.py`
- **PostgreSQL**

### Other components

- **Farmers, buyers, retailers**

## Connections

- Farmers, buyers, retailers → Marketplace UI: uses (evidence: `README.md`)
- Marketplace UI → API client: requests (evidence: `frontend/src/app/App.tsx`)
- API client → FastAPI application: calls API
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Profile routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Farmer routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Buyer routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Retailer routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Notification routes: registers (evidence: `backend/app/main.py`)
- Authentication routes → Registration and login: calls (evidence: `backend/app/routers/auth.py`)
- Authentication routes → User profiles: calls (evidence: `backend/app/routers/auth.py`)
- Profile routes → User profiles: calls (evidence: `backend/app/routers/profile.py`)
- Registration and login → Token security: creates tokens (evidence: `backend/app/services/auth_service.py`)
- JWT and role checks → Token security: decodes token (evidence: `backend/app/dependencies/auth.py`)
- JWT and role checks → Async database session: queries user (evidence: `backend/app/dependencies/auth.py`)
- Farmer routes → JWT and role checks: requires role (evidence: `backend/app/routers/farmer.py`)
- Buyer routes → JWT and role checks: requires role (evidence: `backend/app/routers/buyer.py`)
- Retailer routes → JWT and role checks: requires role (evidence: `backend/app/routers/retailer.py`)
- Notification routes → JWT and role checks: requires user (evidence: `backend/app/routers/notifications.py`)
- Farmer routes → Crop listings: calls (evidence: `backend/app/routers/farmer.py`)
- Farmer routes → Discovery and interests: calls (evidence: `backend/app/routers/farmer.py`)
- Buyer routes → Discovery and interests: calls (evidence: `backend/app/routers/buyer.py`)
- Buyer routes → Crop listings: calls (evidence: `backend/app/routers/buyer.py`)
- Retailer routes → Discovery and interests: calls (evidence: `backend/app/routers/retailer.py`)
- Retailer routes → Crop listings: calls (evidence: `backend/app/routers/retailer.py`)
- Notification routes → Notification service: calls (evidence: `backend/app/routers/notifications.py`)
- Discovery and interests → Domain records: reads and writes (evidence: `backend/app/services/marketplace_service.py`)
- Crop listings → Domain records: reads and writes (evidence: `backend/app/services/crop_service.py`)
- Registration and login → Domain records: creates records (evidence: `backend/app/services/auth_service.py`)
- User profiles → Domain records: updates records (evidence: `backend/app/services/user_service.py`)
- Notification service → Domain records: uses records (evidence: `backend/app/services/notification_service.py`)
- Domain records → Async database session: extends base (evidence: `backend/app/models/models.py`)
- FastAPI application → Async database session: disposes engine (evidence: `backend/app/main.py`)
- Async database session → PostgreSQL: persists data
- Discovery and interests → Notification service: creates notifications
- Farmers, buyers, retailers → Market intelligence: uses insights (evidence: `README.md`)
- Farmers, buyers, retailers → AI recommendations: requests recommendations (evidence: `README.md`)
- Farmers, buyers, retailers → English and Tamil: selects language (evidence: `README.md`)
