A full-stack Smart Agriculture platform integrating FastAPI, PostgreSQL, AI (Machine Learning), and Streamlit Dashboard. This project is production-ready, deployable via Docker, and GitHub-ready for developers, startups, and research purposes.
- JWT Authentication – Secure login & role-based access
- Sensor Data Management – CRUD operations for temperature, humidity, soil moisture
- AI Crop Recommendation – ML model predicts the best crop based on environmental conditions
- Streamlit Dashboard – Interactive UI for data visualization and AI recommendations
- Docker Deployment – One-command deployment for backend + database
- Backend: FastAPI, Python 3.11
- Database: PostgreSQL
- Machine Learning: scikit-learn, pandas, numpy
- Frontend / Dashboard: Streamlit
- Deployment: Docker & Docker Compose
- Authentication: JWT + passlib bcrypt
smart-agriculture-system/
│── backend/ # FastAPI backend
│ ├── main.py
│ ├── config.py
│ ├── database.py
│ ├── models.py
│ ├── schemas.py
│ ├── auth.py
│ └── routes/
│ ├── auth_routes.py
│ ├── sensor_routes.py
│ └── ai_routes.py
│
├── ai_models/ # AI datasets & models
│ ├── dataset.csv
│ ├── train_model.py
│ └── crop_model.pkl
│
├── dashboard/ # Streamlit dashboard
│ └── app.py
│
├── requirements.txt
├── Dockerfile
├── docker-compose.yml
├── README.md
└── .gitignore
git clone https://github.com/bundlab/smart-agriculture-system.git
cd smart-agriculture-systempython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtSet up PostgreSQL:
CREATE DATABASE smart_agriculture;
CREATE USER smart_user WITH PASSWORD 'smartpass';
GRANT ALL PRIVILEGES ON DATABASE smart_agriculture TO smart_user;Update backend/config.py if necessary.
uvicorn backend.main:app --reloadVisit: http://127.0.0.1:8000/docs
streamlit run dashboard/app.pydocker-compose up --build- Register / Login via
/authendpoints - Send Sensor Data via
/sensorsendpoints - Get AI Crop Recommendation via
/ai/recommend - View data and AI suggestions in Streamlit Dashboard
Abdullahi Bundi – GitHub Profile
This project is licensed under the MIT License.
- Real-time IoT sensor integration (ESP32/Arduino)
- Mobile app interface (Flutter or Kivy)
- Advanced AI for disease and pest detection
- Cloud deployment (AWS, Azure, Railway)