Public
Email collection form for NYU workshop
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.

NYU Workshop Email Collection

A simple fullstack form that collects email addresses for the NYU workshop. Built with Hono + Hono JSX on the server, Twind for styling, and Val Town SQLite for storage.

Routes

  • GET / — renders the email collection form
  • POST /submit — validates the email and inserts it into SQLite
  • GET /count — returns { count } of total stored emails (JSON)
  • GET /source — redirects to the val source on Val Town

Architecture

Rendering mermaid diagram...

Files

  • main.tsx — HTTP entrypoint, re-exports app.fetch
  • server/app.tsx — Hono app with all routes, uses Hono JSX to render pages
  • database/migrations.ts — creates the workshop_emails_v1 table
  • database/queries.tsaddEmail() and getEmailCount() helpers
  • frontend/Layout.tsx — shared HTML shell (Twind + catch script)
  • frontend/EmailForm.tsx — the form UI with optional error state
  • frontend/SuccessPage.tsx — confirmation page after submit

Schema

CREATE TABLE workshop_emails_v1 ( id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, created_at TEXT NOT NULL DEFAULT (datetime('now')) );

Emails are normalized to lowercase and trimmed before being stored. Duplicate submissions are silently treated as success thanks to the UNIQUE constraint.