• 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: v73
View latest version
README.md

NorfolkJS Raffle (Val Town)

Raffle app for live events with:

  • Public entry page (/)
  • Public live odds board (/odds)
  • Admin Home (/admin?key=...) for draw/reset
  • Admin Manage (/admin/manage?key=...) for prize CRUD and submission review

Current Behavior

  • Dynamic prize pool
  • One entry per email (enforced server-side)
  • Each entrant gets exactly N tickets where N = number of prizes
  • Tickets are allocated per prize via - / + controls
  • Submission is only valid when all tickets are allocated
  • Winner selection is weighted by ticket count for that prize
  • A person can only win once across different prizes
  • Redraw supported for no-show winners

Local Run (Deno)

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

Open:

  • Public entry: http://localhost:8000/
  • Live odds: http://localhost:8000/odds
  • 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="replace-with-your-own-secret"

In Val Town, add ADMIN_KEY in Environment Variables.

Routes

  • GET /: raffle entry UI
  • GET /odds: public live odds board
  • POST /api/entries: create entry
  • GET /api/odds: anonymous odds + winner state JSON

Admin-protected (?key=... required):

  • GET /admin: draw + redraw + reset + submissions
  • GET /admin/manage: prize management + detailed submissions
  • GET /api/admin/state: admin snapshot
  • POST /api/admin/draw: draw winner for one prize
  • POST /api/admin/redraw: redraw winner for one prize
  • POST /api/admin/reset: clear entries + winners
  • POST /api/admin/prizes: add prize
  • PATCH /api/admin/prizes/:prizeId: rename prize
  • DELETE /api/admin/prizes/:prizeId: remove prize

Blob Storage Keys

Current canonical keys:

  • devfest26_raffle_prizes
  • devfest26_raffle_entries
  • devfest26_raffle_winners

Operator Flow

  1. Configure prizes in /admin/manage?key=...
  2. Share / for entries and /odds on screen
  3. Draw from /admin?key=...
  4. If winner is absent, use Redraw for that prize
  5. 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.