hoangsonww/PuzzleForge-Game-Hub

Daily Wordle mode + streaks + shareable results (emoji grid)

Open

#3 opened on Nov 2, 2025

 (0 comments) (0 reactions) (1 assignee)TypeScript (5 forks)auto 404
bugdocumentationenhancementgood first issuehelp wantedquestion

Repository metrics

Stars
 (14 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

Add a true “daily Wordle” experience on top of the existing random-word mode:

  1. same word for everyone on a given day (UTC or configurable),
  2. per-user streak tracking in localStorage,
  3. “Share” button that copies the classic emoji grid (🟩🟨⬛) without revealing the word.

Right now the app is great for unlimited play, but it doesn’t give the “I solved today’s Wordle in 4 🥲” vibe.


Why

  • Wordle’s stickiness = daily word + streak + humblebrag.
  • You already have backend endpoints (/api/random-word, /api/word-valid/:word), so small backend tweak → daily word endpoint.
  • LocalStorage = no auth needed.

Tasks

1. Backend: add daily-word endpoint

  • New route: GET /api/daily-word

  • Logic:

    • Use a deterministic seed = date (e.g. YYYY-MM-DD).
    • Pick a word from the existing word list using that seed.
    • Return { "word": "<5-letter-word>", "date": "2025-11-02" }.
  • Must be consistent for the whole day.

  • Add to Swagger (/api-docs) just like the other two endpoints.

If backend can’t reach remote list, fall back to in-memory list (same behavior as random).

2. Frontend: daily mode toggle

  • In the main game screen, add a small toggle / tabs:

    • Daily
    • Free play (current behavior)
  • When Daily is selected:

    • Fetch /api/daily-word
    • Lock the word for the session (don’t re-fetch on every guess)
    • If user has already finished today → show their result + “come back tomorrow”

3. Streak tracking (localStorage)

  • Key idea: wordle-stats = { currentStreak, maxStreak, lastPlayedDate, gamesPlayed, wins }

  • On a win in Daily mode:

    • If lastPlayedDate is yesterdaycurrentStreak++
    • Else → currentStreak = 1
    • Update maxStreak
    • Set lastPlayedDate = today
  • On a loss in Daily mode:

    • currentStreak = 0
    • Still update lastPlayedDate = today
  • Store in localStorage so browser remembers.

4. Shareable results (emoji grid)

  • After win/loss in Daily mode, show a button:

    • “Share today’s result”
  • It should copy to clipboard something like:

    Wordle (SymptomSync fork) 2025-11-02
    4/6
    🟨⬛⬛⬛⬛
    🟩🟨⬛⬛⬛
    🟩🟩🟨⬛⬛
    🟩🟩🟩🟩🟩
    https://the-wordle-game.vercel.app/
    
    • Use 🟩 for correct position, 🟨 for present, ⬛ (or ⬜) for absent.
    • Don’t include the actual word.
    • If clipboard fails, show the text in a modal.

5. UI polish

  • Show tiny badge like “Daily #123” → number = day offset from an epoch (e.g. 2025-01-01).
  • Show streak + best streak somewhere in the header / stats modal.

Acceptance Criteria

  • GET /api/daily-word returns same word for the whole day and is documented in Swagger.
  • User can switch between Daily and Free play without refreshing.
  • Finishing Daily mode updates streak in localStorage.
  • Share button copies emoji grid reflecting current game.
  • CI passes (lint + tests).
  • README.md updated with “Daily Mode” section.

Notes / Hints

  • Deterministic pick example (pseudocode):

    const dateKey = new Date().toISOString().slice(0, 10); // "2025-11-02"
    const index = simpleHash(dateKey) % words.length;
    const wordOfTheDay = words[index];
    
  • Keep daily list and random list in sync → reuse existing word list loader.

  • Make sure daily mode still works on Vercel (serverless) → no in-memory state. Deterministic is the way.

Contributor guide