A comprehensive backend API for Kenya's civic technology platform - empowering citizens with constitutional knowledge, legal assistance, and civic participation tools.
# Citizen Hub Kenya - Backend API
A comprehensive backend API for Kenya's civic technology platform - empowering citizens with constitutional knowledge, legal assistance, and civic participation tools.
**Live API:**
citizen-hub-kenya-backend.o…
## Features
### Authentication
- Phone number based registration and login
- JWT (JSON Web Token) authentication
- M-Pesa STK Push integration for identity verification
- Test authentication endpoint for development
### Constitution Management
- Full text search of the Constitution of Kenya 2010
- Access to all 33+ constitutional articles
- Simplified English versions of legal text
- Bilingual support (English and Swahili)
### AI Legal Assistant
- Natural language question answering
- Contextual search of constitution articles
- Conversation history tracking
- User feedback system
- Source attribution for answers
### Civic Features
- Did You Know - Kenyan history facts
- Frequently Asked Questions (FAQs)
- Parliament Scorecard - Track MP performance
- Public Events listing
- Anonymous Crime Reporting
- Voting verification status
## Tech Stack
- Django 6.0
- Django REST Framework 3.14
- Simple JWT 5.3
- PostgreSQL 15+ (Production) / SQLite (Development)
- Gunicorn 21.2
- Whitenoise 6.6
- Psycopg2 2.9
- python-dotenv 1.0
- requests 2.32
- django-cors-headers 4.3
## API Endpoints
### Health Check
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health/ | API health status |
### Authentication
| Method | Endpoint | Description | Auth Required |
|--------|----------|-------------|---------------|
| POST | /api/auth/register/ | Register new user | No |
| POST | /api/auth/login/ | Login with phone number | No |
| POST | /api/auth/test-success/ | Test login (returns JWT) | No |
| GET | /api/auth/profile/ | Get user profile | Yes |
| POST | /api/auth/logout/ | Logout user | Yes |
### M-Pesa Integration
| Method | Endpoint | Description | Auth Required |
|--------|--------- …