# Utility Billing System (WASAC / REG) Enterprise Spring Boot backend for **water + electricity postpaid** utility billing in Rwanda.
# Utility Billing System (WASAC / REG)
Enterprise Spring Boot backend for **water + electricity postpaid** utility billing in Rwanda.
## Integrated Situation
WASAC (water) and REG (electricity) are unifying billing. Water is postpaid; electricity is transitioning from prepaid to postpaid. Meters support `POSTPAID` (billed monthly) and `PREPAID` (legacy — excluded from monthly billing).
## Tech Stack
Java 21 · Spring Boot 3.3.5 · PostgreSQL · JPA · Spring Security + JWT · Swagger
## Prerequisites
This project requires **JDK 21**. Maven will fail on other Java versions.
```bash
# macOS — point JAVA_HOME at JDK 21 before building
export JAVA_HOME=$(/usr/libexec/java_home -v 21)
java -version # should report 21.x
mvn clean install
```
The repo includes `.java-version` for jenv, asdf, and similar tools.
## Database Setup
**macOS / Linux**
```bash
export PGPASSWORD="your_postgres_password"
createdb -U postgres utility_billing_db 2>/dev/null || true
tail -n +7 database/schema.sql | psql -U postgres -d utility_billing_db
psql -U postgres -d utility_billing_db -f database/migration-v2-business-rules.sql
psql -U postgres -d utility_billing_db -f database/migration-v3-wasac-business-rules.sql
psql -U postgres -d utility_billing_db -f database/migration-v4-project-spec.sql
tail -n +7 database/test-data.sql | psql -U postgres -d utility_billing_db
```
**Windows (PowerShell)**
```powershell
cd database
.\apply-schema.ps1 -Password "your_postgres_password"
psql -U postgres -d utility_billing_db -f database/migration-v2-business-rules.sql
psql -U postgres -d utility_billing_db -f database/migration-v3-wasac-business-rules.sql
psql -U postgres -d utility_billing_db -f database/migration-v4-project-spec.sql
psql -U postgres -d utility_billing_db -f database/test-data.sql
```
## Project Specification Compliance
| Task | Requirement | Status |
|------|-------------|--------|
| **1** | JWT auth, signup/login, secure endpoints | ✅ |
| **1** | User: names, email, phone ( …