Refresh docs and fix Docker builds for current layout

READMEs: correct the auth model (PocketBase token relay, not JWT/sessions),
document the full feature set (technical checks, fuel, maintenance, documents,
reminders, attachments, integrations, OCPP charging control), the shipping
built-in connectors (toyota, anker-solix), and the current endpoint surface.

Docker: build against the current repo layout — Go 1.26, cmd/server entry
point, Web App source under web/. Add the missing Web App Dockerfile (Go BFF)
and .dockerignore, drop the obsolete AUTH_SECRET, modernise CORS var naming,
and standardise on drivervault-* naming.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
tajniak81
2026-07-19 11:05:46 +02:00
co-authored by Claude Opus 4.8
parent f9b1bcc520
commit 1e76c2b7f9
15 changed files with 301 additions and 138 deletions
+60 -28
View File
@@ -1,8 +1,9 @@
# Car Control Project
# DriverVault
A car control & service tracking system. Built incrementally — starting with a
**car maintenance tracker** (modeled on `Car Service.xlsx`) and growing toward
live integration with the car via an ESP32 device.
A car control & service-tracking system (originally "Car Control Project").
Built incrementally — starting with a **car maintenance tracker** (modeled on
`Car Service.xlsx`) and growing toward live integration with the car via a
cellular ESP32 device and third-party services (Toyota Connected, EV chargers).
## Architecture
@@ -14,7 +15,7 @@ nothing talks to PocketBase directly.
Web App (Vue) ─────▶│ │
Phone App (Flutter)▶│ API Server │────▶ PocketBase
Home Assistant ────▶│ (Go, stdlib) │ (10.2.1.10:8027)
ESP32 device ──────▶│ │
Car Agent (ESP32) ─▶│ │
└──────────────────┘
```
@@ -24,8 +25,9 @@ nothing talks to PocketBase directly.
| **Database** | PocketBase | ✅ running, schema + seed done | — |
| **Web App** | Vue 3 + Vite + Tailwind v4 | ✅ full feature set (below) | [Web App/README.md](Web%20App/README.md) |
| **Phone App** | Flutter (Android) | ✅ web parity + biometric login | [Phone App/README.md](Phone%20App/README.md) |
| **Docker** | Compose (server / all-in-one) | ✅ deployment configs | [Docker](Docker) · [Docker AIO](Docker%20AIO) |
| **Car Agent Device** | ESP32 + SIM7600 (LILYGO TTGO) | 🚧 firmware in progress | [Car Agent Device](Car%20Agent%20Device) |
| **Home Assistant Plugin** | — | ⬜ later | — |
| **Car Agent Device** | ESP32 | ⬜ later | — |
The Web and Phone apps are at feature parity (the phone omits only data
export/import).
@@ -33,35 +35,60 @@ export/import).
## Features
- **Maintenance tracking** — cars, service history (date/odometer + which parts
were changed), and a per-car parts catalog, with next-due date/km status.
- **Accounts & sessions** — JWT login, per-device active sessions with remote
logout, profile + appearance preferences (theme/locale/date/font), email
verification, and account deletion.
- **Translated UI** — the interface reads its text from per-language files
(English, Polish, Danish today), driven by the language half of the user's
locale, with English as the fallback for any untranslated string. See
[TRANSLATIONS.md](TRANSLATIONS.md) for the format and how to add a language.
were changed), and a per-car parts catalog, with next-due date/km status from
the spreadsheet formulas.
- **Technical checks** — the mandatory roadworthiness inspections (przegląd
techniczny / MOT / TÜV): result, cost, station and the certificate's
valid-until, which overrides the car's interval and drives the next-due date.
- **Maintenance log** — workshop visits and repairs outside the routine schedule:
type/status, workshop, parts used, labour + parts cost, invoice, warranty-until.
- **Fuel tracking** — refills with derived efficiency (average / best / worst
consumption, cost per km, price per litre). Consumption is measured between
full tanks, so partial fills roll into the next full one.
- **Documents** — insurance, registration, road tax and the rest, each with a
server-computed renewal/expiry state.
- **Reminders** — date- and/or odometer-triggered, one-off or recurring, plus
read-only reminders the server derives from documents and service records.
- **Attachments** — one optional file (PDF or image) per service record,
technical check, maintenance entry, refill, document and part; fetched back
through the API Server, never a public URL.
- **Accounts** — PocketBase-token login, profile + appearance preferences
(theme/locale/date format/currency/font), avatar, email verification, data
export/import, and an account-deletion state machine.
- **Organizations & roles** — multi-tenant `user` / `admin` / `superadmin`
roles; admins manage users within their own organization, superadmins span all.
- **Per-user ownership & sharing** — each car has an owner and can be shared with
other users as read or write; the UI mirrors the server's access checks.
- **Admin** — role-gated user management (create / role / reset password / delete).
- **Integrations** — per-user connectors under a superadmin → org-admin → user
cascade. Built-in today: **Toyota Connected** (read-only vehicle data) and the
**Anker Solix** V1 EV charger.
- **EV charging control** — for Anker Solix chargers the API Server runs an
**OCPP 1.6J Central System**; in own/proxy mode the charger dials back in and
the owner can start/stop and set limits from the Charging screen.
- **Translated UI** — the interface reads its text from per-language files
(English, Polish, Danish today), with English as the fallback for any
untranslated string. See [TRANSLATIONS.md](TRANSLATIONS.md).
- **Phone biometric login & app lock** — fingerprint / face sign-in with an
app-lock that requires an unlock on relaunch (with a short grace period for
quick app-switches). See the Phone App README.
app-lock that requires an unlock on relaunch. See the Phone App README.
## Auth model
All three apps share one auth model: login via `POST /api/auth/login` returns a
JWT issued by the API Server (after verifying against PocketBase `users`), and
every other endpoint requires `Authorization: Bearer <token>`. Each login also
creates a server-side session whose id is embedded in the token, so sessions can
be listed and revoked. Access to cars/records/parts is gated by per-user
ownership and shares; admin endpoints require the admin role.
All apps share one auth model: **authentication is PocketBase's own.**
`POST /api/auth/login` is proxied to the PocketBase users collection and the
client keeps the token PocketBase minted — the API Server does **not** issue its
own JWT. Every protected request carries `Authorization: <token>` (both
`Bearer <token>` and a raw token are accepted) and the server re-resolves it
against PocketBase on each call, so a role change or a deletion takes effect
immediately. Tokens are stateless, so there is no per-device session list;
changing an account's password rotates its token key and invalidates every token
already issued. Access to cars/records is gated by per-user ownership and shares;
user management requires the admin or superadmin role.
## Domain (from `Car Service.xlsx`)
- **Cars** — one per vehicle (was: one spreadsheet sheet), with spec fields
(engine / transmission / differential oil, brake fluid, coolant, VIN, …) and
configurable service intervals.
(engine / transmission / differential oil, brake fluid, coolant, VIN, fuel
type, build / first-registration dates, …) and configurable service intervals.
- **Service records** — date + odometer per service, plus which parts were
changed (oil & oil filter, engine air filter, cabin air filter).
- **Parts** — per-car catalog of part numbers.
@@ -86,13 +113,18 @@ Bring up the stack in this order — each app's README has the details:
3. **[Phone App](Phone%20App/README.md)** — `flutter build apk` /
`flutter run` with `--dart-define=API_BASE=http://<server-ip>:8080/api`.
Or bring the whole stack up with **Docker** — see [Docker](Docker) (server +
web) and [Docker AIO](Docker%20AIO) (single all-in-one image).
## Layout
```
Car Control Project/
DriverVault/
├── API Server/ # Go gateway to PocketBase (the only DB client)
├── Web App/ # Vue 3 + Vite + Tailwind v4
├── Web App/ # Vue 3 + Vite + Tailwind v4 SPA + Go BFF
├── Phone App/ # Flutter (Android)
├── Car Agent Device/ # ESP32 + SIM7600 firmware (LILYGO TTGO T-SIM7600)
├── Home Assistant Plugin/ # later phase
── Car Agent Device/ # ESP32, later phase
── Docker/ # Compose deployment (API Server + Web App)
└── Docker AIO/ # single all-in-one image
```