# rishabh01487/agrieasy-com1 architecture

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

- Interactive diagram: https://gitdiagram.com/rishabh01487/agrieasy-com1
- Repository: https://github.com/rishabh01487/agrieasy-com1

## Overview

AgriEasy is a multi-role agricultural marketplace, with AgriSocial, AgriPay and billing as substantial companion products. The main marketplace journey is buyers publishing commodity demand, farmers discovering it and arranging transport, then the parties tracking delivery and settling payment. The graph also preserves social publishing and messaging, wallet operations, and ledger-based billing. README statements establish the documented product flows; sampled route excerpts show selected API-to-model and shared-service relationships. Many routes and UI pages were not sampled, so their internal wiring is not inferred.

Main entry points: [`app/api/bookings/route.ts`](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/bookings/route.ts) (Bookings), [`app/agrisocial/page.tsx`](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/page.tsx) (Social Feed & Posts), [`lib/mongodb.ts`](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/mongodb.ts) (MongoDB), [`app/api/listings/route.ts`](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/listings/route.ts) (Demand Listings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_marketplace["Marketplace &amp; Transport"]
  node_buyer_portal["Buyer Portal<br/>[page.tsx]"]
  node_listings_api["Demand Listings<br/>[route.ts]"]
  node_farmer_portal["Farmer Portal<br/>[page.tsx]"]
  node_booking_api["Bookings<br/>[route.ts]"]
  node_location_api["Location &amp; Tracking<br/>[route.ts]"]
  node_vehicle_portal["Transporter Portal<br/>[page.tsx]"]
  node_booking_model[("Booking Records<br/>[Booking.ts]")]
  node_listing_model[("Listing Records<br/>[Listing.ts]")]
end

subgraph group_social["AgriSocial"]
  node_social_ui["Social Feed &amp; Posts<br/>[page.tsx]"]
  node_social_api["Social APIs<br/>[route.ts]"]
  node_social_dm["Direct Messages<br/>[page.tsx]"]
  node_social_clips["KrishiClips<br/>[page.tsx]"]
end

subgraph group_payments["Payments &amp; Ledger"]
  node_agripay_ui["AgriPay Wallet<br/>[page.tsx]"]
  node_agripay_api["Wallet &amp; Payments<br/>[route.ts]"]
  node_ledger_ui["Billing &amp; Ledger<br/>[page.tsx]"]
  node_bill_calculator["Bill Calculator<br/>[BillCalculator.tsx]"]
  node_ledger_api["Ledger API<br/>[route.ts]"]
end

subgraph group_platform["Identity &amp; Data"]
  node_auth_ui["Registration &amp; Login<br/>[page.tsx]"]
  node_auth_service["JWT Authentication<br/>[auth.ts]"]
  node_user_model["User Profiles<br/>[User.ts]"]
  node_mongo[("MongoDB<br/>[mongodb.ts]")]
  node_audit["Audit Logging<br/>[audit.ts]"]
end

node_buyer(("Buyer"))
node_farmer(("Farmer"))
node_transporter(("Transporter"))
node_razorpay{{"Razorpay"}}

node_buyer -->|"creates demand"| node_buyer_portal
node_buyer_portal -.->|"submits listings"| node_listings_api
node_listings_api -->|"creates &amp; queries"| node_listing_model
node_farmer -->|"finds demand"| node_farmer_portal
node_farmer_portal -.->|"books transport"| node_booking_api
node_booking_api -->|"creates &amp; queries"| node_booking_model
node_booking_api -->|"checks listings"| node_listing_model
node_booking_api -->|"records actions"| node_audit
node_transporter -->|"manages bookings"| node_vehicle_portal
node_farmer -->|"shares location"| node_location_api
node_location_api -->|"updates location"| node_user_model
node_location_api -->|"updates tracking"| node_booking_model
node_farmer -->|"posts &amp; browses"| node_social_ui
node_social_ui -.->|"uses social features"| node_social_api
node_social_ui -->|"messages users"| node_social_dm
node_social_ui -->|"browses clips"| node_social_clips
node_buyer -->|"pays farmers"| node_agripay_ui
node_farmer -->|"receives payments"| node_agripay_ui
node_agripay_ui -.->|"initiates wallet actions"| node_agripay_api
node_agripay_api -.->|"tops up via"| node_razorpay
node_buyer -->|"creates invoices"| node_ledger_ui
node_ledger_ui -->|"calculates bills"| node_bill_calculator
node_ledger_ui -.->|"manages entries"| node_ledger_api
node_ledger_api -->|"connects to"| node_mongo
node_auth_ui -->|"authenticates"| node_auth_service
node_auth_service -->|"checks revocation"| node_user_model
node_auth_service -->|"connects to"| node_mongo
node_listings_api -->|"connects to"| node_mongo
node_booking_api -->|"connects to"| node_mongo

click node_buyer_portal "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/buyer/create-listing/page.tsx"
click node_listings_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/listings/route.ts"
click node_farmer_portal "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/farmer/book-vehicle/page.tsx"
click node_booking_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/bookings/route.ts"
click node_location_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/location/route.ts"
click node_vehicle_portal "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/transporter/bookings/page.tsx"
click node_social_ui "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/page.tsx"
click node_social_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/social/posts/route.ts"
click node_social_dm "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/dm/page.tsx"
click node_social_clips "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/clips/page.tsx"
click node_agripay_ui "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agripay/page.tsx"
click node_agripay_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/agripay/transfer/route.ts"
click node_ledger_ui "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/ledger/page.tsx"
click node_bill_calculator "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/ledger/BillCalculator.tsx"
click node_ledger_api "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/ledger/route.ts"
click node_auth_ui "https://github.com/rishabh01487/agrieasy-com1/blob/main/app/auth/register/page.tsx"
click node_auth_service "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/auth.ts"
click node_user_model "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/User.ts"
click node_mongo "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/mongodb.ts"
click node_booking_model "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/Booking.ts"
click node_listing_model "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/Listing.ts"
click node_audit "https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/audit.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_buyer_portal,node_listings_api,node_farmer_portal,node_booking_api,node_location_api,node_vehicle_portal,node_booking_model,node_listing_model toneBlue
class node_social_ui,node_social_api,node_social_dm,node_social_clips toneAmber
class node_agripay_ui,node_agripay_api,node_ledger_ui,node_bill_calculator,node_ledger_api toneMint
class node_auth_ui,node_auth_service,node_user_model,node_mongo,node_audit toneRose
class node_buyer,node_farmer,node_transporter,node_razorpay toneIndigo
```

## Components

### Marketplace & Transport

- [Buyer Portal](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/buyer/create-listing/page.tsx): `app/buyer/create-listing/page.tsx`
- [Demand Listings](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/listings/route.ts): `app/api/listings/route.ts`
- [Farmer Portal](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/farmer/book-vehicle/page.tsx): `app/farmer/book-vehicle/page.tsx`
- [Bookings](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/bookings/route.ts): `app/api/bookings/route.ts`
- [Location & Tracking](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/location/route.ts): `app/api/location/route.ts`
- [Transporter Portal](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/transporter/bookings/page.tsx): `app/transporter/bookings/page.tsx`
- [Booking Records](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/Booking.ts): `lib/models/Booking.ts`
- [Listing Records](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/Listing.ts): `lib/models/Listing.ts`

### AgriSocial

- [Social Feed & Posts](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/page.tsx): `app/agrisocial/page.tsx`
- [Social APIs](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/social/posts/route.ts): `app/api/social/posts/route.ts`
- [Direct Messages](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/dm/page.tsx): `app/agrisocial/dm/page.tsx`
- [KrishiClips](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agrisocial/clips/page.tsx): `app/agrisocial/clips/page.tsx`

### Payments & Ledger

- [AgriPay Wallet](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/agripay/page.tsx): `app/agripay/page.tsx`
- [Wallet & Payments](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/agripay/transfer/route.ts): `app/api/agripay/transfer/route.ts`
- [Billing & Ledger](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/ledger/page.tsx): `app/ledger/page.tsx`
- [Bill Calculator](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/ledger/BillCalculator.tsx): `app/ledger/BillCalculator.tsx`
- [Ledger API](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/api/ledger/route.ts): `app/api/ledger/route.ts`

### Identity & Data

- [Registration & Login](https://github.com/rishabh01487/agrieasy-com1/blob/main/app/auth/register/page.tsx): `app/auth/register/page.tsx`
- [JWT Authentication](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/auth.ts): `lib/auth.ts`
- [User Profiles](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/models/User.ts): `lib/models/User.ts`
- [MongoDB](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/mongodb.ts): `lib/mongodb.ts`
- [Audit Logging](https://github.com/rishabh01487/agrieasy-com1/blob/main/lib/audit.ts): `lib/audit.ts`

### Other components

- **Buyer**
- **Farmer**
- **Transporter**
- **Razorpay**

## Connections

- Buyer → Buyer Portal: creates demand
- Buyer Portal → Demand Listings: submits listings
- Demand Listings → Listing Records: creates & queries (evidence: `app/api/listings/route.ts`)
- Farmer → Farmer Portal: finds demand
- Farmer Portal → Bookings: books transport
- Bookings → Booking Records: creates & queries (evidence: `app/api/bookings/route.ts`)
- Bookings → Listing Records: checks listings (evidence: `app/api/bookings/route.ts`)
- Bookings → Audit Logging: records actions (evidence: `app/api/bookings/route.ts`)
- Transporter → Transporter Portal: manages bookings
- Farmer → Location & Tracking: shares location
- Location & Tracking → User Profiles: updates location (evidence: `app/api/location/route.ts`)
- Location & Tracking → Booking Records: updates tracking (evidence: `app/api/location/route.ts`)
- Farmer → Social Feed & Posts: posts & browses
- Social Feed & Posts → Social APIs: uses social features
- Social Feed & Posts → Direct Messages: messages users
- Social Feed & Posts → KrishiClips: browses clips
- Buyer → AgriPay Wallet: pays farmers
- Farmer → AgriPay Wallet: receives payments
- AgriPay Wallet → Wallet & Payments: initiates wallet actions
- Wallet & Payments → Razorpay: tops up via
- Buyer → Billing & Ledger: creates invoices
- Billing & Ledger → Bill Calculator: calculates bills (evidence: `app/ledger/page.tsx`)
- Billing & Ledger → Ledger API: manages entries
- Ledger API → MongoDB: connects to (evidence: `app/api/ledger/route.ts`)
- Registration & Login → JWT Authentication: authenticates
- JWT Authentication → User Profiles: checks revocation (evidence: `lib/auth.ts`)
- JWT Authentication → MongoDB: connects to (evidence: `lib/auth.ts`)
- Demand Listings → MongoDB: connects to (evidence: `app/api/listings/route.ts`)
- Bookings → MongoDB: connects to (evidence: `app/api/bookings/route.ts`)
