[agent] init PocketBase backend + Flutter app #1

Merged
polen merged 2 commits from agent/init-pocketbase-flutter into flubase 2026-06-09 19:37:13 -04:00
Collaborator

What

Replaces the previous Go+htmx+Leaflet backend with a fresh stack on a feature branch off flubase:

  • Backend (Go, root): embeds github.com/pocketbase/pocketbase v0.38.1, auto-creates a stations collection on first serve, and runs a */5 * * * * cron that pulls https://regieessencequebec.ca/stations.geojson.gz and replaces the collection in a single transaction. listRule/viewRule are public; writes go through the App interface (admin-only).
  • Frontend (app/): new Flutter project, flutter_map (Leaflet port) + OpenStreetMap tiles, one MarkerLayer of price-bubble markers per station, and a thin PocketBase REST client in lib/services/pocketbase_service.dart. Web-first, Android-friendly, no third-party state-mgmt yet.
  • main_test.go: covers upstream feed decoding and the price-bucket colour mapping (currently the only Go code; will grow with the data layer).
  • AGENTS.md: build / run / test / style notes for future agents.

Why

flubase is the new base branch; main is preserved as a reference of the old Go+htmx stack. The old htmx+Leaflet client doesn't compose with how the rest of the agent's projects are shaped (PocketBase on the server, a non-jQuery mobile client), and the data model the legacy app used doesn't match what the Regie's current GeoJSON exposes. PocketBase gives us the REST/Admin surface for free, and Flutter on flutter_map keeps the project key-free (no Google Maps) while staying web + Android + iOS-portable.

Verification

# backend
cd /var/lib/hermes/workspace/prixdugaz
CGO_ENABLED=0 go build -o /tmp/prixdugaz .        # already verified, exit 0
CGO_ENABLED=0 go test ./...                       # unit tests
go vet ./...                                      # static analysis

# frontend
cd app
flutter pub get
flutter analyze                                   # static analysis
# flutter test needs flutter_tester (see AGENTS.md)

# runtime
PD_DATA_DIR=./pb_data ./prixdugaz --http=127.0.0.1:8090
curl -s http://127.0.0.1:8090/api/collections/stations/records | jq '.totalItems'
# expect a number > 0 within ~30s of the first cron tick

Web build:

cd app
flutter build web --dart-define=API_BASE_URL=http://localhost:8090
# output: app/build/web/

Notes

  • Module path: github.com/polen/prixdugaz (lowercase, matches the NixOS-deploy import path; the legacy main branch used Polensky/...).
  • pubspec.lock IS committed (per .gitignore rationale for apps).
  • Per-action approval was given for this push on 2026-06-08; the polen/* trust boundary is unchanged.
## What Replaces the previous Go+htmx+Leaflet backend with a fresh stack on a feature branch off `flubase`: - **Backend (Go, root)**: embeds `github.com/pocketbase/pocketbase` v0.38.1, auto-creates a `stations` collection on first serve, and runs a `*/5 * * * *` cron that pulls `https://regieessencequebec.ca/stations.geojson.gz` and replaces the collection in a single transaction. `listRule`/`viewRule` are public; writes go through the `App` interface (admin-only). - **Frontend (`app/`)**: new Flutter project, `flutter_map` (Leaflet port) + OpenStreetMap tiles, one `MarkerLayer` of price-bubble markers per station, and a thin PocketBase REST client in `lib/services/pocketbase_service.dart`. Web-first, Android-friendly, no third-party state-mgmt yet. - **`main_test.go`**: covers upstream feed decoding and the price-bucket colour mapping (currently the only Go code; will grow with the data layer). - **`AGENTS.md`**: build / run / test / style notes for future agents. ## Why `flubase` is the new base branch; `main` is preserved as a reference of the old Go+htmx stack. The old htmx+Leaflet client doesn't compose with how the rest of the agent's projects are shaped (PocketBase on the server, a non-jQuery mobile client), and the data model the legacy app used doesn't match what the Regie's current GeoJSON exposes. PocketBase gives us the REST/Admin surface for free, and Flutter on `flutter_map` keeps the project key-free (no Google Maps) while staying web + Android + iOS-portable. ## Verification ```sh # backend cd /var/lib/hermes/workspace/prixdugaz CGO_ENABLED=0 go build -o /tmp/prixdugaz . # already verified, exit 0 CGO_ENABLED=0 go test ./... # unit tests go vet ./... # static analysis # frontend cd app flutter pub get flutter analyze # static analysis # flutter test needs flutter_tester (see AGENTS.md) # runtime PD_DATA_DIR=./pb_data ./prixdugaz --http=127.0.0.1:8090 curl -s http://127.0.0.1:8090/api/collections/stations/records | jq '.totalItems' # expect a number > 0 within ~30s of the first cron tick ``` Web build: ```sh cd app flutter build web --dart-define=API_BASE_URL=http://localhost:8090 # output: app/build/web/ ``` ## Notes - Module path: `github.com/polen/prixdugaz` (lowercase, matches the NixOS-deploy import path; the legacy `main` branch used `Polensky/...`). - `pubspec.lock` IS committed (per `.gitignore` rationale for apps). - Per-action approval was given for this push on 2026-06-08; the `polen/*` trust boundary is unchanged.
- backend: rewrite on github.com/pocketbase/pocketbase, with a
  stations collection auto-created on first serve and a 5min cron
  that pulls the Régie GeoJSON and replaces the collection
  in a single transaction
- frontend: new Flutter (flutter_map) app in app/, talks to PB
  over plain JSON (no official pocketbase dart pkg yet)
- main_test.go: covers the upstream feed decode and the
  price-bucket colour mapping
- AGENTS.md: build/run/test notes for future agents
- README/.gitignore: updated for the new stack
polen merged commit 348cb68bbc into flubase 2026-06-09 19:37:13 -04:00
polen deleted branch agent/init-pocketbase-flutter 2026-06-09 19:39:08 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
polen/prixdugaz!1
No description provided.