Skip to content
enrychPublic

About

Every letter counts!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Initle

Every letter counts. A phone-first party game for 2–10 friends: crack phrases from their initials and write fakes that fit the letters to fool your friends. Plus a solo Daily puzzle.

  • Party mode: private room with a 4-letter code or link. Rounds mix two types:
    • Crack it: initials are revealed in stages every 8s. Solve earlier for more points; correct words lock in green.
    • Fake it: everyone writes a believable fake that fits the letters, then votes for the real one.
  • Stage screen (/stage/CODE): a big read-only view for a TV or laptop, while phones act as controllers.
  • Daily (/daily): one puzzle a day, five guesses, a shareable emoji grid, streaks, and global stats.
  • Custom packs (/packs/new): paste a list of phrases and share it as a link.

The product spec is in the Claude doc Initle: Game & Tech Spec v2. Every implementation decision and tradeoff is logged in docs/DECISIONS.md.

Architecture

apps/web        React 19 + Vite + Tailwind 4 single-page app (phones, stage screen, Daily, packs)
apps/server     Cloudflare Worker: REST API + one Durable Object per room (partyserver) + D1
packages/core   Pure TypeScript game engine shared by both: reducer, views, matching, packs, protocol
  • Each room is a Durable Object that owns the authoritative state. It runs the pure reduce(state, action, now) from packages/core, persists after every change, schedules phase timers as DO alarms, and pushes a per-player view over WebSocket. Answers and other players' private text never leave the server.
  • D1 stores only custom packs, Daily stats and game summaries. Built-in packs ship in code.
  • The Worker serves the built SPA as static assets and handles /api/* and /parties/*.

Develop

Requirements: Node 22+, pnpm 10.

pnpm install
pnpm dev

pnpm dev runs the Worker on :8787 and Vite on :5173; Vite proxies /api and /parties to the Worker. Open http://localhost:5173 on your machine, and on your phone use your machine's LAN IP with port 5173.

Test

pnpm test
pnpm typecheck
pnpm e2e
  • pnpm test: unit tests for the engine (scoring, matching, round flow, privacy of views).
  • pnpm e2e: builds the app, starts a fresh local Worker, runs a WebSocket smoke test (3 bots play a full game) and a Playwright test (3 phones + stage screen play through the real UI, then the Daily and pack flows). Needs Playwright with Chromium available (npm i -g playwright && npx playwright install chromium). Set SHOTS=/some/dir to save screenshots of every screen.

Deploy (Cloudflare)

Deploys use Cloudflare's Git integration (Workers Builds): Cloudflare pulls this repo and builds it on every push to the production branch. No API tokens, no GitHub secrets.

One-time setup in the Cloudflare dashboard:

  1. Workers & Pages → Create → Import a repository, connect GitHub and pick enrych/initle.

  2. Settings:

    Field Value
    Project name initle (must match name in apps/server/wrangler.jsonc)
    Production branch main
    Build command pnpm build
    Deploy command cd apps/server && npx wrangler deploy
    Root directory /
  3. Save and Deploy. The first deploy creates the D1 database automatically (Wrangler automatic provisioning); the Worker creates its own tables on first use. The live *.workers.dev URL appears on the Worker's page.

Every later push to main redeploys. Write endpoints are rate-limited per IP by the Workers Rate Limiting binding (ratelimits in wrangler.jsonc: 20/min for creating rooms and packs, 60/min for Daily guesses). Durable Objects with SQLite storage, D1 and static assets all work on the Workers free plan for early traffic.

Friends and leaderboards

  • Players are identified by the random device token already kept in local storage (sent as x-initle-token, stored hashed in player_tokens). Others see a public 6-character friend code (players.id).
  • /friends: today's Daily with friends, friend code and invite link, add by code; Global tab with today's ranking, longest streaks and a "show me on global boards" toggle.
  • /f/:code: invite link. Opening it adds both players as friends and drops you into the Daily. The Daily share link is your invite link.
  • Scores are counted by the server (daily_results), one result per player per day, today's puzzle only. Ranking: solved, then fewest guesses, then fastest.
  • Signing in on other devices: Friends page → "Save your progress". A passkey (WebAuthn, via @simplewebauthn) or a 16-character recovery code links a new device's token to the same player (apps/server/src/auth.ts, apps/web/src/lib/auth.ts, test e2e/account.mjs with Chrome's virtual authenticator). Passkeys are bound to the site they were made on (initle.enry.ch).
  • Code: apps/server/src/social.ts, apps/server/migrations/0002_social.sql, apps/web/src/lib/social.ts, apps/web/src/pages/Friends.tsx. Test: e2e/friends.mjs.

Ads

Ads use Google's H5 Games Ads (Ad Placement API) and are on, with publisher ca-pub-4399872503638784. Code: apps/web/src/lib/ads.ts.

  • Where: an interstitial between Solo puzzles only. Party rooms, the stage screen and Daily stay ad-free.
  • Ad blockers: if Google's script can't load, ad breaks are skipped instantly and the game carries on.
  • Initle is the only Enrych site that serves ads. enry.ch keeps just the google-adsense-account meta tag and ads.txt for site ownership.
  • To build without ads, set VITE_ADSENSE_CLIENT=off. The local E2E run does this.
  • Privacy policy: /privacy (apps/web/src/pages/Privacy.tsx). EU/UK consent is handled by Google's consent message, set up in AdSense → Privacy & messaging.

Content

Built-in packs live in packages/core/src/packs-data.ts as [text, hint, aliases?] entries. Add entries there and run pnpm test: the tests check that every item produces valid initials.

License

All rights reserved © the Initle authors.

About

Every letter counts!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages