• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
pchinjr

pchinjr

devfest26-raffle

Public
Like
devfest26-raffle
Home
Code
7
.vtignore
AGENTS.md
DOCS.md
README.md
deno.json
H
main.http.ts
server.ts
Environment variables
1
Branches
1
Pull requests
Remixes
History
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v34
View latest version
README.md

NorfolkJS Raffle (Val Town)

Dynamic raffle app built for Val Town with a public entry page and two admin views:

  • Admin Home: draw winners, view submissions, reset test data
  • Admin Manage: manage prize pool (add, rename, remove) and inspect submissions

Highlights

  • Dynamic prize pool (not hard-coded to 3 prizes)
  • One entry per email
  • Entrants can opt into one or more prizes
  • One winner per prize
  • A single entrant can only win once across all prizes
  • Mobile-friendly public and admin UI
  • Val Town blob-backed persistence with compatibility handling for older data shapes

Project Files

  • main.http.ts: main HTTP val (Hono app, routes, UI rendering, handlers)
  • server.ts: compatibility re-export
  • README.md: quickstart and operator usage
  • DOCS.md: architecture + API + reasoning guide

Run Locally (Deno)

deno run -A --watch main.http.ts

Open:

  • Public: http://localhost:8000/
  • Admin Home: http://localhost:8000/admin?key=<ADMIN_KEY>
  • Admin Manage: http://localhost:8000/admin/manage?key=<ADMIN_KEY>

Environment

Set admin auth key:

export ADMIN_KEY="devfest26"

In Val Town, set ADMIN_KEY in Environment Variables.

Route Overview

  • GET /: public entry page
  • POST /api/entries: create entry
  • GET /admin?key=...: admin home (draw/reset/overview)
  • GET /admin/manage?key=...: prize management + deep data view
  • GET /api/admin/state?key=...: admin data snapshot
  • POST /api/admin/draw?key=...: draw winner for one prize
  • POST /api/admin/reset?key=...: reset winners + entries
  • POST /api/admin/prizes?key=...: add prize
  • PATCH /api/admin/prizes/:prizeId?key=...: rename prize
  • DELETE /api/admin/prizes/:prizeId?key=...: remove prize

Deploy Notes (Val Town)

  • main.http.ts must be file type http
  • Keep admin links private (?key=...)
  • Use /admin/manage?key=... when changing prize pool

Data Keys

Blob keys used by this val:

  • devfest26_raffle_prizes_v1
  • devfest26_raffle_entries_v2
  • devfest26_raffle_winners_v2

Typical Operator Flow

  1. Open /admin/manage?key=... and set prize pool.
  2. Share public / page for entries.
  3. Use /admin?key=... during event to draw winners.
  4. Use reset only for test cycles.
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.