# Zambia Truck Rental
Production-ready truck rental portal for Zambia. Built with Next.js 14, TypeScript, Prisma, Tailwind, and Flutterwave payments (ZMW + Airtel/MTN Mobile Money). GPS tracking via Leaflet/OpenStreetMap.
## Features
- User registration & login (bcrypt + JWT in HTTP-only cookies)
- Vehicle catalog with filters (pickup, medium, heavy, refrigerated, tipper)
- Booking flow with date range, locations, total calculation
- Payment gateway: **Flutterwave** for live (cards + Airtel/MTN Money), with a sandbox simulator for dev
- Live GPS tracking page (Leaflet map, OSM tiles, simulated telemetry)
- Customer dashboard with bookings table and stats
## Local development
```bash
cp .env.example .env # already set up with sandbox keys
npm install
npx prisma db push # creates SQLite db
npm run db:seed # seeds 8 vehicles
npm run dev #
localhost
```
## Deploying to Vercel
1. Push this repo to GitHub.
2. Import into Vercel.
3. **Database**: switch `provider` in `prisma/schema.prisma` from `sqlite` to `postgresql` and provision a free Neon or Vercel Postgres DB. Set `DATABASE_URL` in Vercel env.
4. Set env vars in Vercel dashboard:
- `DATABASE_URL` — Postgres connection string
- `JWT_SECRET` — `openssl rand -base64 32`
- `FLW_PUBLIC_KEY`, `FLW_SECRET_KEY`, `FLW_ENCRYPTION_KEY` — from Flutterwave dashboard
- `NEXT_PUBLIC_APP_URL` — your prod URL (e.g. `
zambia-trucks.vercel.app`)
- `NEXT_PUBLIC_FLW_PUBLIC_KEY` — same as `FLW_PUBLIC_KEY`
5. Deploy. The build runs `prisma generate` automatically.
6. After first deploy, run `npx prisma db push` against the prod DB and re-seed (`npm run db:seed`).
## Going to live payments
The app auto-detects whether real Flutterwave keys are set. With sandbox/demo keys (default `.env`), it uses a built-in simulator at `/payment/simulate`. Replace the keys with your live or test keys from Flutterwave and the same flow drives a real hosted checkout.
## GPS tracking integration
The curre …