▢ Case study · 2026
Linkora
A self-hostable URL shortener with click analytics. Redirects are served from Redis in milliseconds, while clicks flow through a Redis Stream into pre-aggregated MongoDB rollups.

- Role
- Solo full-stack developer
- Year
- 2026
- Timeline
- Sep to Oct 2026
- Built with
- ReactViteTailwind CSSZustandNode.jsExpressMongoDBRedisRedis StreamsVitestGitHub ActionsRenderVercel
01
The problem
A URL shortener looks simple: take a short code, redirect to a long URL. The hard part is analytics. If every redirect writes click data to the database before responding, redirects slow down as traffic grows, and a busy link can hammer the database.
Shorteners are also a favorite tool for abuse. They can point at phishing pages or internal network addresses, and webhooks can be turned against private services. I wanted to build one where redirects stay fast under load, analytics stay accurate, and those abuse paths are closed.
02
What he built
Linkora is a URL shortener with click analytics, a developer API and a React dashboard.
Redirects
HTTP 307 redirects served from a Redis cache, with negative caching for unknown codes
Separate iOS and Android destinations, chosen by user agent
Weighted A/B splits between destinations, sticky per visitor
Password-protected links that exchange the password for a 60-second single-use token, so it never appears in a URL
Click caps, expiry dates and QR codes
Analytics
Hourly and daily rollups with 24h, 7d, 30d and 90d views
Country and city from GeoIP, browser, OS and device parsing, and bot flagging
Streaming CSV export of raw click events
Developer platform
Scoped API keys with per-key token-bucket rate limits
An OpenAPI reference
An in-browser CLI terminal with tab completion
Signed webhooks with delivery logs, replay, pause and resume, and secret rotation
Architecture. The redirect never waits on analytics. The API answers from Redis, sends the redirect, and only then appends the click to a Redis Stream. A separate consumer reads the stream in batches of up to 500, enriches each event, writes to MongoDB, and only then acknowledges it.
03
The hard parts
Keeping redirects fast. A cached redirect sends exactly two Redis commands (one read and one stream append) and makes no MongoDB calls. An integration test pins that command count, so a future change can’t quietly slow the hot path.
Exactly-once analytics. If the consumer crashes mid-batch, those clicks get processed again. So every write goes through a processed-events ledger, which makes replays idempotent. Batches from crashed consumers are reclaimed automatically, and any number of consumers can share the work.
Cache stampedes. When a popular link’s cache entry expires, hundreds of requests can hit the database at once. I implemented XFetch (probabilistic early expiration) with a Redis lock. One request refreshes the entry in the background while the rest are served from cache.
Short codes without collisions. Codes come from an atomic counter, reserved in blocks of 1,000 per instance. Each number is scrambled with a 4-round Feistel network and encoded as six Base62 characters, so codes are unique without retries and don’t reveal creation order.
Security.
Sessions: the access token lives only in memory, and the refresh token is an HttpOnly cookie rotated on every use. Reusing an old token revokes the whole token family.
SSRF: every destination is checked on create and update, and its resolved address must not be private, loopback or link-local, including the cloud metadata address.
Webhooks: DNS is re-resolved before each delivery and the connection goes to the validated IP. Payloads are signed with HMAC-SHA256, and signing secrets are encrypted with AES-256-GCM.
Rate limiting: an atomic Redis Lua sliding-window limiter, so concurrent instances can’t overshoot a limit
Reliable webhooks. Deliveries are queued in MongoDB and claimed by workers with leases, so a crashed worker loses nothing. They retry up to 10 times over about 23 hours with jittered backoff. A per-endpoint circuit breaker pauses deliveries while an endpoint is down.
04
How it turned out
Linkora is live at linkora.piyushydv.com (opens in a new tab), with the frontend on Vercel and the backend on Render. It runs entirely on free tiers, and CI runs on every push.
6,902 redirects per second with 0 errors across 69,017 requests in a local benchmark (p50 latency 11 ms, p99 48 ms)
99.8% less database load during a 500-request cache stampede with XFetch: 1 database call instead of 500
About 49K lines of code with 77 test files
58 deployments and 73 commits
This project taught me to keep the critical path tiny and push everything else into asynchronous, idempotent work.
Gallery · 8







