The Vanijya AI ๐ŸŒพ

An AI-powered platform that empowers India's local vendors by enabling real-time multilingual communication, AI price discovery, smart negotiation, and direct buyer-seller connections inside local markets (mandis) using Google Gemini AI with secure authentication and cloud data storage.

Vanijya Ai TypeScript Tailwind CSS Gemini AI MongoDB NextAuth

Features

Secure Authentication System โœจ

  • Google OAuth Integration with NextAuth.js
  • User Profile Management with secure data storage
  • Protected Routes and session management
  • MongoDB Integration for persistent user data
  • Profile Setup Flow after first login

Real AI Integration โœจ

  • Google Gemini AI for translation and market analysis
  • Live Speech Recognition with AI enhancement
  • Smart Price Analysis using real-time market intelligence
  • AI-Generated Market Insights with comprehensive analysis
  • Dynamic Market Data tailored to user queries
  • Context-Aware Translation preserving cultural nuances

Direct Buyer-Seller Connections โœจ

  • Real User Listings stored in MongoDB with authentication
  • Product Management - Add, edit, delete your listings
  • Contact Integration - Phone, Email, and WhatsApp support
  • Smart Contact Display - One phone, one email, one WhatsApp per listing
  • WhatsApp Integration - Pre-filled messages with "Vanijya AI" branding
  • User Verification - All listings linked to authenticated Google accounts
  • Advanced Filtering - Search by type, category, location, and keywords

Smart Inventory Management โœจ

  • MongoDB-Based Storage - Real inventory data for each user
  • AI-Powered Insights - Stock monitoring and recommendations
  • CRUD Operations - Add, view, edit, delete inventory items
  • Stock Alerts - Low stock warnings and reorder suggestions
  • Category Management - Organized inventory by product categories
  • User-Specific Data - Secure, isolated inventory per authenticated user

Live Market Data Integration โœจ

  • SERP API Integration - Real-time market data from search engines
  • Dynamic Price Discovery - Live commodity prices and trends
  • Market Intelligence - Real market conditions and pricing
  • No Dummy Data - All market information sourced from live APIs
  • Comprehensive Search - Multiple data sources for accurate pricing
  • Real-Time Updates - Fresh market data with each query

Weather Insights โœจ

  • OpenWeatherMap Integration - Real-time weather data and forecasts
  • GPS Location Detection - Automatic current location weather
  • Manual Location Search - Search weather for any city or region
  • Agricultural Insights - AI-powered farming recommendations based on weather
  • 8-Hour Forecast - Detailed hourly weather predictions
  • Interactive Maps - Visual location display with coordinates
  • Farming Alerts - Temperature, humidity, and wind warnings for crops
  • Market Impact Analysis - Weather-based market condition insights

Translation Chatbot โœจ

  • Free Translation API - MyMemory API integration for unlimited translations
  • 20+ Languages Supported - All major Indian and international languages
  • Floating Chat Widget - Always accessible from bottom-right corner
  • Real-time Translation - Instant text translation between any language pairs
  • Text-to-Speech - Listen to translated text pronunciation
  • Copy to Clipboard - Easy sharing of translated content
  • Language Swapping - Quick swap between source and target languages
  • Chat History - Persistent conversation with timestamps
  • Vanijya AI Branding - Custom design with round logo integration

Multilingual Communication

  • Voice-First Interface: Speak naturally in your native language
  • 6 Languages Supported: Hindi, Tamil, Telugu, Kannada, Marathi, English
  • Real-time AI Translation: Gemini-powered context-aware translation
  • Cultural Intelligence: Understands local market customs and phrases
  • Enhanced Speech Recognition: AI-improved accuracy for agricultural terms
  • Complete UI Translation: All pages and features available in multiple languages
  • Translation Chatbot: Floating widget for instant text translation between 20+ languages
  • Free Translation Service: MyMemory API integration with unlimited usage

Smart Market Analysis

  • AI-Powered Market Data: Gemini AI generates comprehensive market analysis
  • Dynamic Pricing Intelligence: Real-time price analysis based on user queries
  • Weekly Trend Analysis: AI-generated price trends with reasoning
  • Market Sentiment Analysis: AI insights on market conditions
  • Strategic Recommendations: Personalized advice for vendors
  • Risk Assessment: AI-identified market risks and mitigation strategies

Negotiation Assistant

  • AI-Generated Phrases: Culturally appropriate negotiation suggestions
  • Counter-offer Guidance: Gemini AI-powered negotiation strategies
  • Context-aware Responses: Situation-specific communication help
  • Multi-language Support: Negotiation phrases in all supported languages

Intelligent Dashboard

  • Real-time Market Search: Query any market for AI-generated insights
  • Interactive Commodity Analysis: Click commodities for detailed trends
  • AI Market Intelligence: Comprehensive market sentiment and predictions
  • Economic Factor Analysis: Weather, inflation, and policy impacts
  • Nearby Market Comparisons: AI-generated competitive analysis
  • Personalized Insights: Tailored recommendations based on user profile

Tech Stack

Frontend

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS with custom Indian-inspired color palette
  • Animations: Framer Motion for smooth micro-interactions
  • Icons: Lucide React
  • Charts: Recharts for data visualization

Authentication & Security

  • NextAuth.js: Secure OAuth authentication
  • Google OAuth: Social login integration
  • Session Management: Secure user sessions
  • Protected Routes: Authentication-based access control
  • Environment Security: Secure API key management

Database & Storage

  • MongoDB Atlas: Cloud database for user data
  • User Profiles: Secure storage of user information
  • Session Storage: Persistent authentication state
  • Data Validation: Server-side input validation
  • Connection Pooling: Optimized database performance

AI Integration

  • Google Gemini AI: For translation, market analysis, and content generation
  • Web Speech API: For voice recognition with AI enhancement
  • Real-time Processing: Live translation and analysis capabilities
  • Intelligent Fallbacks: Dynamic data generation when AI is unavailable
  • Market Intelligence: AI-powered comprehensive market analysis

API Architecture

  • Market Data API: /api/market-data - AI-powered market analysis
  • Live Market Data API: /api/live-market-data - SERP API integration for real-time data
  • Weather API: /api/weather - OpenWeatherMap integration for weather data and agricultural insights
  • Translation API: /api/translate - Real-time text translation
  • Price Analysis API: /api/analyze-price - AI-powered market analysis
  • Negotiation API: /api/negotiation-phrases - Generate negotiation phrases
  • User Management API: /api/users/profile - User data operations
  • Authentication API: /api/auth/* - NextAuth.js endpoints
  • Buyer-Seller API: /api/buyer-seller - Direct connections and listings management
  • Inventory API: /api/inventory - Smart inventory management with AI insights
  • Translation Chatbot: Client-side MyMemory API integration for real-time translation

Design Philosophy

Visual Identity

  • Color Palette: Saffron, earth tones, and mandi green
  • Typography: Inter for body text, Poppins for headings
  • UI Pattern: Glassmorphism cards with soft gradients
  • Animations: Subtle floating elements and smooth transitions

User Experience

  • Mobile-First: Optimized for low-end devices
  • Voice-First: Large buttons and clear audio feedback
  • Accessibility: High contrast, large fonts, screen reader friendly
  • AI-Enhanced: Smart features that learn and adapt
  • Secure by Design: Privacy-focused user experience

Pages Overview

Landing Page (/)

  • Hero section with animated grain particles
  • Feature highlights with glassmorphic cards
  • Trust indicators and social proof
  • Authentication-aware navigation

Authentication Flow

  • Sign In (/auth/signin) - Google OAuth login
  • Profile Setup (/auth/profile-setup) - User information collection
  • Protected Routes - Automatic authentication checks

AI Assistant (/demo) - AI-Powered

  • Real Voice Recognition with Gemini AI enhancement
  • Interactive Price Analysis using live AI processing
  • AI-Generated Negotiation Phrases in selected language
  • Market Insights powered by Gemini AI
  • Accessible to all users (no authentication required)

Dashboard (/dashboard) - Protected Route

  • AI Market Search: Query any market for real-time analysis
  • Interactive Market Data: AI-generated comprehensive insights
  • Dynamic Commodity Analysis: Click-to-explore detailed trends
  • Market Intelligence: AI sentiment analysis and predictions
  • Personalized Recommendations: User-specific market advice
  • Economic Analysis: Weather, policy, and economic factor impacts

Features - Protected Routes

  • Direct Buyer-Seller Connections (/features/buyer-seller)

    • Real user listings with MongoDB storage
    • Add/edit/delete product listings
    • Phone, Email, and WhatsApp contact integration
    • Advanced filtering and search capabilities
    • User verification through Google accounts
  • Smart Inventory Management (/features/inventory)

    • MongoDB-based inventory storage per user
    • AI-powered stock insights and recommendations
    • CRUD operations for inventory items
    • Low stock alerts and reorder suggestions
    • Category-based organization
  • Live Market Data (/features/live-data)

    • SERP API integration for real-time market data
    • Live commodity prices and market trends
    • Dynamic price discovery without dummy data
    • Comprehensive market intelligence
  • Weather Insights (/features/weather)

    • OpenWeatherMap API integration for real-time weather data
    • GPS location detection and manual location search
    • Agricultural insights and farming recommendations
    • 8-hour weather forecast with interactive maps
    • Weather-based market impact analysis

How It Works (/how-it-works)

  • Step-by-step process visualization
  • AI technology explanations
  • Authentication and security features
  • Feature deep-dives with animations

Impact (/impact)

  • Usage statistics and growth metrics
  • Vendor testimonials in multiple languages
  • India map with mandi coverage
  • Mission and future goals

Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • MongoDB Atlas Account (free tier available)
  • Google Cloud Console Account for OAuth
  • Gemini AI API Key (get from Google AI Studio)

Installation

  1. Clone the repository

    git clone https://github.com/Naren1520/Vanijya-Ai.git
    cd multilingual-mandi
    
  2. Install dependencies

    npm install
    
  3. Set up environment variables

    cp .env.example .env.local
    

Edit .env.local and add your configuration:

   # Gemini AI Configuration
   NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key_here

   # Google OAuth Configuration
   GOOGLE_CLIENT_ID=your_google_client_id
   GOOGLE_CLIENT_SECRET=your_google_client_secret
   NEXTAUTH_URL=http://localhost:3000
   NEXTAUTH_SECRET=your_nextauth_secret

   # MongoDB Configuration
   MONGODB_URI=your_mongodb_connection_string

   # SERP API Configuration (for live market data)
   SERP_API_KEY=your_serp_api_key_here

   # Weather API Configuration (for weather insights)
   WEATHER_API_KEY=your_openweather_api_key_here

   # Application Configuration
   NEXT_PUBLIC_APP_URL=http://localhost:3000
   NEXT_PUBLIC_APP_NAME=Vanijya AI
  1. Test database connection

    npm run test:db
    
  2. Run the development server

    npm run dev
    
  3. Open your browser Navigate to http://localhost:3000

Build for Production

npm run build
npm start

๐Ÿ”ง Setup Guides

AI Integration

For detailed AI integration setup, see GEMINI_SETUP.md

Authentication Setup

For Google OAuth setup, see GOOGLE_AUTH_SETUP.md

Database Setup

For MongoDB configuration, see MONGODB_SETUP.md

Quick Setup Summary:

  1. AI: Get API key from Google AI Studio
  2. Auth: Configure Google OAuth in Google Cloud Console
  3. Database: Set up MongoDB Atlas cluster
  4. Test: Use /test-gemini and /api-test pages for verification

Project Structure

vanijya-ai/
โ”œโ”€โ”€ .env.example               # Environment variables template
โ”œโ”€โ”€ .env.local                 # Local environment configuration
โ”œโ”€โ”€ .gitignore                 # Git ignore rules
โ”œโ”€โ”€ README.md                  # Project documentation
โ”œโ”€โ”€ package.json               # Dependencies and scripts
โ”œโ”€โ”€ package-lock.json          # Dependency lock file
โ”œโ”€โ”€ next.config.ts             # Next.js configuration
โ”œโ”€โ”€ tsconfig.json              # TypeScript configuration
โ”œโ”€โ”€ tailwind.config.ts         # Tailwind CSS configuration
โ”œโ”€โ”€ postcss.config.mjs         # PostCSS configuration
โ”œโ”€โ”€ eslint.config.mjs          # ESLint configuration
โ”œโ”€โ”€ next-env.d.ts              # Next.js TypeScript declarations
โ”œโ”€โ”€ public/                    # Static assets
โ”‚   โ”œโ”€โ”€ Assets/
โ”‚   โ”‚   โ””โ”€โ”€ logo.png           # Application logo
โ”‚   โ”œโ”€โ”€ file.svg               # File icon
โ”‚   โ”œโ”€โ”€ globe.svg              # Globe icon
โ”‚   โ”œโ”€โ”€ next.svg               # Next.js logo
โ”‚   โ”œโ”€โ”€ vercel.svg             # Vercel logo
โ”‚   โ””โ”€โ”€ window.svg             # Window icon
โ”œโ”€โ”€ scripts/                   # Utility scripts
โ”‚   โ”œโ”€โ”€ add-whatsapp-fields.js # Database migration script
โ”‚   โ””โ”€โ”€ test-db.js             # Database connection test
โ””โ”€โ”€ src/                       # Source code
    โ”œโ”€โ”€ app/                   # Next.js App Router pages
    โ”‚   โ”œโ”€โ”€ api/               # API routes
    โ”‚   โ”‚   โ”œโ”€โ”€ analyze-price/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # Price analysis endpoint
    โ”‚   โ”‚   โ”œโ”€โ”€ auth/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ [...nextauth]/
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts # NextAuth.js authentication
    โ”‚   โ”‚   โ”œโ”€โ”€ buyer-seller/
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ route.ts   # Buyer-seller listings API
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ my-listings/
    โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts # User's listings API
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ [id]/
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts # Individual listing API
    โ”‚   โ”‚   โ”œโ”€โ”€ health/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ database/
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts # Database health check
    โ”‚   โ”‚   โ”œโ”€โ”€ inventory/
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ route.ts   # Inventory management API
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ [id]/
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts # Individual inventory item API
    โ”‚   โ”‚   โ”œโ”€โ”€ live-market-data/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # SERP API integration
    โ”‚   โ”‚   โ”œโ”€โ”€ market-data/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # AI market analysis endpoint
    โ”‚   โ”‚   โ”œโ”€โ”€ negotiation-phrases/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # Negotiation phrases API
    โ”‚   โ”‚   โ”œโ”€โ”€ test-gemini/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # Gemini AI testing endpoint
    โ”‚   โ”‚   โ”œโ”€โ”€ test-weather-key/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # Weather API key testing
    โ”‚   โ”‚   โ”œโ”€โ”€ translate/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts   # Translation endpoint
    โ”‚   โ”‚   โ”œโ”€โ”€ users/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ profile/
    โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts # User profile management
    โ”‚   โ”‚   โ””โ”€โ”€ weather/
    โ”‚   โ”‚       โ””โ”€โ”€ route.ts   # Weather data and insights API
    โ”‚   โ”œโ”€โ”€ api-test/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # API testing interface
    โ”‚   โ”œโ”€โ”€ auth/              # Authentication pages
    โ”‚   โ”‚   โ”œโ”€โ”€ profile-setup/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx   # User profile setup
    โ”‚   โ”‚   โ””โ”€โ”€ signin/
    โ”‚   โ”‚       โ””โ”€โ”€ page.tsx   # Google OAuth login
    โ”‚   โ”œโ”€โ”€ dashboard/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # AI market dashboard (protected)
    โ”‚   โ”œโ”€โ”€ demo/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # AI-powered assistant (public)
    โ”‚   โ”œโ”€โ”€ features/          # Feature pages (protected)
    โ”‚   โ”‚   โ”œโ”€โ”€ buyer-seller/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx   # Direct connections interface
    โ”‚   โ”‚   โ”œโ”€โ”€ inventory/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx   # Inventory management interface
    โ”‚   โ”‚   โ”œโ”€โ”€ live-data/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx   # Live market data interface
    โ”‚   โ”‚   โ””โ”€โ”€ weather/
    โ”‚   โ”‚       โ””โ”€โ”€ page.tsx   # Weather insights interface
    โ”‚   โ”œโ”€โ”€ how-it-works/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Process explanation
    โ”‚   โ”œโ”€โ”€ impact/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Impact metrics
    โ”‚   โ”œโ”€โ”€ language-test/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Language testing page
    โ”‚   โ”œโ”€โ”€ loader/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Loading page
    โ”‚   โ”œโ”€โ”€ loader-demo/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Loading demo page
    โ”‚   โ”œโ”€โ”€ test-gemini/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # AI testing page
    โ”‚   โ”œโ”€โ”€ test-weather/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx       # Weather API testing page
    โ”‚   โ”œโ”€โ”€ favicon.ico        # Application favicon
    โ”‚   โ”œโ”€โ”€ globals.css        # Global styles
    โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout with providers
    โ”‚   โ”œโ”€โ”€ loading.tsx        # Global loading component
    โ”‚   โ””โ”€โ”€ page.tsx           # Landing page
    โ”œโ”€โ”€ components/            # Reusable components
    โ”‚   โ”œโ”€โ”€ AuthWrapper.tsx    # Authentication wrapper
    โ”‚   โ”œโ”€โ”€ LoadingWrapper.tsx # Loading state wrapper
    โ”‚   โ”œโ”€โ”€ Providers.tsx      # Context providers
    โ”‚   โ””โ”€โ”€ ui/                # UI components
    โ”‚       โ”œโ”€โ”€ CommodityComparison.tsx # Market comparison component
    โ”‚       โ”œโ”€โ”€ Footer.tsx     # Footer component
    โ”‚       โ”œโ”€โ”€ GlassCard.tsx  # Glassmorphic card component
    โ”‚       โ”œโ”€โ”€ Loader.tsx     # Loading animation component
    โ”‚       โ”œโ”€โ”€ LoaderDemo.tsx # Loading demo component
    โ”‚       โ”œโ”€โ”€ MarketSuggestions.tsx # Market search suggestions
    โ”‚       โ”œโ”€โ”€ Navbar.tsx     # Navigation with authentication
    โ”‚       โ”œโ”€โ”€ SimpleLoader.tsx # Simple loading component
    โ”‚       โ””โ”€โ”€ VoiceButton.tsx # AI-enhanced voice input
    โ”œโ”€โ”€ contexts/              # React contexts
    โ”‚   โ”œโ”€โ”€ AuthContext.tsx    # Authentication state management
    โ”‚   โ””โ”€โ”€ LanguageContext.tsx # Multilingual state management
    โ”œโ”€โ”€ lib/                   # Utility libraries
    โ”‚   โ”œโ”€โ”€ auth.ts            # NextAuth configuration
    โ”‚   โ”œโ”€โ”€ gemini.ts          # Gemini AI integration
    โ”‚   โ”œโ”€โ”€ mockData.ts        # Mock data for development
    โ”‚   โ”œโ”€โ”€ mongodb.ts         # Database connection utility
    โ”‚   โ”œโ”€โ”€ speechRecognition.ts # Enhanced speech recognition
    โ”‚   โ”œโ”€โ”€ translations.json  # Translation data
    โ”‚   โ”œโ”€โ”€ types.ts           # TypeScript type definitions
    โ”‚   โ”œโ”€โ”€ models/            # Database models
    โ”‚   โ”‚   โ”œโ”€โ”€ BuyerSeller.ts # Buyer-seller listings model
    โ”‚   โ”‚   โ”œโ”€โ”€ Inventory.ts   # Inventory management model
    โ”‚   โ”‚   โ””โ”€โ”€ User.ts        # User data model
    โ”‚   โ””โ”€โ”€ services/          # Database services
    โ”‚       โ””โ”€โ”€ userService.ts # User data operations
    โ””โ”€โ”€ types/                 # TypeScript declarations
        โ”œโ”€โ”€ global.d.ts        # Global type declarations
        โ””โ”€โ”€ next-auth.d.ts     # NextAuth type extensions

AI Features in Detail

Smart Market Analysis

  • Dynamic Data Generation: AI creates market-specific insights
  • Comprehensive Analysis: Market sentiment, trends, and predictions
  • Economic Intelligence: Weather, inflation, and policy impacts
  • Strategic Recommendations: Personalized vendor advice
  • Risk Assessment: AI-identified risks with mitigation strategies

Intelligent Translation

  • Context Preservation: Maintains agricultural and market terminology
  • Cultural Adaptation: Respects local customs and phrases
  • Real-time Processing: Instant translation across 6 languages
  • Fallback System: Static translations when AI is unavailable

Voice Recognition Enhancement

  • Multi-language Support: Recognizes speech in all supported languages
  • AI Post-processing: Enhanced accuracy for agricultural terms
  • Noise Filtering: Improved recognition in noisy environments
  • Context Understanding: Better interpretation of market-specific vocabulary

Authentication & Security

Authentication Flow

  1. Landing Page โ†’ Sign In button for unauthenticated users
  2. Google OAuth โ†’ Secure authentication via Google
  3. Profile Setup โ†’ Collect user information (name, phone, address)
  4. Dashboard Access โ†’ Full platform features available
  5. Session Management โ†’ Persistent login across sessions

Security Features

  • OAuth 2.0: Industry-standard authentication
  • Secure Sessions: NextAuth.js session management
  • Protected Routes: Authentication-based access control
  • Data Encryption: Secure storage of user information
  • Environment Security: API keys and secrets protection

User Data Management

  • Profile Storage: MongoDB Atlas cloud storage
  • Data Validation: Server-side input validation
  • Privacy Protection: Secure handling of personal information
  • GDPR Compliance: User data rights and protection

Database Architecture

User Collection Schema

{
  _id: ObjectId,
  id: string,           // Custom ID
  email: string,        // Google account email
  name: string,         // User's full name
  phone: string,        // Phone number
  address: string,      // Complete address
  googleId: string,     // Google OAuth ID
  avatar?: string,      // Profile picture URL
  createdAt: Date,      // Account creation date
  updatedAt: Date       // Last update date
}

Buyer-Seller Listings Collection Schema

{
  _id: ObjectId,
  userId: string,           // User's email (authentication link)
  userEmail: string,        // User's Google account email
  userName: string,         // User's display name
  userPhone?: string,       // User's phone number
  userWhatsApp?: string,    // User's WhatsApp number
  type: 'buyer' | 'seller', // Listing type
  productName: string,      // Product being bought/sold
  category: string,         // Product category
  quantity: number,         // Quantity needed/available
  unit: string,            // Unit of measurement
  pricePerUnit?: number,   // Price per unit (optional)
  location: string,        // Location for transaction
  description: string,     // Detailed description
  contactEmail?: string,   // Alternative contact email
  contactPhone?: string,   // Alternative contact phone
  contactWhatsApp?: string, // Alternative WhatsApp number
  isActive: boolean,       // Listing status
  createdAt: Date,         // Creation timestamp
  updatedAt: Date          // Last update timestamp
}

Inventory Collection Schema

{
  _id: ObjectId,
  userId: string,          // User's email (authentication link)
  itemName: string,        // Inventory item name
  category: string,        // Item category
  quantity: number,        // Current stock quantity
  unit: string,           // Unit of measurement
  costPrice?: number,     // Cost price per unit
  sellingPrice?: number,  // Selling price per unit
  supplier?: string,      // Supplier information
  location: string,       // Storage location
  description?: string,   // Item description
  lowStockThreshold: number, // Alert threshold
  expiryDate?: Date,      // Expiry date (if applicable)
  createdAt: Date,        // Creation timestamp
  updatedAt: Date         // Last update timestamp
}

Database Features

  • MongoDB Atlas: Cloud-hosted database
  • Multiple Collections: Users, BuyerSeller listings, Inventory items
  • Connection Pooling: Optimized performance
  • Data Validation: Schema enforcement with Mongoose
  • Backup & Recovery: Automated cloud backups
  • Scalability: Auto-scaling based on usage
  • User Isolation: Secure data separation per authenticated user

Multilingual Support

The platform supports comprehensive multilingual functionality with both UI translations and real-time text translation:

UI Language Support (6 Languages)

Language Native Script Code UI Translation Features Dropdown All Pages
English English en โœ… Complete โœ… Translated โœ… All Pages
Hindi เคนเคฟเค‚เคฆเฅ€ hi โœ… Complete โœ… Translated โœ… All Pages
Tamil เฎคเฎฎเฎฟเฎดเฏ ta โœ… Complete โœ… Translated โœ… All Pages
Telugu เฐคเฑ†เฐฒเฑเฐ—เฑ te โœ… Complete โœ… Translated โœ… All Pages
Kannada เฒ•เฒจเณเฒจเฒก kn โœ… Complete โœ… Translated โœ… All Pages
Marathi เคฎเคฐเคพเค เฅ€ mr โœ… Complete โœ… Translated โœ… All Pages

Translation Chatbot Support (20+ Languages)

Indian Languages: Hindi, Tamil, Telugu, Kannada, Marathi, Bengali, Gujarati, Punjabi, Urdu
International Languages: English, Spanish, French, German, Italian, Portuguese, Russian, Japanese, Korean, Chinese, Arabic

Translation Features

  • Persistent Language Selection: User's language choice saved in localStorage
  • Complete UI Translation: All pages, navigation, features, and content
  • Real-time Translation Chatbot: Floating widget accessible from any page
  • Free Translation Service: MyMemory API with unlimited usage
  • Advanced Features: Text-to-speech, copy to clipboard, language swapping
  • Cultural Context: Translations preserve agricultural and market terminology

Security & Performance

Security

  • OAuth 2.0 Authentication: Secure Google login
  • Environment Variable Protection: API keys and secrets security
  • Rate Limiting: AI API call protection
  • Input Validation: Server-side data sanitization
  • Session Security: Secure cookie management
  • Database Security: MongoDB Atlas encryption

Performance

  • Connection Pooling: Optimized database connections
  • AI Request Caching: Efficient API usage
  • Progressive Loading: Optimized user experience
  • Bundle Optimization: Minimized JavaScript payload
  • CDN Integration: Fast asset delivery

Color Palette

/* Saffron Shades */
--saffron-500: #f97316;
--saffron-600: #ea580c;

/* Earth Tones */
--earth-500: #b8915a;
--earth-800: #70533a;

/* Mandi Colors */
--mandi-green: #22c55e;
--mandi-brown: #8b5a3c;
--mandi-cream: #fef7ed;

Current Features (Production Ready)

Features โœ…

  • [x] Google OAuth Authentication with NextAuth.js
  • [x] MongoDB Integration for user data storage
  • [x] Real AI Integration (Gemini AI)
  • [x] Live Speech Recognition with AI enhancement
  • [x] Real-time Translation capabilities
  • [x] AI Market Analysis with comprehensive insights
  • [x] Interactive Dashboard with market search
  • [x] User Profile Management with secure storage
  • [x] Protected Routes and session management
  • [x] Direct Buyer-Seller Connections with real MongoDB storage
  • [x] Smart Inventory Management with AI insights
  • [x] Live Market Data Integration with SERP API
  • [x] Weather Insights with OpenWeatherMap API integration
  • [x] GPS Location Detection and manual location search
  • [x] Agricultural Weather Insights with AI-powered recommendations
  • [x] Interactive Weather Maps with location visualization
  • [x] WhatsApp Integration with pre-filled messages
  • [x] Contact Management (Phone, Email, WhatsApp)
  • [x] Advanced Filtering and search capabilities
  • [x] User Verification through authenticated accounts
  • [x] Multilingual Support across all pages
  • [x] Responsive Design for all devices
  • [x] Production Deployment ready

Future Enhancements

  • [ ] Push notifications for price alerts
  • [ ] Advanced AI models for better accuracy
  • [ ] Payment integration for transactions
  • [ ] Quality assessment using computer vision
  • [ ] Logistics coordination with AI optimization

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Google Gemini AI for powerful language processing capabilities
  • MongoDB Atlas for reliable cloud database services
  • NextAuth.js for secure authentication solutions
  • Inspired by the hardworking vendors in India's mandis
  • Built with love for inclusive technology
  • Designed to bridge language barriers and promote fair trade

Developer


Share this project:

Updates