Model Denmark's Dronebekendtgørelsen § 5 (on top of EU 2019/947) across all three tiers: schema, API Server, and Web App. Schema (migration 1720300700_add_logbook.js): two collections — `drones` (classification inputs: mtom, is_toy, autologs, c_class, operator no.) and `flights` (§5 minimum content + category/purpose/logging-path + operational maturity + a retention_until computed as operation_date + 5y). Locked API rules; access flows through the service account like users/orgs. API Server (logbook.go, logbook_export.go): /api/drones and /api/flights CRUD with per-role scoping in Go (user→own, admin→org, superadmin→all), plus GET /api/logbook/export (CSV — the "readable electronic format" for Trafikstyrelsen / pending police disclosure). Compliance is computed server-side per flight: exemption (toy / club-area / <250 g hobby), effective logging path, and red flags (autologs-without-FDR, specific-category-without- authorisation, missing §5 fields, past retention). Manual-path saves missing a §5 field are blocked (422). Web App: BFF proxies (export preserves the CSV Content-Type/Disposition), api.js client fns, and a Logbook.vue view (Flights/Drones tabs, inline forms, compliance badges + expandable detail, Export CSV) wired into Dashboard.vue, replacing the placeholder. Includes the rebuilt embedded dist bundle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Web App (Control Panel)
The PilotVault control-panel BFF. It serves the embedded Vue single-page app and
proxies /bff/* to the API Server, so the browser only ever talks to this
server (same-origin). The API Server is the gateway to PocketBase and to the live
Fly App data; the browser never contacts either directly.
Layout
server/ # Go BFF (package main) — proxies /bff/* and serves the SPA
dist/ # built web assets (go:embed target — produced by the web build)
.env.example # configuration template
go.mod
main.go # entrypoint, routing, static serving
bff.go # /bff/* proxy handlers
web/ # Vue 3 + Tailwind source, built by Vite into ../server/dist
Configuration
See server/.env.example. Key variables:
ADDR— address the BFF listens on (default:8090).API_BASE— default API Server the BFF proxies to (defaulthttp://localhost:8080). Users can override this per-session at login.
Develop
# 1. Build the web app into server/dist (embedded by the Go binary)
cd web && npm install && npm run build && cd ..
# 2. Run the BFF
cd server && go run .
For a live UI with hot-reload, run npm run dev in web/ (it proxies /bff to
a locally running BFF on :8090).
Build
cd server && go build -o web-app .
Or build the container image (multi-stage; builds the web app then the binary):
docker build -t pilotvault-web-app .