Practical reference implementation that combines a FastAPI backend, React+Vite frontend, MongoDB Atlas, and lightweight ML services powered by PyTorch and scikit-learn. Focus is on getting a compelling hackathon demo live quickly: crop disease detection, career guidance, entrepreneurship builder, SOS + live tracking, mentorship, and schemes navigator.
- Python 3.10+ with
pip - Node.js 18+ / npm
- MongoDB Atlas cluster (or local Mongo on
mongodb://localhost:27017) - Optional: CUDA GPU for training the crop model
Copy .env.example to .env and adjust credentials (MongoDB, Twilio, model paths).
cd backend
python -m venv .venv
. .venv/Scripts/activate # PowerShell: .\\.venv\\Scripts\\Activate.ps1
pip install -r app/requirements.txt
uvicorn app.main:app --reload --port 8000Key endpoints:
POST /ml/detect– crop disease inference (fallback if model missing)POST /career/recommend– ML/rule-based career pathsPOST /business/generate– entrepreneurship plan builderPOST /schemes/match– filters seeded schemesGET /mentors/+POST /mentors/request– mentorship flowWS /safety/ws/sos– WebSocket real-time SOS relay
Training helpers live in backend/app/ml/. Run them after arranging a small dataset to refresh models.
cd frontend/agriher-frontend
npm install
npm run dev -- --hostRoutes/pages include:
- Landing with feature highlights
- Crop detection uploader
- Career navigator & learning journey
- Entrepreneurship builder + printable plan
- SOS dashboard with live WebSocket feed
- Mentor directory and schemes explorer
TailwindCSS is configured for rapid UI tweaks.
Backend & frontend ship with individual Dockerfiles for quick deployment. Example:
cd backend
docker build -t agriher-api .
docker run -p 8000:8000 --env-file ../.env agriher-api- Career form ➜ recommendation & roadmap
- Business plan generator ➜ share PDF/screenshot
- Crop detection ➜ upload demo leaf, show response
- SOS button ➜ observe WebSocket alert stream
- Mentor directory + scheme matches ➜ highlight data
- Wrap with architecture slide + deployment mention
- Backend: add FastAPI tests via
pytest(not included yet); start with health + route smoke tests. - Frontend: run
npm run lintto ensure JSX consistency.
- Swap fallback models with fully trained PyTorch checkpoints
- Integrate Whisper for speech UX, LangChain for scheme Q&A
- Wire push notifications (Firebase) + production SMS/voice via Twilio
- Deploy on Render/Railway (backend) and Vercel/Netlify (frontend)
Happy hacking! Contributions welcome.