20 Commits

Author SHA1 Message Date
Ryan Hamamura
8c3b3fc6ea refactor: replace via framework with chi + templ + datastar
Some checks failed
CI / Deploy / test (pull_request) Successful in 28s
CI / Deploy / lint (pull_request) Failing after 42s
CI / Deploy / deploy (pull_request) Has been skipped
Migrate from the via meta-framework to direct dependencies:
- chi for routing, templ for HTML templates, datastar for SSE/reactivity
- Feature-sliced architecture (features/{auth,lobby,c4game,snakegame}/)
- Shared layouts and components (features/common/)
- Handler factory pattern (HandleX(deps) http.HandlerFunc)
- Embedded NATS server (nats/), SCS sessions (sessions/), chi router wiring (router/)
- Move ChatMessage domain type from ui package to game package
- Remove old ui/ package (gomponents-based via/h views)
- Remove via dependency from go.mod entirely
2026-03-02 12:16:25 -10:00
Ryan Hamamura
2df20c2840 refactor: adopt portigo infrastructure patterns
Add config package with build-tag-switched dev/prod environments,
structured logging via zerolog, Taskfile for dev workflow, golangci-lint
config, testutil package, and improved DB setup with proper SQLite
pragmas and cleanup. Rename sqlc output package from gen to repository.

Switch to allowlist .gitignore, Alpine+UPX+scratch Dockerfile, and
CI pipeline with test/lint gates before deploy.
2026-03-02 11:48:47 -10:00
Ryan Hamamura
91b5f2b80c deps: update ryanhamamura/via to v0.23.0
All checks were successful
Deploy c4 / deploy (push) Successful in 57s
Remove ContextSuspendAfter and ContextTTL options, which were
deleted upstream. Contexts now persist until SSE close beacon
or server shutdown.
2026-02-20 12:06:51 -10:00
Ryan Hamamura
73b6e3bcc5 deps: update ryanhamamura/via to v0.21.2
All checks were successful
Deploy c4 / deploy (push) Successful in 1m0s
2026-02-20 09:26:24 -10:00
Ryan Hamamura
ffd44ae56b deps: update ryanhamamura/via to v0.19.0
All checks were successful
Deploy c4 / deploy (push) Successful in 54s
2026-02-19 12:13:00 -10:00
Ryan Hamamura
884650c68d feat: integrate via v0.18.1 context suspension and key throttling
Some checks failed
Deploy c4 / deploy (push) Has been cancelled
Upgrade via to v0.18.1 and configure context suspension timeouts
(5min suspend, 30min TTL) for clean reconnection behavior. Throttle
snake direction key inputs to 100ms to prevent wasted SSE round-trips
when keys are held down.
2026-02-19 11:14:35 -10:00
Ryan Hamamura
08c20a1732 chore: re-upgrade via to v0.15.1
All checks were successful
Deploy c4 / deploy (push) Successful in 43s
The login bug was caused by missing RenewToken(), not the via update.
2026-02-13 11:43:31 -10:00
Ryan Hamamura
645d958041 revert: downgrade via to v0.15.0 to debug login regression
All checks were successful
Deploy c4 / deploy (push) Successful in 4s
Login on deployed server stopped persisting session data after the
v0.15.1 update. Reverting to isolate whether the via update caused it.
2026-02-13 11:29:17 -10:00
Ryan Hamamura
f238e126d3 chore: update via to v0.15.1
All checks were successful
Deploy c4 / deploy (push) Successful in 54s
2026-02-13 10:59:00 -10:00
Ryan Hamamura
d2ed3cffd9 deps: update via to v0.15.0, remove vianats dependency
NATS is now built into via.New() automatically. Stores use the new
v.PubSub() accessor instead of the removed vianats package.
2026-02-12 15:10:18 -10:00
Ryan Hamamura
7faf94fa6d feat: make invite link base URL configurable via APP_URL
Load environment variables from .env file using godotenv.
Defaults to https://demo.adriatica.io if APP_URL is not set.
2026-02-04 07:02:52 -10:00
Ryan Hamamura
038c4b3f22 Update via to v0.4.0 and decouple tick rate from snake speed
Use via.OnKeyDownMap for snake keybindings, replacing the manual
dataExpr/rawDataAttr workaround. Window-scoped key handling removes
the need for tabindex/focus hacks, and WithPreventDefault on arrow
keys prevents page scrolling during gameplay.

Introduce a 60 FPS tick loop with a separate snake movement speed
(7 cells/s) so direction input is polled every frame but game state
only advances at the configured rate.
2026-02-02 09:18:13 -10:00
Ryan Hamamura
a6b5a46a8a Replace polling loop with NATS pub/sub for game updates
Use via's embedded NATS server to notify players of state changes
instead of a 100ms polling ticker. Each player subscribes to
"game.<id>" on page load; via auto-cleans subscriptions on disconnect,
eliminating the need for manual player tracking and RegisterSync.
2026-01-31 10:26:31 -10:00
Ryan Hamamura
d079b90a33 Update via dependency from v0.2.5 to v0.3.1 2026-01-31 09:30:32 -10:00
Ryan Hamamura
f590a2444a Replace PicoCSS with DaisyUI + Tailwind v4
Use gotailwind (standalone Tailwind v4 via Go tool) with DaisyUI
plugin files — no npm needed. CSS is compiled at build time and
embedded via a Via Plugin that serves it as a static file.

Custom "connect4" theme: light, warm, playful palette with red/yellow
accents matching game pieces and board blue accent.
2026-01-31 07:31:29 -10:00
Ryan Hamamura
5e1712c4a0 Use SQLite for session storage
Upgrade via to v0.2.5 and switch from in-memory sessions to SQLite-backed
sessions for persistence across server restarts.
2026-01-22 16:53:47 -10:00
Ryan Hamamura
ee762fb841 Fix player reconnection by re-registering sync context
When an existing player reconnects to a game, their sync context
is now updated so they continue receiving real-time updates.
2026-01-14 21:54:07 -10:00
Ryan Hamamura
b264d8990b Add user authentication and game persistence with SQLite
- User registration/login with bcrypt password hashing
- SQLite database with goose migrations and sqlc-generated queries
- Games and players persisted to database, resumable after restart
- Guest play still supported alongside authenticated users
- Auth UI components (login/register forms, auth header, guest banner)
2026-01-14 16:59:40 -10:00
Ryan Hamamura
63d0773ab5 Simplify codebase and fix Enter key on home page
- Enter key now triggers createGame action on home page
- Remove redundant setNickname action from home page
- Remove unused code: join channel, Leave(), Stop() methods
- Consolidate ID generation into game.GenerateID()
- Remove unused CreatedAt field from Game struct
2026-01-14 14:10:18 -10:00
Ryan Hamamura
389fc12bf2 Add Connect 4 multiplayer game server
Real-time two-player Connect 4 using Via framework with:
- Game creation and invite links
- SSE-based live updates for both players
- Win detection with animated highlighting
- Session-based nickname persistence
2026-01-14 12:57:57 -10:00