Empowering farmers and consumers through transparent, decentralized agricultural supply chain management.
🌐 Live Demo • 📖 GitHub Repo • 🤝 Contribute • 🐛 Report Issue • 💬 Discussions
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
- 🔐 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
- 🤖 AI-powered product recommendations
- 📲 Native mobile apps (iOS & Android)
- ⛓️ Full blockchain integration for immutable records
- 📊 Advanced analytics and reporting dashboard
- 🌐 Multi-language support expansion
Want to see it in action? Click the link above to explore the platform!
| 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 |
| 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 |
- Google Gemini AI — Language translation
- Firebase Authentication — Secure user management
- Firestore — Real-time database
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
git clone https://github.com/aditiraj2006/KrishiSetu.git
cd KrishiSetunpm install- Create a
.envfile in the root directory - Copy values from
.env.example - Add your Firebase, MongoDB, Gemini, and Email credentials:
# Firebase Configuration
VITE_FIREBASE_API_KEY=your_api_key_here
VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain_here
VITE_FIREBASE_PROJECT_ID=your_project_id_here
VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket_here
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id_here
VITE_FIREBASE_APP_ID=your_app_id_here
FIREBASE_PROJECT_ID=your_project_id_here
# MongoDB Connection
MONGODB_URI=your_mongodb_connection_string_here
MONGO_DB_NAME=mongo_db_name
# Gemini Api key
GOOGLE_GEMINI_API_KEY=your_gemini_api_key_here
# Nodemailer / SMTP Email Alerts Configuration
EMAIL_SERVICE=gmail
EMAIL_USER=your-email-address@gmail.com
EMAIL_PASS=your-16-character-app-passwordTo get a valid EMAIL_PASS App Password for Google:
- Go to your Google Account Security Settings.
- Under the "How you sign in to Google" section, ensure 2-Step Verification is turned ON.
- Search for "App passwords" in the top settings search bar, or navigate directly to App Passwords.
- Enter a name for the app (e.g.,
"KrishiSetu Alert"). - Click Create. Copy the generated 16-character passcode (shown in a yellow box) and paste it into the
EMAIL_PASSfield of your.envfile without spaces.
⚠️ IMPORTANT: Never commit your.envfile. It contains sensitive credentials!
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). |
npm run devOpen http://localhost:5001 in your browser!
| 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 |
💡
localhostdevelopment mein automatically authorized hota hai, but production domain manually add karna padta hai.
| 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 |
- Sign Up / Log In — Create your account using Firebase authentication
- Select Your Role — Choose farmer, distributor, retailer, or admin
- Share Products — Register agricultural products with details and media
- Scan QR Codes — Verify product authenticity using QR code scanner
- Track Supply Chain — Monitor product journey from farm to consumer
- Translate Content — Automatically translate product info to regional languages
- Access Resources — Browse verified NGO and support organization database
- Manage Orders — Streamline ordering and fulfillment with supply chain partners
We welcome contributions from everyone! Whether you're fixing bugs, adding features, or improving documentation, your help makes KrishiSetu better. 💖
-
Fork the Repository — Click the Fork button on GitHub
-
Clone Your Fork
git clone https://github.com/YOUR_USERNAME/KrishiSetu.git cd KrishiSetu git remote add upstream https://github.com/aditiraj2006/KrishiSetu -
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Make Your Changes — Write clean, well-documented code
-
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"
-
Push to Your Fork
git push origin feature/your-feature-name
-
Create a Pull Request — Include a detailed description and reference any related issues
✅ 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
.envfiles
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
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) -
.envfile is NOT included - Firebase Authorized Domains updated for production deployment (if auth changes made)
| 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 |
- Visit the Issues Page
- Filter by
good first issuelabel - Read the description carefully
- Comment: "I'd like to work on this!"
- Wait for maintainer approval
- Start coding!
# 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# Update from upstream
git fetch upstream
git checkout main
git merge upstream/main
# Create your feature branch
git checkout -b feature/amazing-feature# Edit files, add features, fix bugs
# Keep commits focused and atomic
git add .
git commit -m "[feat] Add amazing feature description"# 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 designgit push origin feature/amazing-feature- Go to your forked repository on GitHub
- Click "Compare & pull request"
- 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)
# Make requested changes
git add .
git commit -m "[fix] Address PR review feedback"
git push origin feature/amazing-feature
# Your PR updates automaticallyYour PR gets merged and you're now officially a KrishiSetu contributor!
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
✅ 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'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
We are committed to providing a welcoming and inclusive environment for all contributors.
- 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
- 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.)
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
For queries, feedback, or guidance regarding this project:
| Name | Role | Contact |
|---|---|---|
| Mentor 1 | Project Lead | LinkedIn | Email |
| Mentor 2 | Tech Lead | LinkedIn | Email |
💬 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
We're grateful to all our wonderful contributors! 💖
Be the first to contribute! 🚀
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
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
Every contribution brings us closer to empowering farmers and ensuring food transparency!