This commit is contained in:
2026-03-05 22:08:06 +02:00
parent 22b700e241
commit 8f96d7514f
24 changed files with 2303 additions and 488 deletions

View File

@@ -1,29 +1,40 @@
# Scrum Solitare
Win98-themed Scrum Poker web app scaffold using Go + Gin.
Enterprise-style Scrum Poker application using Go, Gin, and SSE for real-time room updates.
## Features
## Highlights
- Gin server with default port `8002`
- Gzip compression enabled
- Cache headers for static `css`, `js`, and image assets
- Template rendering from `src/templates`
- Static file hosting from `static/`
- `/` currently serves a room configuration page (UI only)
- Go backend with layered architecture (`handlers`, `state`, `routes`, `config`)
- Memory-first room state with disk synchronization to JSON files
- Real-time updates via Server-Sent Events (SSE)
- Strict state sanitization: unrevealed votes from other users are never broadcast
- Backend authorization for admin-only actions (`reveal`, `reset`)
- Win98-themed frontend with:
- Config page and card deck preview
- Drag-and-drop card ordering
- Card add/remove with animation completion handling
- Room password option
- Room interface with voting area, participants, and admin controls
- Username persistence through `localStorage`
## Project Layout
- `src/main.go`: Application bootstrap
- `src/config/`: Environment and runtime configuration
- `src/server/`: Gin engine construction and middleware wiring
- `src/routes/`: Route registration
- `src/controllers/`: HTTP handlers/controllers
- `src/middleware/`: Custom Gin middleware
- `src/models/`: Page/view data models
- `src/templates/`: HTML templates (`header`, `body`, `footer`, and `index` composition)
- `static/css/`: Stylesheets
- `static/js/`: Frontend scripts
- `static/img/`: Image assets
- `src/main.go`: app bootstrap
- `src/config/`: environment configuration
- `src/server/`: Gin engine setup
- `src/routes/`: page/api route registration
- `src/handlers/`: HTTP handlers (pages + API + SSE)
- `src/state/`: in-memory room manager, sanitization, persistence
- `src/middleware/`: static cache headers middleware
- `src/models/`: template page data models
- `src/templates/`: HTML templates (`index.html`, `room.html`)
- `static/css/`: styles
- `static/js/`: frontend logic (`config.js`, `room.js`)
## Environment Variables
- `PORT`: server port (default `8002`)
- `DATA_PATH`: directory for room JSON files (default `./data`)
## Run Locally
@@ -34,22 +45,27 @@ go run ./src
Open `http://localhost:8002`.
## Environment Variables
- `PORT`: Optional server port override (default is `8002`)
## Docker
Build image:
Build:
```bash
docker build -t scrum-solitare .
```
Run container:
Run:
```bash
docker run --rm -p 8002:8002 scrum-solitare
docker run --rm -p 8002:8002 -e DATA_PATH=/app/data scrum-solitare
```
Then open `http://localhost:8002`.
## Real-Time Flow (SSE)
- Client joins room via `POST /api/rooms/:roomID/join`
- Client subscribes to `GET /api/rooms/:roomID/events?participantId=...`
- Server broadcasts sanitized room state updates on critical mutations:
- room creation
- join/leave
- vote cast
- reveal
- reset