GoFair — negotiate-your-fare ride-hailing app for motorcycles and cars in Uganda
# GoFair — live negotiation backend
A real-time rider/driver fare negotiation app, with a driver verification
system gating who's even allowed to see or bid on ride requests. Riders
just pick a name; drivers must register with ID/permit/vehicle details
and photos, then get approved by an admin before their account can do
anything on the driver side.
## What's in here
- `server.js` — Node/Express + Socket.io backend. Ride requests and
negotiation threads live in memory (fine — they're short-lived).
Driver accounts live in `drivers.js`, backed by a JSON file, so
applications survive a server restart.
- `public/index.html` — the rider/driver app.
- `public/admin.html` — password-gated review panel: see submitted
documents, approve or reject each application.
- Map: OpenStreetMap + Leaflet (free, no API key). Address search:
Nominatim (also free).
## Environment variables (set these before deploying — see below)
- `ADMIN_PASSWORD` — the password for `/admin.html`. Defaults to an
insecure placeholder with a startup warning if you don't set one.
- `JWT_SECRET` — signs driver and admin session tokens. Defaults to an
insecure placeholder with a startup warning if you don't set one.
- `PORT` — defaults to 3000; most hosts set this for you automatically.
## How driver verification works
1. A driver opens **Driver** mode → **Register**: name, phone, password,
national ID number, driving permit number, vehicle plate/model, and
photos of their ID, permit, and a selfie.
2. Their account is created with `status: "pending"` — at this point the
backend will **not** let their socket connection see ride requests or
place bids, even if someone tampers with the app's UI (this is
enforced server-side in `server.js`, not just hidden in the frontend).
3. You (or whoever reviews applications) open `/admin.html`, log in with
`ADMIN_PASSWORD`, and see every pending application with its photos.
4. Approve → the driver's app instantly unlocks (if they're online, they
get pushed the update l …