# Diesel Depot Diesel depot & fleet management web/mobile app — Lumelela Depot + Fanie se plot Depot. **Stack:** Next.js 14 (PWA) · PocketBase backend · Tailwind · TypeScript **Dev port:** 4002 (avoiding 3000/4001 used by sibling projects) ## Quick start ```bash # 1. Install npm install # 2. Configure cp .env.local.example .env.local # → set NEXT_PUBLIC_POCKETBASE_URL # → set PB_ADMIN_TOKEN (a superuser auth token from your PB admin) # 3. Create collections (idempotent — safe to re-run) npm run pb:create # 4. Seed initial data (Lumelela, Fanie se plot, owner user, starter truck) npm run pb:seed # 5. Run npm run dev # → open http://localhost:4002 ``` Default owner login: `owner@dieseldepot.local` / `changeme` — change this on first login. ## Collections (all prefixed `dd_` to avoid clashing with other apps on the same PB) | Collection | Type | Notes | | -------------------- | ---- | -------------------------------------------------- | | `dd_depots` | base | Lumelela, Fanie se plot, etc. | | `dd_trucks` | base | Capacity + current balance + current km | | `dd_clients` | base | Customer master + default_lat/lng for anomaly flag | | `dd_users` | auth | Drivers, pump attendants, admins, owners | | `dd_delivery_notes` | base | Meter readings, photo, signature, status, etc. | ## v1 scope Foundation + delivery note capture. Defer to v2: - Internal transfers (depot ↔ truck load/empty log) - Sage invoice bridge (number/amount capture + status) - Evaporation/loss report - Location anomaly detection - Weekly km prompt - Offline PWA sync queue ## PWA Installable on Android/iOS home screen. Service worker is a stub — no offline cache yet. Pairs well with the camera APIs in the delivery-note form. ## Self-host (Coolify) The repo ships a multi-stage `Dockerfile` (standalone Next.js output) and a `coolify.env` template you can paste straight into Coolify's env panel. In Coolify: 1. Add a new **Application** resource, point it at this repo. 2. Build pack: **Dockerfile** (not Nixpacks). 3. Port: **3000** (Coolify will auto-detect from the `EXPOSE`). 4. Open the **Environment Variables** tab and paste the contents of [`coolify.env`](./coolify.env). The only required one is `NEXT_PUBLIC_POCKETBASE_URL` — set it to the external https URL of your PocketBase service. 5. Deploy. The first build will take a few minutes; subsequent deploys are fast thanks to the layer cache. If you don't have PocketBase in Coolify yet, add it as a second service (any of the `pocketbase/pocketbase` image templates work) and point the Diesel Depot's `NEXT_PUBLIC_POCKETBASE_URL` at its public domain.