Builds / Gregdle

Gregdle

A daily GregTech guessing game with 209 machines, server-side answers, and a wiki data pipeline.

Language
TypeScript
Browser build
gregdle.carletti.work ↗
Updated
—
209machines
2difficulties
21tests
7migrations

What it changed

What building Gregdle taught me.

It is the smallest project here, but it touches scraping, validation, a database, a server API, and a live deployment.

01 / Product scope

Let the data change the plan.

The original plan had six datasets. The GTNH wiki had no material pages, so I dropped that dataset instead of forcing a scraper to invent structure. The decision log records what changed and why.

02 / Data pipeline

Treat scraped data as a product.

The machine pipeline caches wiki HTML, respects a slow crawl rate, normalizes infobox fields, validates everything with Zod, applies human overrides, and writes a quality report. 209 machines came through that process, not from runtime scraping.

03 / Server-side logic

Keep the answer off the client.

Guesses go to a Next.js route handler. It validates the request, resolves the daily or seeded answer, and returns only comparison cells. The anti-spoiler tests check that a wrong guess response never contains the answer id or name.

04 / Database boundaries

Put the secret behind the database.

Supabase holds entries, daily answers, results, and profiles. RLS keeps daily answers unreadable from the client, `pg_cron` generates them ahead of time, and leaderboard writes go through a server-validated RPC.

05 / Deployment

Debug the platform, not just the code.

Next.js 16 on Cloudflare through OpenNext built cleanly but returned 500 at runtime. The cause was `cacheComponents` expecting an incremental cache that the OpenNext dummy cache could not serve. Turning those flags off fixed it.

06 / Interface

Respond to how people actually play.

The first version imitated a GregTech GUI too literally: hard to read on a phone and too dependent on color. The redesign added a sticky guess column, horizontal scroll, icons and labels for every cell, and a clearer difficulty curve.

Still open

The next dataset.

v1 covers GTNH machines. GTCEu datasets, more mobile playtesting, and the remaining account and leaderboard polish are next. The game is live and the code is on GitHub.