blog // · 2 min read

Cosmos Craft, seven million recipes and no server

Cosmos Craft is a daily crafting game where you combine water, fire, wind and earth. Here is how it serves 7.1 million recipes as static files, with no API at all.

Cosmos Craft is a daily crafting game in the spirit of Infinite Craft. You start with Water, Fire, Wind and Earth and drag two things together to see what they make. Every day there's a new target word, and the goal is to reach it in as few crafts as you can.

The usual way, and why I skipped it

Infinite Craft asks a language model what two things make. That's magical, but it means a server, a bill, and an answer that might change between players. I wanted something that costs nothing to run and gives everyone the same world, so Cosmos Craft has no API at all.

Recipes as files

The recipes come from a public crawl of Infinite Craft with 21 million combinations. That's too big to ship, so the build keeps every clean recipe whose two inputs are both among the 4,000 most-used elements. That leaves 7.1 million recipes and 250,000 things you can make.

Each pair is hashed into one of 4,096 shards of about 10 KB each. When you drop two things together, the game works out which shard holds that pair, fetches it once and caches it. The files never change, so the browser and the CDN can keep them for a year. Pairs outside the set say "Nothing formed", which is honest.

A fair daily target

Targets are common English words between 5 and 14 crafts deep. Before a word can be a target, the shortest route to it from the crawl is checked against the recipes the game actually ships, so par is always reachable. Your world carries over from day to day, with three save slots, so the more you play the shorter each new target gets.

Small things that matter

There's a blocklist for names nobody needs to see, a share line for your result, and a few console cheats (route shows you a path) for when you're stuck. It plays fine on a phone.

Play today's target, or try Slot Club if you'd rather race.

More from the blog

  1. Seventy design directions, one file each

    The camwooloo design gallery holds 60 home screens and 10 dashboards. Here are the rules behind it, from single-file pages with no images to a registry that keeps every design unique.

  2. Serving app downloads and auto-updates from my own site

    Why every camwooloo desktop app downloads and updates through camwooloo.com instead of GitHub, and how one small API keeps the newest release a single stable link.

  3. Building Slot Club, a slot-car club that plays in the browser

    How Slot Club fits 135 model cars, fourteen circuits and a track builder into one browser tab, and why it moved into camwooloo.com.