Skip to content

aditiraj2006/KrishiSetu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

248 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 KrishiSetu – Transparent Agricultural Supply Chain Platform

License Status PRs Welcome Node Version

Empowering farmers and consumers through transparent, decentralized agricultural supply chain management.

🌐 Live Demo β€’ πŸ“– GitHub Repo β€’ 🀝 Contribute β€’ πŸ› Report Issue β€’ πŸ’¬ Discussions


πŸ“Œ About

KrishiSetu is an open-source platform that revolutionizes agricultural supply chains by enabling direct connections between farmers, distributors, retailers, and consumers. With real-time tracking, QR code verification, and transparent pricing, KrishiSetu eliminates middlemen exploitation while ensuring product authenticity and fair compensation for farmers.

Built with modern web technologies and designed with beginner-friendly contributions in mind, KrishiSetu is an ideal platform for developers to learn, collaborate, and make a real-world impact! 🌟

πŸš€ Visit Live Demo | ⭐ Star on GitHub


✨ Features

  • πŸ” Role-Based Access Control β€” Separate dashboards for farmers, distributors, retailers, and admins
  • πŸ“¦ Smart Product Registration β€” Easy onboarding with automatic validation and categorization
  • πŸ“± QR Code System β€” Generate, scan, and verify products instantly for authenticity
  • 🌍 Real-Time Translation β€” Translate product details into 8+ Indian languages using AI
  • πŸ“Š Supply Chain Visualization β€” Interactive map showing product journey from farm to consumer
  • πŸ’³ Payment Proof Management β€” Transparent transaction documentation and verification
  • πŸ‘€ Complete User Profiles β€” Verified credentials and role-specific information
  • πŸ“ˆ Dashboard Analytics β€” Real-time statistics on product distribution and supply chain health
  • πŸ”„ Ownership History β€” Complete audit trail of all product transfers and ownership changes
  • πŸ“‹ Order Management β€” Streamlined ordering and fulfillment between supply chain partners
  • πŸ›‘οΈ Secure Authentication β€” Firebase Auth with Google OAuth integration
  • πŸ”’ Privacy-First Design β€” User data encryption and privacy controls

Coming Soon πŸš€

  • πŸ€– AI-powered product recommendations
  • πŸ“² Native mobile apps (iOS & Android)
  • ⛓️ Full blockchain integration for immutable records
  • πŸ“Š Advanced analytics and reporting dashboard
  • 🌐 Multi-language support expansion

🌐 Live Demo

πŸ‘‰ Visit KrishiSetu Live

Want to see it in action? Click the link above to explore the platform!


πŸ›  Tech Stack

Frontend

Technology Version Purpose
React 18.3+ UI library with hooks
TypeScript 5.6+ Type-safe development
Vite 6.1+ Lightning-fast build tool
Tailwind CSS 3.4+ Utility-first styling
shadcn/ui Latest Accessible React components
React Router 7.9+ Client-side routing
TanStack Query 5.60+ Server state management
React Hook Form 7.55+ Form handling & validation
Zod 3.24+ TypeScript-first validation
Firebase SDK 12.2+ Authentication & services

Backend & Infrastructure

Technology Version Purpose
Node.js 18+ JavaScript runtime
Express.js 4.21+ Web server framework
TypeScript 5.6+ Type-safe backend code
MongoDB 6.19+ NoSQL database
Firebase 12.2+ Auth, database, storage
Render - Cloud deployment platform

AI & Services

  • Google Gemini AI β€” Language translation
  • Firebase Authentication β€” Secure user management
  • Firestore β€” Real-time database

πŸ“ Project Structure

Below is the folder and file structure of the KrishiSetu project πŸ‘‡

KrishiSetu/
β”‚
β”œβ”€β”€ .github/
β”‚   └── ISSUE_TEMPLATE/                # GitHub issue templates for contributors
β”‚
β”œβ”€β”€ client/                            # React Frontend Application
β”‚   β”œβ”€β”€ public/                        # Static assets
β”‚   β”‚
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/                # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/                    # shadcn/ui base components
β”‚   β”‚   β”‚   β”œβ”€β”€ DistributorProductForm.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductRegistrationForm.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductSearch.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ QRCodeGenerator.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ QRCodeScanner.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SupplyChainMap.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RoleDashboard.tsx
β”‚   β”‚   β”‚   └── PaymentProofModal.tsx
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/                         # Full-page components (routes)
β”‚   β”‚   β”œβ”€β”€ LandingPage.tsx
β”‚   β”‚   β”œβ”€β”€ dashboard.tsx
β”‚   β”‚   β”œβ”€β”€ product-registration.tsx
β”‚   β”‚   β”œβ”€β”€ registered-products.tsx
β”‚   β”‚   β”œβ”€β”€ qr-scanner.tsx
β”‚   β”‚   β”œβ”€β”€ login.tsx
β”‚   β”‚   β”œβ”€β”€ profile.tsx
β”‚   β”‚   └── not-found.tsx
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                         # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useAuth.ts                 # Authentication logic
β”‚   β”‚   β”œβ”€β”€ useProducts.ts             # Product data management
β”‚   β”‚   └── use-toast.ts               # Toast notifications
β”‚   β”‚
β”‚   β”œβ”€β”€ lib/                           # Utilities & configuration
β”‚   β”‚   β”œβ”€β”€ firebase.ts                # Firebase setup
β”‚   β”‚   β”œβ”€β”€ queryClient.ts             # TanStack Query config
β”‚   β”‚   └── utils.ts                   # Helper functions
β”‚   β”‚
β”‚   β”œβ”€β”€ App.tsx                        # Root component
β”‚   β”œβ”€β”€ main.tsx                       # Entry point
β”‚   └── index.css                      # Global styles
β”‚
β”œβ”€β”€ server/                            # Express Backend Server
β”‚   β”œβ”€β”€ index.ts                       # Server entry point
β”‚   β”œβ”€β”€ routes.ts                      # API route definitions
β”‚   β”œβ”€β”€ storage.ts                     # Database operations
β”‚   └── vite.ts                        # Vite integration
β”‚
β”œβ”€β”€ shared/                            # Shared Code & Types
β”‚   └── schema.ts                      # TypeScript interfaces & Zod schemas
β”‚
β”œβ”€β”€ uploads/                           # File Storage
β”‚   └── payment-proofs/                # Payment documentation
β”‚
β”œβ”€β”€ .env.example                       # Example environment variables
β”œβ”€β”€ .gitignore                         # Git ignore configuration
β”œβ”€β”€ CODE_OF_CONDUCT.md                 # Community guidelines
β”œβ”€β”€ CONTRIBUTING.md                    # Contribution guidelines
β”œβ”€β”€ LICENSE.md                         # MIT License
β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md           # PR format template
β”œβ”€β”€ README.md                          # This file πŸ˜„
β”‚
β”œβ”€β”€ package.json                       # Dependencies & scripts
β”œβ”€β”€ package-lock.json                  # Lock file
β”œβ”€β”€ tsconfig.json                      # TypeScript config
β”œβ”€β”€ vite.config.ts                     # Vite configuration
β”œβ”€β”€ tailwind.config.ts                 # Tailwind CSS config
β”œβ”€β”€ postcss.config.js                  # PostCSS setup
└── eslint.config.js                   # ESLint configuration

βš™οΈ Installation & Setup

Clone the Repository

git clone https://github.com/aditiraj2006/KrishiSetu.git
cd KrishiSetu

Install Dependencies

npm install

Configure Environment Variables

  1. Create a .env file in the root directory.
  2. Copy values from .env.example:
    cp .env.example .env
  3. Fill in your API keys and configuration strings in .env.

⚠️ IMPORTANT: Never commit your .env file. It contains sensitive credentials!

Detailed Environment Variables Reference

Below is a detailed breakdown of all environment variables supported by KrishiSetu, including their purpose, whether they are required, how to obtain them, and the application behavior when they are missing.

Variable Required Description Where to Get / Default Value Behavior If Absent
VITE_FIREBASE_API_KEY Yes Firebase project Web API Key. Used by frontend SDK to access Auth and Storage APIs. Firebase Console β†’ Project Settings β†’ Web App Config. User registration and logins will fail with configuration errors.
VITE_FIREBASE_AUTH_DOMAIN Yes Firebase Auth domain for login redirects. Firebase Console β†’ Project Settings β†’ Web App Config. User logins and authentication redirect flows will not initialize.
VITE_FIREBASE_PROJECT_ID Yes Firebase Project ID. Used by both client and backend for token verification. Firebase Console β†’ Project Settings. Server-side validation of authenticated sessions will fail.
VITE_FIREBASE_STORAGE_BUCKET Yes Firebase Cloud Storage bucket URL for uploading files. Firebase Console β†’ Project Settings β†’ Storage. Product payment proofs fallback to local server directory /uploads/payment-proofs/.
VITE_FIREBASE_MESSAGING_SENDER_ID No Firebase Messaging Sender ID for push notifications. Firebase Console β†’ Project Settings. Push notification subscription features will fail or remain inactive.
VITE_FIREBASE_APP_ID Yes Unique identifier for your Firebase Web App. Firebase Console β†’ Project Settings β†’ Web App Config. Client-side Firebase SDK fails to initialize.
FIREBASE_PROJECT_ID No Backup/legacy Project ID configuration for production deployment environments. Same as VITE_FIREBASE_PROJECT_ID. Standard server builds or deployments (e.g. on Render) might lack metadata.
MONGODB_URI Yes MongoDB connection string. Supports Atlas cluster connection or local instances. MongoDB Atlas dashboard or local: mongodb://localhost:27017/krishisetu The backend Express server will throw a connection error and crash immediately.
MONGO_DB_NAME No Target MongoDB database name. Choose any string. Defaults to "krishisetu". Application database defaults to the name "krishisetu".
GOOGLE_GEMINI_API_KEY No API Key for Google Gemini AI features (translation, quality analysis). Google AI Studio (Makersuite) AI translation/grammar check falls back to original text; AI quality analysis returns a neutral default score (5/10).

Start Development Servers

npm run dev

Open http://localhost:5001 in your browser!


Firebase Setup (Required for OAuth Login)

Step Action Where
1 Firebase Console kholΠΎ console.firebase.google.com
2 Authentication β†’ Settings β†’ Authorized Domains Firebase Console
3 Add Domain: your-app.onrender.com Authorized Domains list
4 Save karo aur OAuth login test karo Production URL par

πŸ’‘ localhost development mein automatically authorized hota hai, but production domain manually add karna padta hai.

Common Errors & Fixes

Error Cause Fix
auth/unauthorized-domain Domain Firebase mein add nahi Upar wala Step 3 follow karo
OAuth popup band ho jaye Same as above Same fix
Login locally kaam kare, production par na kare Same as above Same fix

▢️ Usage

  1. Sign Up / Log In β€” Create your account using Firebase authentication
  2. Select Your Role β€” Choose farmer, distributor, retailer, or admin
  3. Share Products β€” Register agricultural products with details and media
  4. Scan QR Codes β€” Verify product authenticity using QR code scanner
  5. Track Supply Chain β€” Monitor product journey from farm to consumer
  6. Translate Content β€” Automatically translate product info to regional languages
  7. Access Resources β€” Browse verified NGO and support organization database
  8. Manage Orders β€” Streamline ordering and fulfillment with supply chain partners

🀝 Contributing

We welcome contributions from everyone! Whether you're fixing bugs, adding features, or improving documentation, your help makes KrishiSetu better. πŸ’–

Contribution Process

  1. Fork the Repository β€” Click the Fork button on GitHub

  2. Clone Your Fork

    git clone https://github.com/YOUR_USERNAME/KrishiSetu.git
    cd KrishiSetu
    git remote add upstream https://github.com/aditiraj2006/KrishiSetu
  3. Create a Feature Branch

    git checkout -b feature/your-feature-name
  4. Make Your Changes β€” Write clean, well-documented code

  5. Commit with Clear Messages

    git commit -m "[feat] Add new QR code feature"
    git commit -m "[fix] Resolve product search bug"
    git commit -m "[docs] Update setup instructions"
  6. Push to Your Fork

    git push origin feature/your-feature-name
  7. Create a Pull Request β€” Include a detailed description and reference any related issues

Code Standards

βœ… Do's

  • Follow TypeScript best practices
  • Write meaningful variable names (avoid x, temp, etc.)
  • Add comments for complex logic blocks
  • Keep functions small and single-purpose
  • Test your changes thoroughly
  • Format code with Prettier
  • Update documentation when needed

❌ Don'ts

  • Don't add multiple unrelated changes in one PR
  • Don't copy code without understanding it
  • Don't ignore code review feedback
  • Don't leave console.log() statements in production code
  • Don't make unnecessary style changes
  • Don't commit .env files

Branch Naming Convention

feature/add-new-feature        # New feature
bugfix/fix-critical-bug        # Bug fix
docs/update-readme             # Documentation
refactor/optimize-queries      # Code refactoring
test/add-unit-tests           # Tests

Pull Request Checklist

Before submitting your PR, ensure:

  • PR title follows format: [type] description (e.g., [feat] Add QR scanner)
  • Code follows our style guidelines
  • Self-review completed
  • Comments added for complex areas
  • No new console warnings introduced
  • Tests added/updated (if applicable)
  • Documentation updated
  • Related issues linked (use Fixes #123)
  • .env file is NOT included
  • Firebase Authorized Domains updated for production deployment (if auth changes made)

🎯 Good First Issues & Labels

Understanding Issue Labels

Label Color Description Best For
🟒 good first issue #90EE90 Perfect for newcomers First-time contributors
πŸ†˜ help wanted #FFD700 Extra hands needed Anyone wanting to help
πŸ› bug #FF6B6B Something broken Bug fixes
✨ enhancement #87CEEB New feature Feature implementation
πŸ“š documentation #DDA0DD Docs improvement Writers
πŸ”§ refactor #F0E68C Code cleanup Optimization
🎨 ui-ux #FFA07A Design/UX Frontend developers
πŸš€ performance #20B2AA Speed improvement Performance optimization

How to Find Issues

  1. Visit the Issues Page
  2. Filter by good first issue label
  3. Read the description carefully
  4. Comment: "I'd like to work on this!"
  5. Wait for maintainer approval
  6. Start coding!

πŸ“ Contribution Workflow (Step-by-Step)

Step 1️⃣ Fork & Setup

# Fork on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/KrishiSetu.git
cd KrishiSetu

# Add upstream remote to stay synchronized
git remote add upstream https://github.com/aditiraj2006/KrishiSetu.git
git remote -v  # Verify both remotes exist

Step 2️⃣ Create Feature Branch

# Update from upstream
git fetch upstream
git checkout main
git merge upstream/main

# Create your feature branch
git checkout -b feature/amazing-feature

Step 3️⃣ Implement Changes

# Edit files, add features, fix bugs
# Keep commits focused and atomic
git add .
git commit -m "[feat] Add amazing feature description"

Step 4️⃣ Test Your Code

# Run both development servers
npm run dev                    # Backend
cd client && npm run dev       # Frontend (in another terminal)

# Test thoroughly:
# - Manual testing of your feature
# - Check for console errors
# - Test in different browsers
# - Verify responsive design

Step 5️⃣ Push to Your Fork

git push origin feature/amazing-feature

Step 6️⃣ Create Pull Request

  1. Go to your forked repository on GitHub
  2. Click "Compare & pull request"
  3. Fill in the PR template with:
    • Clear description of changes
    • Why these changes are needed
    • How to test the changes
    • Screenshots (if UI changes)
    • Related issues (use Fixes #123)

Step 7️⃣ Respond to Feedback

# Make requested changes
git add .
git commit -m "[fix] Address PR review feedback"
git push origin feature/amazing-feature
# Your PR updates automatically

Step 8️⃣ Celebrate! πŸŽ‰

Your PR gets merged and you're now officially a KrishiSetu contributor!


🌟 Why Contribute?

Contributing to KrishiSetu offers numerous benefits:

✨ Improve Your Skills β€” Work with modern technologies and best practices 🀝 Collaborative Community β€” Learn from experienced developers πŸ† Get Recognized β€” Earn recognition and build your portfolio πŸ“œ Real-World Experience β€” Contribute to a project with real-world impact 🌍 Social Impact β€” Help empower farmers and ensure transparent agriculture


βœ… Contribution Best Practices

βœ… Do's

βœ… Read documentation thoroughly before contributing βœ… Follow code style and project structure βœ… Write descriptive commit messages βœ… Test your changes before submitting PR βœ… Be respectful and collaborative with other contributors βœ… Ask questions if you're unsure about anything βœ… Update documentation when adding features βœ… Give constructive feedback to other contributors

❌ Don'ts

❌ Don't spam with multiple PRs for the same issue ❌ Don't copy code without understanding it ❌ Don't make unnecessary changes ❌ Don't ignore code review feedback ❌ Don't forget to update documentation ❌ Don't commit sensitive files (.env, keys, etc.) ❌ Don't make commits with inappropriate messages ❌ Don't claim issues without intent to complete them


πŸ‘₯ Code of Conduct

We are committed to providing a welcoming and inclusive environment for all contributors.

Our Standards

  • Be respectful and kind to all community members
  • Welcome and support newcomers in the community
  • Provide constructive feedback
  • Accept criticism gracefully
  • Focus on what's best for the community

Unacceptable Behavior

  • Harassment, discrimination, or abusive language
  • Offensive comments or personal attacks
  • Publishing private information without consent
  • Trolling or disruptive behavior
  • Any form of "ism" (sexism, racism, etc.)

Reporting Violations

If you witness or experience violations of our Code of Conduct, please report to the maintainers confidentially at:

πŸ“§ Email: [aditiraj0205@gmail.com] πŸ“Š GitHub: Create an issue with [Code of Conduct] tag


πŸ“§ Contact & Mentorship

For queries, feedback, or guidance regarding this project:

Name Role Contact
Mentor 1 Project Lead LinkedIn | Email
Mentor 2 Tech Lead LinkedIn | Email

Ways to Connect

πŸ’¬ GitHub Discussions β€” Ask questions and share ideas πŸ“§ Email Mentors β€” For direct assistance (mentioned above) πŸ› GitHub Issues β€” Report bugs or suggest features πŸ’₯ PR Comments β€” Tag maintainers for specific feedback


✨ Contributors

We're grateful to all our wonderful contributors! πŸ’–

Be the first to contribute! πŸš€


πŸ“„ License

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

MIT License Summary:

  • βœ… You can use this code commercially
  • βœ… You can modify and distribute the code
  • βœ… You can use this code privately
  • ❌ You cannot hold the creators liable
  • ℹ️ You must include the original license and copyright notice

πŸ™ Support & Feedback

If you like this project, please consider:

  • ⭐ Starring the repository (helps with discoverability)
  • πŸ”— Sharing with friends and colleagues
  • πŸ’¬ Giving feedback to help us improve
  • 🀝 Contributing your skills and time
  • πŸ“’ Spreading the word about transparent agriculture

🌾 Made with ❀️ for Agriculture & Sustainability

Every contribution brings us closer to empowering farmers and ensuring food transparency!

⬆ Back to Top

About

KrishiSetu, an Farm-to-consumer traceability platform built with React, TypeScript, MongoDB, and Firebase featuring QR tracking, multilingual support, and secure supply chain management.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages