KhetBuddy is a Smart Agriculture Backend Platform built using Spring Boot that helps farmers make intelligent farming decisions using Machine Learning, Weather APIs, and Smart Automation.
The platform provides:
- Crop Yield Prediction
- Fertilizer Recommendation
- Smart Irrigation Planning
- Real-time Weather Forecasting
- WhatsApp Notifications
- Farmer & Farm Management
- JWT Authentication & Security
https://khetbuddy-backend.onrender.com
https://khetbuddy-backend.onrender.com/swagger-ui/index.html#
- Production-ready Spring Boot backend
- JWT Authentication & Authorization
- PostgreSQL + Supabase Integration
- External ML Service Integration
- WhatsApp Notification System
- Swagger OpenAPI Documentation
- Cloud-based Deployment on Render
- Real-time Weather API Integration
- Layered Backend Architecture
- RESTful API Design
KhetBuddy helps farmers make data-driven agricultural decisions using:
- Weather-aware irrigation planning
- AI-powered yield prediction
- Smart fertilizer recommendations
- WhatsApp farming alerts
The platform reduces manual farming guesswork and improves agricultural productivity through automation and intelligent recommendations.
The backend follows layered architecture using:
Controllers → Services → Repositories → PostgreSQL Database
Integrated with:
- Machine Learning APIs
- Weather APIs
- Cloudinary Image Upload
- WhatsApp Notification APIs
Database powered by:
- Supabase PostgreSQL
- Spring Data JPA
- Hibernate ORM
Features:
- Irrigation Alerts
- Weather Warnings
- Yield Prediction Updates
- Fertilizer Recommendations
- JWT Authentication
- Access & Refresh Token System
- Spring Security Integration
- Password Change Support
- Protected REST APIs
- Create Farmer Profile
- Update Farmer Details
- Upload Profile Picture
- Fetch Farmer Information
- Add Farms
- Delete Farms
- Fetch User Farms
- Farm Ownership Management
- ML-powered Crop Yield Prediction
- Weather-aware Prediction Logic
- Prediction History Tracking
- Farm-based Prediction System
- Intelligent Fertilizer Recommendation
- Soil & Crop-based Prediction
- ML-powered Recommendation System
- Smart Irrigation Scheduling
- Immediate Irrigation Advice
- Weather-aware Irrigation Logic
- Automated Planning System
- Real-time Weather Forecasting
- Latitude & Longitude based Weather Data
- Weather Processing Engine
- Java 17
- Spring Boot
- Spring Security
- Spring Data JPA
- Hibernate ORM
- Maven
- Supabase PostgreSQL
- Swagger OpenAPI 3
- Weather API
- Cloudinary Image Upload
- WhatsApp Cloud API
- External Machine Learning APIs
src
└── main
├── java/com/tarsem/khetBuddy_backend
│
├── client
│ └── # External communication clients
│
├── config
│ └── # Application configuration classes
│
├── controller
│ └── # REST API Controllers
│
├── dto
│ └── # Request & Response DTOs
│
├── entity
│ └── # JPA Entity classes
│
├── enums
│ └── # Enum classes
│
├── exception
│ └── # Global exception handling
│
├── external
│ └── # External API integrations
│
├── mapper
│ └── # DTO ↔ Entity mapping
│
├── repo
│ └── # Spring Data JPA repositories
│
├── security
│ └── # JWT & Spring Security configuration
│
├── service
│ └── # Business logic implementation
│
├── Utils
│ └── # Utility/helper classes
│
└── resources
└── # Configuration & static resources
- Authentication
- Farmer Management
- Farm Management
- Yield Prediction
- Fertilizer Recommendation
- Irrigation Planning
- Weather Forecasting
- WhatsApp Notification System
git clone https://github.com/gittarsem/khetBuddy-backend.gitcd khetBuddy-backendmvn spring-boot:runOR
./mvnw spring-boot:runCreate a .env file or configure these variables in your deployment platform.
| Variable | Description |
|---|---|
| DB_URL | PostgreSQL Database URL |
| DB_USERNAME | PostgreSQL Username |
| DB_PASSWORD | PostgreSQL Password |
| JWT_SECRET | JWT Secret Key |
| PORT | Server Port |
| WHATSAPP_API_URL | WhatsApp API URL |
| WHATSAPP_TOKEN | WhatsApp API Token |
| WHATSAPP_PHONE_NUMBER_ID | WhatsApp Business Number ID |
spring.application.name=khetBuddy-backend
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
jwt.secret=${JWT_SECRET}
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=20MB
springdoc.swagger-ui.path=/swagger-ui.html
springdoc.api-docs.path=/v3/api-docs
whatsapp.api.url=${WHATSAPP_API_URL}
whatsapp.token=${WHATSAPP_TOKEN}
whatsapp.phone.number.id=${WHATSAPP_PHONE_NUMBER_ID}| Service | Technology |
|---|---|
| Backend Hosting | Render |
| Database | Supabase PostgreSQL |
| Authentication | JWT |
| API Documentation | Swagger OpenAPI |
| Image Storage | Cloudinary |
| Notifications | WhatsApp Cloud API |
| Machine Learning | External ML Models |
This project was built collaboratively:
- Tarsem Gulab → Backend Development, System Design, API Integration, Security
- Frontend Developer → Mobile Application UI/UX
- ML Engineer (@Mayank459) → Prediction APIs & ML Models
The project combines:
- Full Stack Development
- Machine Learning Integration
- Cloud Deployment
- REST API Architecture
- Smart Agriculture Automation
KhetBuddy integrates external Machine Learning microservices developed by @Mayank459 for intelligent agricultural recommendations.
| Service | Purpose | Repository |
|---|---|---|
| Fertilizer Recommendation API | Predict optimal fertilizers | https://github.com/Mayank459/fertilizer-recommendation-api |
| Irrigation Recommendation API | Smart irrigation planning | https://github.com/Mayank459/irrigation-recommendation-api |
| Yield Prediction API | Crop yield estimation | https://github.com/Mayank459/yeild_prediction_api |
These services are integrated into the Spring Boot backend using REST API communication.
- Disease Detection System
- AI Farming Assistant
- Satellite-based Monitoring
- Crop Recommendation System
- Multi-language Support
- Farmer Analytics Dashboard
- Real-time Notification System
Backend Developer | Spring Boot | Machine Learning Integration
GitHub:
https://github.com/gittarsem
This project is licensed under the MIT License.








