Inspiration
I wanted a daily puzzle that feels native to Reddit: quick to learn, satisfying to solve, and built around community — streaks, a leaderboard, and a spoiler-free score thread. RAYFOLD is an optical logic puzzle: fold one amber beam with mirrors to light three diamonds.
What I built
A Devvit Web app with an inline splash screen and an expanded Canvas game. Each UTC day, a deterministic 6×6 board is selected from a bank of 90 solver-verified puzzles. Players place / and \ mirrors (and use prisms) to light all three targets within a mirror budget. Par is the fewest mirrors required. After solving, players see their stats, streak, community heatmap, top-5 leaderboard, and can post a spoiler-free score comment as themselves into a single sticky score thread.
How it’s built
- Client: React 19, Tailwind CSS 4, Vite, and a Canvas renderer for the optical bench.
- Server: Hono on the Devvit serverless runtime, with server-authoritative solve validation.
- Shared: puzzle selection, beam tracing, solver, progress, and API contracts.
- Storage: Devvit Redis for daily state, leaderboard, heatmap, streaks, and share flags.
- Puzzles: 90 precomputed seeds in
src/shared/rayfold/seeds.json, selected by UTC date. Offline generator/validator — no runtime puzzle generation. - UX: Help/manual overlay, first-run auto-open, live goal strip, 44px minimum controls, zero-scroll layout, Precision Dark-Slate theme.
Challenges
- Designing the score-comment flow to be Reddit-compliant: explicit manual action, posted as the user, and replied to one app-created sticky thread.
- Keeping the board readable and solvable on mobile while preserving the optical aesthetic.
- Validating solves server-side so mirror maps and scores can’t be faked.
Reddit features used
Comments (score thread), subreddit leaderboard, streaks, community heatmap, moderator menu action, scheduler (daily post), and Devvit Redis.
Built With
- canvas
- devvit-web
- hono
- react
- redis
- tailwind-css
- typescript
- vite