Full-stack bus transport management system for Kenya — NestJS, Next.js, Flutter, PostgreSQL, Docker
# BusPawa — Full-Stack Transport Management System
A complete fleet, ticketing, parcel, and finance management system designed for Kenyan transport operators, built on a Truehost VPS stack.
## Architecture
```
buspawa/
├── backend/ NestJS API server
├── frontend/ Next.js PWA (web + admin)
├── mobile/ Flutter apps (conductor, booking agent, customer)
├── docker/ Nginx config, SSL certs
├── .github/ CI/CD pipeline
└── docker-compose.yml
```
## Tech Stack
| Layer | Technology | Why |
|-------|-----------|-----|
| Backend | NestJS + TypeScript | Robust, modular, Docker-friendly |
| Database | PostgreSQL | Financial-grade data integrity |
| Cache | Redis | Session management, rate limiting |
| Frontend | Next.js (PWA) | Single codebase for admin + customer |
| Mobile | Flutter | Single codebase for conductor, agent, customer |
| Payments | M-Pesa Daraja API | Essential for Kenya |
| SMS | Africa's Talking | Local, reliable |
| Proxy | Nginx + SSL | Reverse proxy, rate limiting |
| Deploy | Docker + GitHub Actions | Automated CI/CD |
## Quick Start
### 1. Clone & configure
```bash
cp .env.example .env
# Edit .env with your credentials
```
### 2. Run with Docker
```bash
docker compose up -d --build
```
### 3. Access
- **API**:
localhost
- **Frontend**:
localhost
- **Admin panel**:
localhost (via Nginx)
## Backend API Endpoints
### Auth
- `POST /api/auth/register` — Create account
- `POST /api/auth/login` — Sign in
- `GET /api/auth/profile` — Current user
- `GET /api/auth/stations` — List stations
### Tickets
- `POST /api/tickets/book` — Book a ticket
- `GET /api/tickets` — List tickets
- `GET /api/tickets/stats` — Ticketing statistics
- `GET /api/tickets/manifest/:tripId` — Trip manifest
- `PATCH /api/tickets/:ref/check-in` — Check in
- `PATCH /api/tickets/:ref/board` — Mark boarded
### Parcels
- `POST /api/parcels` — Create parcel
- `GET /api/parcels` — List parcels
- `GET /api/p …