PowerSmart Kenya is a high-utility, production-ready web platform designed from an engineering perspective to solve the user experience gaps and technical limitations of legacy utility applications.
# PowerSmart Kenya
**Smart prepaid electricity management & vending for Kenyan households, tenants and landlords.**
PowerSmart Kenya lets tenants monitor their Kenya Power prepaid meter in real time, buy electricity tokens instantly (M-Pesa / Airtel / bank), forecast when they will run out of power, and lets landlords manage multi-meter fleets — all through a single, secure web portal.
---
## Table of contents
- Features
- Tech stack
- Project structure
- Getting started
- Configuration
- Default pages
- API overview
- Database
- Security
- Testing
- License
## Features
- **Real-time meter dashboard** — live kWh balance, daily average usage, depletion forecast.
- **Instant token vending** — buy tokens via M-Pesa, Airtel Money or bank transfer; tokens are generated and recorded instantly.
- **Token & payment history** — every token and transaction is stored in the database.
- **Low-balance alerts** — push / email / SMS rules with configurable thresholds.
- **Auto top-up** — automatically buy tokens when the balance drops below a threshold.
- **Role-based portals** — separate experiences for **Tenant**, **Landlord** and **Admin**, each with its own login.
- **Dedicated admin console** — global stats, user list, meter fleet, token ledger and payment audit trail.
- **Security-first** — bcrypt password hashing, signed expiring JWTs, rate-limited auth, security headers, input validation, webhook secrets and RBAC.
## Tech stack
| Layer | Technology |
|----------|-----------|
| Backend | Go (`net/http`), SQLite (`
modernc.org`), JWT (`golang-jwt`), bcrypt |
| Frontend | Plain HTML + CSS + JavaScript (self-hosted, no CDN framework dependency) |
| Optional | React + Vite prototype under `frontend/src/` (dev only, not required to run) |
## Project structure
```
powersmart-kenya/
├── backend/
│ ├── main.go # Server entry point + route wiring
│ ├── .env.example # Copy to .env and fill in values
│ ├── config/
│ │ ├── dat …