Public
Short links that self-destruct in 48 hours.
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.

Ephemeral Links

A small Val Town shortener that creates self-destructing links backed by Val Town SQLite.

Behavior

  • GET / renders the landing page and simple API docs.
  • POST / accepts either application/json or URL-encoded form data with a url field.
  • GET /:code redirects to the original URL while the record is still valid.
  • Links expire automatically after 48 hours; expired records are purged on create/read.

Files

  • main.ts — request handler, SQLite schema, HTML responses, and redirect logic.
  • style.css — stylesheet served from /style.css.

Storage

The val stores short-link records in Val Town SQLite using the short_links table. No extra environment variables are required.

Local workflow

From vals/:

deno task check

From vals/ephemeral-links/:

vt status vt push --dry-run