A territory-map revision game for Elliot and friends. Each subject is a map, and each test topic is a hex tile. Answering a tile's cards builds your mastery; reach the threshold and you claim the tile in your colour. Mastery decays with spaced repetition, so friends can steal tiles back.
- Live: https://studyturf.bond (once DNS and the server are set up)
- Stack: Node 22, Fastify, SQLite (better-sqlite3), vanilla JS with no build step, and Caddy for HTTPS.
- Design: see DESIGN.md.
npm install
TURF_DEV=1 ADMIN_INVITE=TEST-ADMN npm run devOpen http://localhost:3000 and sign up with invite code TEST-ADMN. That first account is the admin. Data goes to ./data/turf.db.
To turn on AI generation and marking locally, put AI_PROVIDER=claude and ANTHROPIC_API_KEY=... (or AI_PROVIDER=gemini and GEMINI_API_KEY=...) in .env. .env is git-ignored. Optional: AI_MODEL= to choose a different model.
| Path | What |
|---|---|
content/subjects/<id>.json |
Subject, exam date and time, regions (syllabus units) and tiles (topics) |
content/seed/<id>*.json |
Seed card banks. Format: content/CARD_SCHEMA.md |
content/mocks/<id>.json |
Timed practice papers with markschemes |
content/text/<id>/*.md |
Source text the AI marks against (teacher files, notes) |
content/tests/<id>.md |
Official test instructions (from Toddle) |
Seeds are upserted on every start, so pushing new content deploys it. Players' own cards live only in the database.
On the server, as root:
apt-get update && apt-get install -y git
ssh-keygen -t ed25519 -N "" -f /root/.ssh/turf_deploy -C turf-server && cat /root/.ssh/turf_deploy.pubAdd the printed key as a read-only deploy key at https://github.com/arusadusdg/turf/settings/keys, then:
GIT_SSH_COMMAND="ssh -i /root/.ssh/turf_deploy -o StrictHostKeyChecking=accept-new" git clone git@github.com:arusadusdg/turf.git /opt/turf && bash /opt/turf/deploy/bootstrap.shThe bootstrap script:
- adds 2 GB of swap;
- installs Node 22, Caddy, poppler and sqlite3;
- creates the
turfservice (systemd), the nightly backup timer (03:30, kept 14 days in/var/backups/turf) and the auto-deploy timer (pullsmainevery 2 minutes and rolls back if the health check fails); - sets up ufw to allow only ports 22, 80 and 443;
- prints the admin invite code.
Secrets live in /etc/turf.env. To add or change the AI key later:
bash /opt/turf/deploy/set-ai-key.sh claudeUseful commands:
journalctl -u turf -f # app log
journalctl -u turf-deploy -n 30 # deploys
systemctl list-timers 'turf*' # timersDNS at Porkbun: two A records, @ and www, both pointing to the server IP. Delete Porkbun's default parking ALIAS/CNAME records.