REST API for cereal price monitoring in Burkina Faso
🌾 BurkinaGrain API
> REST API for tracking cereal prices across Burkina Faso's regions.
---
## 🇧🇫 Why this project matters
In Burkina Faso, cereal prices (millet, sorghum, maize) vary significantly by region and season. Farmers, traders, and consumers lack a simple, structured way to access this data programmatically. This API fills that gap by providing a production‑ready, open‑source interface to cereal price data.
**Potential impact:**
- Enable mobile apps for price transparency
- Help agricultural cooperatives make informed decisions
- Provide data for researchers and policymakers
---
## Stack
| Layer | Technology |
|---|---|
| Framework | FastAPI |
| ORM | SQLAlchemy 2.0 + Alembic |
| Auth | JWT (python-jose + passlib) |
| Tests | Pytest — 8 tests passing |
| Deploy | Docker + docker-compose |
| DB | SQLite (dev) / PostgreSQL‑ready |
---
## Quick Start
```bash
git clone
github.com
cd BurkinaGrain-API
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Generate a secure SECRET_KEY:
# python -c "import secrets; print(secrets.token_hex(32))"
uvicorn app.main:app --reload
```
**Swagger UI:**
localhost
### Or run with Docker
```bash
docker-compose up --build
```
---
## API Endpoints
| Method | Route | Auth | Description |
|---|---|---|---|
| POST | /api/v1/auth/register | ❌ | Create account |
| POST | /api/v1/auth/login | ❌ | Get JWT token |
| GET | /api/v1/cereals/ | ❌ | List prices (filter by region/name) |
| POST | /api/v1/cereals/ | âś… | Add a price entry |
| PUT | /api/v1/cereals/{id} | âś… | Update a price entry |
| DELETE | /api/v1/cereals/{id} | âś… | Delete a price entry |
| GET | /health | ❌ | Health check |
---
## Example Responses
**GET /api/v1/cereals/?region=Ouagadougou**
```json
[
{
"id": 1,
"name": "Millet",
"region": "Ouagadougou",
"price_per_kg": 285.0,
"currency": "FCFA",
"recorded_at": "202 …