FarmProfit AI helps farmers decide where and when to sell produce by comparing market prices, transportation costs, and other selling costs, then recommending the option with the highest expected net return.
This repository currently contains the project foundation only: folder layout, a FastAPI health check, and a minimal React + Vite + Tailwind frontend. Business logic, market integrations, and UI are not implemented yet.
Farmer Input
→ Market Data Layer
→ Data Validation
→ Profit Calculation Engine
→ Recommendation Engine
→ Explanation + Confidence
→ Farmer
Layers stay separate on purpose:
| Layer | Location | Role |
|---|---|---|
| API | backend/api/ |
HTTP endpoints for farmer input and results |
| Core | backend/core/ |
Shared config and validation |
| Models | backend/models/ |
Domain and data shapes |
| Services | backend/services/ |
Market data, costs, profit calculation |
| Recommendation | backend/recommendation/ |
Explainable ranking of selling options |
| ML | backend/ml/ |
Optional forecasting; not required for MVP recommendations |
| Data | backend/data/ and data/ |
Validated market data and fallbacks |
- Recommendations must stay explainable.
- Market data and API responses are never invented.
- Market data, profit calculation, recommendation logic, and ML stay in separate modules.
- ML/forecasting is optional. The basic engine must work without it.
- If an external market-data source fails, the system should fall back to the latest validated data.
- Keep the MVP small. Docker and extra services come later.
- Frontend: React, Vite, Tailwind CSS
- Backend: Python, FastAPI
- Database: PostgreSQL (not wired up yet)
- AI/ML (later): Pandas, NumPy, scikit-learn
- Version control: Git
FarmProfitAI/
├── frontend/ # React + Vite + Tailwind
├── backend/ # FastAPI application
│ ├── api/
│ ├── core/
│ ├── models/
│ ├── services/
│ ├── recommendation/
│ ├── ml/
│ └── data/
├── data/ # Shared/validated data (no mock market feeds)
├── docs/
├── .gitignore
└── README.md
From the repository root:
cd backend
python -m venv .venvWindows:
.venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reloadmacOS / Linux:
source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reloadHealth check: http://127.0.0.1:8000/health Market data: http://127.0.0.1:8000/markets Interactive docs: http://127.0.0.1:8000/docs
The hackathon MVP does not perform road routing or automatic market discovery. After choosing a crop, district, and farm location, select one or more available market-price records from the market dropdown. Each market keeps its own provider-backed price and date.
Transport quotes are optional. Enter a quote when it is known to compare net profit after transport. If no quote is supplied, the market remains visible but the comparison is marked incomplete; unknown transport is never treated as zero, and no distance is fabricated.
cd frontend
npm install
npm run devThe Vite app is a placeholder so the toolchain can start. There is no farmer UI yet.