Add Connections-style word game with puzzle editor

Express + node:sqlite server, vanilla HTML/JS frontend. Daily puzzle by
assigned date, puzzle list, shuffle, one-away hint, shareable emoji
results, and a password-protected admin page to create and edit puzzles.
Answers are checked server-side and never sent before they are solved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-08 16:56:34 -05:00
parent 0d3181ec99
commit 4a2309b589
18 changed files with 4286 additions and 0 deletions

38
build.md Normal file
View file

@ -0,0 +1,38 @@
## Instructions
- Design: Use design-taste-frontend skill
## Build
- [x] Create a NYT Connections like game
- [x] Give me a page to create, store set games
## Decisions
- **Stack:** Node + Express + SQLite (one DB file), vanilla HTML/JS frontend. Runs with `npm start`.
- **Deploy:** own VPS, behind nginx (reverse proxy to the Node port). DB file lives outside the web root and must be backed up.
- **Storage:** server-side SQLite, shared for all players.
- **Editor access:** admin only. Single password from env var `ADMIN_PASSWORD`; login sets a signed session cookie. All write endpoints require it.
## Game rules (player page)
- 16 words, 4 hidden groups of 4. Groups have a difficulty color: yellow, green, blue, purple.
- Select up to 4 words, submit a guess. Correct group locks in at the top with its name.
- 4 mistakes allowed, then the game ends and reveals remaining groups.
- **Shuffle** button reorders the remaining words.
- **"One away..."** message when a guess has 3 of 4 from one group.
- Repeat guesses are not counted as mistakes.
- **Share results:** copy an emoji grid (🟨🟩🟦🟪 per guess) to clipboard.
## Pages
- `/` — Puzzle of the day: the game whose assigned date is today; if none, the most recent past-dated game.
- `/puzzles` — list of all published games (title, date) to pick and play.
- `/play/:id` — play a specific game.
- `/admin` — login, then create / edit / delete games.
## Editor (admin page)
- Fields: title, date (optional, unique), 4 groups × (name, color, 4 words).
- Validation: exactly 16 words, no duplicates (case-insensitive), every field filled, each color used once.
## Data model
- `games(id, title, date UNIQUE NULL, groups_json, created_at, updated_at)`
- Answers are never sent to the browser before solved: the client posts guesses to `/api/games/:id/guess` and the server returns correct / one-away / wrong.
## Out of scope (for now)
- User accounts, stats/streaks, multiple admins.