SnapLink

TypeScript • Express • MongoDB • Redis

Short links without the usual friction.

Paste a long URL, generate a compact link, and redirect fast with Redis-backed lookups. Built as a clean service with layered architecture and dependency injection.

API surface 3 routes
Validation Zod schemas
Cache layer Redis first

Launch a short link

Try the live endpoint

The form sends a `POST /` request to the current server.

Why it feels fast

Cold data in MongoDB, hot paths in Redis.

Repeated redirects skip the database whenever the short code is already cached, reducing latency where it matters.

Architecture

Controllers, services, repositories.

The service is split into clear layers, which keeps the HTTP surface small and the business logic isolated from storage details.

Operational basics

Health checks built in.

Use /health for uptime monitoring while the main root endpoint stays focused on shortening links.

Minimal API

Everything important fits on one screen.

POST

/

Create a new short code from a valid long URL.

GET

/:shortUrl

Resolve the short code and redirect to the original destination.

GET

/health

Return a simple status payload for monitoring and deployment checks.

curl -X POST / \
  -H "Content-Type: application/json" \
  -d '{"longUrl":"https://example.com"}'