Commit Graph
7 Commits
Author SHA1 Message Date
x0gp c25e0bc581 Add WebRTC support and remove deviceId from apis 2026-07-15 00:57:36 +04:00
x0gp 7a7913d2ee Add gh workflow for release, new fields in podium and versioning v0.0.1 2026-07-14 18:36:51 +04:00
x0gp 13495de5bd feat: add fast Docker build script and home server documentation 2026-07-06 22:11:42 +04:00
x0gp e5155c8a42 feat(server): add Dockerfile.fast and scripts for fast host-compiled builds
- Add Dockerfile.fast which packages a pre-built binary instead of compiling inside the container.
- Add scripts/build-fast.ps1 (PowerShell) and scripts/build-fast.sh (Bash) to automate local cross-compilation (CGO_ENABLED=0 GOOS=linux) and Docker packaging.
- Set executable bit for build-fast.sh.
2026-07-06 22:04:28 +04:00
x0gp 76e33cfe62 feat(hardware): initial hardware documentation, 3D models, and ESP32 client code
- Add initial versions of hardware bills of materials (BOM v1-v4), shopping lists, plan, and assembly guides.
- Add STL models for 3D-printing the 1/27 scale OpenRC F1 car parts.
- Add Blender 3D project files (.blend) and camera renders of the car design iterations.
- Add ESP32 client firmware source (client.ino) for handling video streaming and car controls.
- Ignore Blender backup files (*.blend1, *.blend2) and IDE directories.
2026-07-06 12:41:04 +04:00
x0gp 49351b4928 feat(server): integrate UDP video service and normalize database schema
- Implement UDPVideoService to stream MJPEG video frames from ESP32s via UDP and send control commands.
- Normalize race database schema:
  - Remove redundant driver_ids array from races table (migration 011).
  - Move per-driver outcomes (total_time_ms, best_lap_ms, position) to race_drivers table (migration 012).
  - Add device_id column to lobby_drivers to link active physical devices (migration 013).
- Update WebSocket handler to pass lobbySvc, driversSvc, and videoSvc for driver identity tracking, syncing in-memory driver metadata, and forwarding WS controls to physical cars.
- Add CORS middleware to HTTP routes.
- Regenerate Swagger documentation.
2026-07-06 12:38:34 +04:00
x0gp 978d36c505 feat(server): initial implementation
This commit captures the full server code accumulated across
several development sessions. It includes the following layers,
applied in roughly this order during development:

1. Base infrastructure
   - cmd/poc-server HTTP+WebSocket server, /health, /stats
   - internal/transport wire types (Envelope + all message types)
   - internal/catalog, internal/realtime, internal/stats
   - internal/storage/postgres with migrations 001-004
   - .env, .env.example, docker-compose, Dockerfile, scripts/

2. Swagger documentation
   - go get github.com/swaggo/http-swagger
   - swag init produces docs/docs.go
   - /swagger/index.html UI, /swagger/doc.json spec
   - annotations on health/stats/ws and catalog handlers

3. Races API
   - internal/races/{store,service,keyset,types}.go
   - migration 005_races.sql: finished_races, race_plans, race_queue
   - GET /api/races with keyset pagination, status filter
   - GET /api/races/upcoming
   - POST /api/races/queue/join, GET, DELETE
   - POST/GET /api/races/plans, DELETE /{id}
   - lobby.RaceMeta simplification (no host_id/host_name)

4. Races seeder
   - internal/races/seed with deterministic generator
   - --seed-races / --reset CLI flags in main.go
   - 30 finished + 5 live + 5 plans + 4 queue entries

5. Drivers and clans
   - internal/drivers, internal/clans (CRUD, validation)
   - migration 008_drivers_clans.sql
   - /api/clans and /api/drivers endpoints
   - 3-letter uppercase nickname/tag validation
   - lobby.DriverMeta: Nickname, AvatarURL, ClanID, ClanTag

6. Podium
   - internal/transport.RacePodiumEntry
   - lobby.SetDriverProfile for in-memory metadata sync
   - migration 007_podium.sql (podium JSONB column)
   - seeder populates top-3 per finished race

7. Live races persistence
   - migration 009_live_persistence.sql: live_races,
     live_race_drivers, lobby_drivers
   - internal/races/live_store.go: LiveStore with write-side
     mirror for lobby.Service mutations
   - Service.collectLive and Upcoming read from Postgres
   - main.go RestoreFromDB rehydrates lobby on startup

8. Unify live + finished into one races table
   - migration 010_unify_races.sql: rename finished_races to
     races, expand status CHECK, merge live rows
   - PgStore now hosts both write paths; LiveStore is a
     thin facade implementing lobby.Persistence
   - seeder resetAll drops only finished/cancelled rows and
     race_plans / race_queue / lobby_drivers

Each layer is consistent on its own; cross-layer changes are
visible in the file history. A future refactor may split this
commit into the per-stage boundaries listed above.
2026-06-22 22:01:09 +04:00