Building a daily word game as one page

Everything a daily puzzle needs is in the browser. The date supplies the answer.

A daily word game is a single page. Every part people assume needs a server has a browser answer.

The parts of a daily puzzle and where each one lives.
The parts of a daily puzzle and where each one lives.

The answer comes from the date

Put a word list in the page. Count the days since a fixed starting date and use that number to choose a word.

Everybody loading the page on the same day gets the same puzzle, with nothing stored anywhere and no request made.

Tomorrow it changes by itself, indefinitely, with nobody doing anything.

Part Where it lives
The word list In the page
Today's answer Derived from the date
Your progress Browser storage
Your streak Browser storage
Share text Generated in the page
A leaderboard Would need a server

Progress in browser storage

Browser storage keeps what somebody did, on their device, between visits.

Which guesses they made today, whether they finished, how many days in a row. Enough for streaks and for stopping somebody replaying the same puzzle.

It is per device and per browser, so a streak does not follow somebody to their phone. For a puzzle, that is an acceptable limit, and removing it means accounts, a server and a different project.

Fix the time zone

The common fault.

If the day is derived from the visitor's local midnight, players in different places get different puzzles, and anybody sharing a result confuses somebody who has not reached that day yet.

Count days from a fixed reference in one time zone. Everybody plays the same puzzle, some of them at an odd hour.

A generated share result showing coloured squares with no letters.
A generated share result showing coloured squares with no letters.

The share text

The part that made the format spread.

The page produces a small block of text: the puzzle number, the number of guesses, and a grid of coloured squares showing the pattern without revealing any letters.

It is generated and copied to the clipboard. Nothing is uploaded and nothing is spoiled, which is why people post it.

Visible answers

Somebody can open the developer tools and read the word list.

This is true of every puzzle that runs in a browser, including the well-known ones, and it matters far less than it seems. Anyone who does that has chosen not to play, which is their business.

Do not build a server just to hide a five-letter word.

The word list is the game

The mechanics are a weekend. What makes a puzzle worth returning to is the words.

A list drawn from a specific community, a workplace, a sport, a field, a fan base, is far more compelling than a general dictionary, because the words are recognised and the near-misses are funny.

That is also the only part you cannot copy from anybody else.

Two neighbouring cases are worth a look: Making a branching story people can read and How to host a game online.

Put it at an address

Derive the answer from the date, keep progress in browser storage, fix the time zone to one reference, generate the share text in the page, and spend your effort on the word list.

Questions people ask

Does a daily puzzle need a server?

No. Derive the answer from the date against a word list in the page, keep progress in browser storage, and there is nothing to run.

Can somebody read the answer from the page?

Yes, and it matters less than you expect. Anyone determined enough to open the developer tools was not going to play honestly anyway.

How does the shareable result work?

It is generated text with coloured squares and no letters. The page builds it and copies it to the clipboard.

Why do people see different puzzles?

Time zones. Derive the day from a fixed reference in one zone rather than from the visitor’s local midnight.

What makes one worth playing twice?

A word list that fits the audience. A puzzle for a specific community beats a general one, because the words mean something.

Keep reading