Public
Remixed
✦ Cosmic Fortune — a tiny starfield oracle (web + JSON API)
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

✦ Cosmic Fortune ✦

A tiny oracle that hands you a cosmic fortune from the void. Tap the orb (or press Space) and the cosmos answers — over an animated, twinkling starfield rendered on a <canvas>.

Built on Val Town from the basic-html-starter, then taken somewhere stranger.

Live

  • Site: open the val's HTTP endpoint (main.tsx) in a browser.
  • API: GET /api/fortune{ "fortune": "...", "total": 20 }
  • Source: GET /source → redirects here.

How it works

Rendering mermaid diagram...

Files

FileRole
main.tsxHTTP entrypoint. Routes /source and /api/fortune, serves everything else statically.
fortunes.tsThe shared fortune deck used by the JSON API.
index.htmlPage markup — card, orb button, fortune slot, starfield canvas.
style.cssCosmic theme: gradients, glassmorphism card, pulsing orb.
script.jsClient logic: picks a fortune (no immediate repeats) + animates the starfield.
favicon.svgGradient star on a deep-space backdrop.

Make it yours

  • Add lines to both fortunes.ts (API) and the FORTUNES array in script.js (page) to keep them in sync.
  • Tweak the palette via the CSS custom properties at the top of style.css.

Inspired originally by https://glitch.new/blank — now thoroughly cosmic.