Malawi Agricultural AI Assistant
# Mlimi AI — Malawi Agriculture Chatbot
A modern chatbot for Malawian farmers. Flask backend using an external English model inference endpoint
(swappable for future language-specific models), React + Tailwind + shadcn-style UI
with a farmer-themed palette.
```
chatbot/
├── backend/ Flask API (external model inference, streaming-compatible SSE, SQLite auth)
└── frontend/ Vite + React + TypeScript + Tailwind + shadcn UI
```
---
## Quick start (local)
### 1. Backend
```bash
cd chatbot/backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
$EDITOR .env # set ENGLISH_MODEL_URL, change JWT_SECRET, etc.
python app.py # runs on
localhost
```
On first run the backend:
- Creates `mlimi.db` (SQLite) next to `app.py`
- Auto-applies any schema migrations
- **Seeds the default admin + test user** (see Default users)
### 2. Frontend
```bash
cd chatbot/frontend
npm install
npm run dev #
localhost
```
The Vite dev server proxies `/api/*` to `
localhost`, so start the
backend first and the frontend connects automatically.
---
## Default users
These are created on the **first** backend start (idempotent — re-running
doesn't overwrite existing users). All credentials are configurable via env
vars in `backend/.env`.
| Role | Email (default) | Password (default) | Where to change |
| ----- | ---------------------- | ------------------ | -------------------------------- |
| Admin | `admin@mlimi.local` | `admin12345` | `DEFAULT_ADMIN_*` env vars |
| User | `farmer@mlimi.local` | `farmer12345` | `DEFAULT_USER_*` env vars |
The admin account can:
- View the `/admin` panel (dashboard, user management, system info)
- See chat analytics (signups, chat volume, language split, token usage / est. cost)
- Suspend / re-enable / delete users
- Reset any user's password (returns a one-time temp …