Skip to content
Β 
Β 

Latest commit

Β 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 Vanijya (ΰ€΅ΰ€Ύΰ€£ΰ€Ώΰ€œΰ₯ΰ€―)

National Agricultural Price Discovery, Direct Market Linkages & Verified Trading Portal
Smart India Hackathon 2026 | Problem Statement: SIH 26132


Build Status Tests Database Security Workflow Theme Languages


🌟 Key Features & Architectural Highlights

                    ONE VANIJYA PORTAL
                            β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό                           β–Ό
      PUBLIC MARKET DATA             COMMON LOGIN & SIGNUP
      (Agmarknet Benchmarks)              β”‚
                                          β–Ό
                                 VISUAL ALPHANUMERIC
                                       CAPTCHA
                                          β”‚
                                          β–Ό
                                ADMIN VERIFICATION DESK
                                          β”‚
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β–Ό                β–Ό                β–Ό
                      FARMER            BUYER            ADMIN
                         β”‚                β”‚                β”‚
                    Command Center   Procurement Desk  Oversight Cockpit
                    Lots & Offers    Bids & Catalog    12-KPI Monitor
                    Direct Sales     Purchase Orders   Audit Trail
                    Profile Gate     Profile Gate      Registration Desk
                    GPS & Photo      GPS & Photo       Dossier Inspection

1. πŸ›‘οΈ Secure Signup & Identity Verification Workflow (/signup)

  • Step 1: Account Persona Selection: Choose between 🌾 Farmer / Producer and 🏒 Institutional / Wholesale Buyer (Admin accounts cannot be self-registered).
  • Step 2: Profile Photo Verification:
    • Live HTML5 webcam snapshot (navigator.mediaDevices.getUserMedia) or drag-and-drop file upload (JPEG, PNG, WebP $\le 5\text{MB}$).
    • Persisted in MongoDB GridFS (profile_photos bucket) and rendered across user avatars and admin dossier review.
  • Step 3: Geolocation Coordination:
    • Instant GPS location detection (navigator.geolocation.getCurrentPosition) saved as GeoJSON Point [longitude, latitude] with 2dsphere spatial indexing.
    • Manual regional address fallback (State, District, Village / Warehouse Hub).
  • Step 4: Operational Credentials & Security Challenge:
    • Farmers: Primary Crop, Farm Size (Acres), KCC Number, APMC License.
    • Buyers: Organization, Contact Person, Business Type, Warehouse Location, GSTIN, FSSAI License.
    • Live Password Strength Meter: 5-point evaluation verifying 8+ characters, uppercase, lowercase, number, and special character rules.
    • Visual Alphanumeric CAPTCHA: Direct SVG challenge verification.
  • Step 5: Registration Confirmation Screen: Displays 🟑 Pending Admin Verification.
  • Login Enforcement:
    • PENDING accounts are blocked with an approval status notification.
    • REJECTED accounts are blocked and display the administrator's specific rejection reason.
    • APPROVED accounts receive JWT session tokens and access their dashboard with a 🟒 Verified badge.

2. πŸ›οΈ Admin Applicant Verification Desk (/dashboard β†’ Registration Requests)

  • 4 Real-Time KPI Cards: Pending Farmers, Pending Buyers, Approved Today, Rejected Today.
  • Interactive Applicant Directory: Full-text search (name, phone, organization, district, state), role filters, and status filters.
  • Applicant Dossier Review Modal: Complete inspection of applicant identity photo, GPS coordinates, and agricultural/commercial credentials before approval.
  • Structured Rejection Dialog: Captures constructive rejection reasons logged to the user's permanent record.
  • Chronological Audit Trail: Records USER_REGISTERED, USER_APPROVED, and USER_REJECTED audit events.

3. πŸ”” Persistent Notification Center (NotificationBell)

  • Real-time notification feed in the top navigation bar with unread badge count, dropdown panel, and background polling.
  • Automated Event Triggers:
    • Sourcing bid placed β†’ Farmer receives BID_RECEIVED.
    • Bid modified / cancelled β†’ Farmer receives BID_MODIFIED / BID_CANCELLED.
    • Farmer accepts offer β†’ Winning buyer receives BID_ACCEPTED & PAYMENT_INITIATED; competing bidders receive BID_REJECTED.
    • Payment settled β†’ Farmer receives PAYMENT_PAID.
    • Registration submitted / approved / rejected β†’ System notifications dispatched.

4. 🌾 Farmer Produce Management with Categorized Views

  • "My Lots" area with category tabs: All, Active Bidding (πŸ”₯), Sold (βœ…), Open (πŸ“‹), and Cancelled (❌).
  • Dedicated views for Active Bidding lots (asking price, top bid, live incoming offers) and Sold contracts (buyer, contract total, payment status).
  • 6 KPI dashboard summary cards dynamically calculated from backend data (Active Bidding, Sold Lots, Pending Bids, Open Lots, Total Sales, Pending Payments).

5. 🏒 Buyer Procurement & Bid Lifecycle Management

  • Live Bid Multiplier: Real-time Bid Rate Γ— Quantity = Total Order Value calculation on lot detail pages.
  • Self-Service Quantity Modification: Update pending bid quantities ($0 < \text{newQuantity} \le \text{lot.quantity}$) with automated bounds checking.
  • Self-Service Bid Cancellation: Withdraw pending bids (PENDING β†’ WITHDRAWN) with audit logging.

6. πŸ“Š Public Price Discovery (/prices β€” No Login Required)

  • Live Agmarknet benchmark rates, 7-day Simple Moving Average (SMA) charts, volatility indicators, and regional Spatial Arbitrage calculator accessible without authentication.

7. 🌐 Trilingual Internationalization (i18n)

  • 1-click instantaneous switching between English, ΰ€Ήΰ€Ώΰ€‚ΰ€¦ΰ₯€ (Hindi), and ఀెలుగు (Telugu) across all 17 routes, status badges, forms, and validation prompts.

8. πŸƒ Modern MongoDB Data Layer & 100% Offline Resiliency

  • Robust Mongoose schemas with 2dsphere indexing, GridFS streaming bucket, atomic multi-document transaction handling, and auto-seeding demo data with zero-downtime in-memory fallback.

🧭 Application Endpoints

Portal / Feature URL Description
Unified Web Portal http://localhost:3000 Public landing page with live mandi tickers & core features
Public Price Discovery http://localhost:3000/prices Live rates, 7-day trend chart & arbitrage (No login needed)
Common Sign In http://localhost:3000/login Unified login with visual CAPTCHA & approval check
Unified Registration http://localhost:3000/signup Photo capture, GPS location, password meter & CAPTCHA
Smart Dashboard http://localhost:3000/dashboard Role-aware cockpit (Farmer, Buyer, Admin Verification Desk)
Farmer Lots & Bids http://localhost:3000/my-lots Category tabs: All, Active Bidding, Sold, Open, Cancelled
Buyer Active Bids http://localhost:3000/my-bids Buyer bids management with Modify Quantity & Cancel Bid
Marketplace Catalog http://localhost:3000/browse-lots Sourcing lots with live procurement value calculation
Profile Management http://localhost:3000/profile Identity photo, GPS location, and KYC completion gauge
Backend API & Swagger Docs http://localhost:4000/api/docs 34 NestJS REST APIs & Swagger interactive docs

πŸ”‘ Pre-Configured Demo Credentials

On the unified login page (http://localhost:3000/login), click any role tab to auto-fill credentials:

Persona Name / Entity Identifier Password Role & Purpose
Farmer (ΰ€•ΰ€Ώΰ€Έΰ€Ύΰ€¨) Ramesh Patel 9876543210 Farmer@123 Nashik, Maharashtra (Verified Farmer)
Buyer (ΰ€΅ΰ₯ΰ€―ΰ€Ύΰ€ͺΰ€Ύΰ€°ΰ₯€) FreshCart Agro Ltd. buyer@freshcart.com asdfcv321 Mumbai, Maharashtra (Verified Buyer)
Admin (ΰ€΅ΰ₯ΰ€―ΰ€΅ΰ€Έΰ₯ΰ€₯ΰ€Ύΰ€ͺΰ€•) Vanijya System Admin admin@vanijya.gov.in Admin@123 Ministry of Agriculture Oversight

πŸš€ Local Development Setup

1. Prerequisites

  • Node.js: v18 or v20+ LTS
  • MongoDB: Local MongoDB instance (e.g. mongodb://localhost:27017/vanijya) or MongoDB Atlas
  • npm: v9 or v10+

2. Installation

# Clone the repository
git clone https://github.com/nithinpanuganti/Vanijya.git
cd Vanijya

# Install all workspace dependencies
npm install

# Build shared packages
npm run build:packages

3. Running the Application

Option A: 1-Click Desktop Launcher on Windows (Recommended)

Double-click start-vanijya.bat in the root directory.

Option B: Terminal Commands

Run the Backend and Frontend in separate terminals:

# Terminal 1: Start Backend API (Port 4000)
npm run start:dev --workspace=apps/backend

# Terminal 2: Start Unified Web Portal (Port 3000)
npm run dev

The portal will be available at http://localhost:3000 and API documentation at http://localhost:4000/api/docs.


πŸ§ͺ Automated Testing

All 66 automated unit, integration, and end-to-end transaction loop tests pass with 100% success rate:

npm test --workspace=@vanijya/backend
PASS src/e2e-live-loop.spec.ts
PASS src/prices/services/price-analytics.service.spec.ts
PASS src/app.controller.spec.ts
PASS src/auth/captcha.service.spec.ts
PASS src/notifications/notifications.service.spec.ts
PASS src/bids/bids.service.spec.ts
PASS src/admin/admin.service.spec.ts
PASS src/prices/prices.service.spec.ts
PASS src/auth/auth.service.spec.ts
PASS src/lots/lots.service.spec.ts

Test Suites: 10 passed, 10 total
Tests:       66 passed, 66 total
Snapshots:   0 total
Time:        12.1 s

πŸ“‹ Judge Demonstration Walkthrough

1. Open Vanijya Portal (http://localhost:3000) & Click "Sign In" (/login)
   └─ Click "Create New Account" -> Opens /signup

2. Step 1: Choose Persona
   └─ Select [ 🌾 Farmer ] or [ 🏒 Buyer ]

3. Step 2: Live Photo & GPS Location
   └─ Take Live Webcam Snapshot or Upload Identity Photo (GridFS)
   └─ Click "Detect My Current Location" -> Acquires GPS Coordinates

4. Step 3: Fill Details & Verify CAPTCHA
   └─ Name, Mobile (e.g. 9811223344), Password (with live strength gauge), Location & Crops
   └─ Enter Visual Alphanumeric CAPTCHA (e.g. K7P4X)
   └─ Click "Submit Application for Verification"

5. Step 4: View Confirmation Screen
   └─ Displays 🟑 "Pending Admin Verification"

6. Attempt Login before Approval
   └─ Go to /login -> Enter 9811223344 -> CAPTCHA -> Sign In
   └─ Blocked with notice: "Your account is awaiting admin approval."

7. Login as System Administrator
   └─ Use admin@vanijya.gov.in / Admin@123 -> Enter CAPTCHA -> Sign In
   └─ Open "Registration Requests" tab in Admin Dashboard
   └─ Click "Review Application" -> Inspect Applicant Photo, GPS, and Credentials Dossier
   └─ Click "Approve User" (or "Reject Request" with constructive reason)

8. Login as Newly Approved User
   └─ Sign out of Admin -> Sign in with the newly approved Farmer credentials
   └─ Farmer reaches Command Center with "🟒 Verified Farmer" badge and profile avatar

πŸ›οΈ Smart India Hackathon 2026 Compliance

  • Problem Statement: SIH 26132
  • Organization: Ministry of Agriculture & Farmers Welfare
  • Theme: Agriculture, FoodTech & Rural Development
  • Outcome: Direct farmer price discovery, visual alphanumeric CAPTCHA security verification, live photo capture & GridFS verification, GeoJSON location capture, complete registration & admin verification lifecycle, persistent multi-event notifications, and auditable national trade monitoring.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages