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:cp .env.example .env
- Fill in your API keys and configuration strings in
.env.
β οΈ 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!