NT-Connections/README.md
Aidan Dona 4a2309b589 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>
2026-10-08 16:56:34 -05:00

62 lines
1.6 KiB
Markdown

# NT-Connections
A NYT Connections style word game with an admin page for creating puzzles.
## Run locally
Needs Node 22.13+ (uses the built-in `node:sqlite`).
```sh
npm install
ADMIN_PASSWORD=choose-one npm start # PowerShell: $env:ADMIN_PASSWORD="choose-one"; npm start
npm test
```
Open http://localhost:3000. Create puzzles at `/admin`.
| Path | What |
|---|---|
| `/` | Today's puzzle (latest puzzle dated today or earlier) |
| `/puzzles` | Every puzzle whose date has arrived, plus undated ones |
| `/play/:id` | A specific puzzle |
| `/admin` | Log in, then create, edit and delete puzzles |
## Environment
| Var | Default | Notes |
|---|---|---|
| `ADMIN_PASSWORD` | required | Changing it logs out existing sessions |
| `PORT` | `3000` | Server listens on 127.0.0.1 only |
| `DB_PATH` | `./data/games.db` | Back this file up |
| `TZ` | system | Decides what "today" is for the daily puzzle |
## Deploy (VPS + nginx)
systemd unit, `/etc/systemd/system/nt-connections.service`:
```ini
[Service]
WorkingDirectory=/srv/nt-connections
ExecStart=/usr/bin/node server.js
Environment=ADMIN_PASSWORD=change-me
Environment=DB_PATH=/var/lib/nt-connections/games.db
Environment=TZ=America/New_York
Restart=always
User=www-data
[Install]
WantedBy=multi-user.target
```
nginx server block:
```nginx
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
```
Use HTTPS (e.g. certbot). The admin cookie is marked `Secure` behind HTTPS, and the "Share results" copy button needs HTTPS to reach the clipboard.