Add a same-origin API proxy route at `/api/pb/[...path]` to forward requests to PocketBase, resolving mixed content blocking issues when the Next.js app is served over HTTPS but PocketBase uses HTTP. Update environment variables to separate the public client-facing URL and internal server-side PocketBase upstream URL, and update all env config examples and deployment files to match the new setup. Clean up the app paths manifest to include the new API route and remove a stale entry. |
||
|---|---|---|
| .next | ||
| node_modules | ||
| public | ||
| scripts | ||
| src | ||
| .dockerignore | ||
| .DS_Store | ||
| .env.local | ||
| .env.local.example | ||
| AGENTS.md | ||
| coolify.env | ||
| Dockerfile | ||
| next-env.d.ts | ||
| next.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.tsbuildinfo | ||
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
# 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:
- Add a new Application resource, point it at this repo.
- Build pack: Dockerfile (not Nixpacks).
- Port: 3000 (Coolify will auto-detect from the
EXPOSE). - Open the Environment Variables tab and paste the contents of
coolify.env. The only required one isNEXT_PUBLIC_POCKETBASE_URL— set it to the external https URL of your PocketBase service. - 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.