A minimal, refined link shortener where users enter "magic words" instead of cryptic codes.
Live: magicword.val.run
Traditional link shorteners produce URLs like bit.ly/3xK7m2Q — functional but forgettable. Magic Word reimagines this as a human-first experience:
Traditional: brand.com/promo?code=xK7m2&utm_source=twitter&utm_medium=...
Magic Word: "The magic word is SUMMER" → redirects to your campaign
The interface is radically minimal: a single text input asking "What is the magic word?" Nothing else. Enter a word, get redirected. That's it.
The same input field handles everything:
| Input | Action |
|---|---|
summer | Look up magic word → redirect |
please | Open create/management UI |
a] | Verify admin key → edit/delete UI |
| Tier | Format | Example | Price |
|---|---|---|---|
| Free | Two-word compound | crystal-beacon, amber-grove | £0 |
| Premium | Single dictionary word | summer, free, win | £12/year |
Free-tier compounds are surprisingly brandable ("thundercat", "moonpie") while keeping the namespace virtually unlimited (~576 combinations from current word lists).
Every lookup requires a proof-of-work computation, preventing enumeration attacks:
SHA-256(nonce:word:counter) until hash has N leading zerosWhy this works:
Each magic word gets a UUID admin key on creation. This key:
┌─────────────────────────────────────────────────────────┐
│ Val.town Edge │
│ ┌─────────────────────────────────────────────────┐ │
│ │ main.tsx (HTTP handler) │ │
│ │ - Serves HTML UI with embedded challenge │ │
│ │ - API routes for CRUD + PoW verification │ │
│ │ - Server-side React rendering │ │
│ └─────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Val.town SQLite │ │
│ │ - magic_words table (word, url, admin_key_hash)│ │
│ │ - pow_challenges table (one-time use tokens) │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
Client-side PoW computation
(SHA-256 in browser, ~200-500ms)
CREATE TABLE magic_words (
id INTEGER PRIMARY KEY AUTOINCREMENT,
word TEXT UNIQUE NOT NULL, -- "summer" or "crystal-beacon"
url TEXT NOT NULL, -- destination URL
admin_key_hash TEXT NOT NULL, -- SHA-256 hash of admin UUID
tier TEXT NOT NULL, -- "free" or "premium"
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
expires_at DATETIME, -- NULL for free tier
redirect_count INTEGER DEFAULT 0 -- analytics
);
CREATE TABLE pow_challenges (
id TEXT PRIMARY KEY, -- UUID
nonce TEXT NOT NULL, -- random string for PoW
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
used BOOLEAN DEFAULT FALSE -- one-time use enforcement
);
| Method | Path | Purpose |
|---|---|---|
GET | / | Serve HTML UI with fresh PoW challenge |
GET | /api/challenge | Issue new PoW challenge |
POST | /api/lookup | Look up word (requires PoW proof) |
POST | /api/create | Create new magic word |
POST | /api/verify-admin | Verify admin key, return word details |
PUT | /api/update | Update URL (requires admin key) |
DELETE | /api/delete | Delete word (requires admin key) |
It's a delightful easter egg that teaches the interface paradigm. The small cost (one reserved word) is worth the whimsy. Users remember it.
Single words are valuable namespace ("free", "win", "sale") and should be monetized. Compound words like "crystal-beacon" or "amber-grove" are:
Rate limits can be bypassed with distributed IPs or slow enumeration. PoW makes enumeration economically infeasible regardless of how it's distributed. The computation cost is fundamental, not infrastructural.
The magic word IS the link. You share the word, not a URL. "The magic word is SUMMER" is the entire instruction. The URL is just magicword.info (or wherever it's hosted).
yourbrand.com/magic → magic word lookupThis is a single-file Val.town project. To modify:
main.tsx in the Val.town web editorTo run locally (if extracted):
# Would require Deno + SQLite setup # Val.town handles all this automatically deno run --allow-net --allow-env main.tsx
Built with Val.town — serverless TypeScript with built-in SQLite.
Inspired by the elegance of promo codes and the frustration of ugly URLs.
MIT — do whatever you want with it.