FarmWise AI is a hyper-local agricultural decision support system that helps smallholder farmers make crop planning, irrigation, pest management, and market timing decisions by combining farm data, agricultural knowledge documents, weather forecasts, and mandi market prices through natural language queries.
# FarmWise AI
FarmWise AI is split into three layers:
- `client/` for the frontend
- `server/` for the FastAPI backend
- `Agents/` for the separate reasoning service
The backend only manages authentication, regional data, weather, mandi prices, and chat history. It does not perform AI reasoning.
## Local Ports
- Backend API: `
localhost`
- Agent service: `
localhost`
- Frontend: `
localhost`
- PostgreSQL: `localhost:5433`
## PostgreSQL
- URL: `postgresql+asyncpg://user:password@localhost:5433/farmwise`
- Username: `user`
- Password: `password`
## Quick Start
From the repo root:
```bash
docker compose up -d db
```
## Agent Service
From `Agents/`:
```bash
uv sync
uv run python parser.py
uv run uvicorn app:app --reload --host 0.0.0.0 --port 8000
```
Current agent notes:
- the advisory corpus in `Agents/docs/advisories/` is the 2026 set
- `Agents/docs/index.json` is regenerated from `Agents/parser.py`
- specialist agents can return structured JSON for crop, pest, irrigation, and market recommendations
- the orchestrator golden eval lives at `Agents/orchestrator/golden_evalset.evalset.json`
- ADK eval support is installed in `Agents` via `google-adk[eval]`
## Frontend Only
The frontend runs on `
localhost`.
From `client/`:
```bash
npm install
npm run dev -- --host 0.0.0.0 --port 5173
```
The client expects the backend API on `
localhost` by default via `VITE_API_BASE_URL`.
Authentication is handled fully in the browser with in-memory access and refresh tokens, so refreshing the page clears the current session.
From `server/`:
```bash
uv sync --extra dev
uv run alembic upgrade head
uv run python -m app.db.seed
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8010
```
Run backend tests from `server/`:
```bash
uv run --extra dev pytest -q
```
Seeded demo users use password `pass123`.
The seed currently creates:
- 5 regions
- 14 days of mandi history per seeded crop through March 12, …