A fast, serverless URL shortener service built with Rust and deployed on Cloudflare's global edge network. This service provides instant URL redirection with global low-latency access through Cloudflare's distributed infrastructure.
- Edge-first architecture: Deployed across Cloudflare's global network for minimal latency
- Rust-powered: Written in Rust and compiled to WebAssembly for maximum performance
- KV storage: Uses Cloudflare KV for persistent, globally distributed URL mappings
- Instant redirects: Sub-millisecond redirect responses from edge locations
- Observability: Built-in logging and monitoring through Cloudflare Workers
The service operates with a simple routing structure:
- Root path (
/): Redirects to a configured home URL (set viaHOMEenvironment variable) - Short URLs (
/:url): Looks up the URL parameter in Cloudflare KV storage and redirects to the target URL if found
URL mappings are stored in Cloudflare KV, allowing for:
- Global distribution and replication
- Fast lookup times from any edge location
- Persistent storage without managing databases
- Rust with
wasm32-unknown-unknowntarget - Wrangler CLI
- Cloudflare account with Workers and KV enabled
# Run local development server with file watching and hot reload
wrangler dev
# Deploy to Cloudflare Workers globally
wrangler deploy
# Build the project (compiles Rust to WebAssembly) - for testing only
wrangler deploy --dry-run --outdir=distEdit wrangler.toml to configure:
- Environment variables (like
HOMEredirect URL) - KV namespace bindings
- Workers deployment settings
- Runtime: Cloudflare Workers (V8 isolates)
- Language: Rust compiled to WebAssembly
- Storage: Cloudflare KV (globally distributed key-value store)
- Build: Uses
worker-buildfor optimized WASM compilation