Show HN: TrustBit – Building a URL shortener with Cloudflare's edge stack
by TerrenceTian | 2025-08-11 06:35:53+00:00
A technical deep-dive into architecting a reliable URL shortener using Hono, Next.js 15, and Cloudflare Workers

## What We Built

TrustBit is a URL shortener that prioritizes reliability over features. After getting burned by links breaking on existing services, we decided to build something that just works.

*Live demo*: https://trustbit.me *Tech stack*: Hono + Cloudflare Workers (API), Next.js 15 (frontend), D1 (SQLite), KV storage, TypeScript throughout

## Why Another URL Shortener?

Honestly, we didn't plan to compete with Bitly. We just got tired of: - Links suddenly breaking when services change their terms - Ads being injected into redirects - "Free" tiers disappearing overnight

So we built what we wanted: transparent pricing, no ads, and infrastructure designed not to disappear.

## What We Learned

### 1. Edge-native architecture requires rethinking patterns Traditional database + cache patterns don't work well with eventual consistency. We had to embrace optimistic updates and design for network partitions.

### 2. Cloudflare Workers are surprisingly capable We were skeptical about the 10ms CPU limit, but proper async patterns and efficient algorithms make it work. Our average CPU time is 3-5ms per request.

### 3. TypeScript everywhere pays off Sharing types between frontend/backend/workers eliminates entire classes of bugs. Our error rate dropped significantly after we went full TypeScript.

### 4. Developer experience matters for solo projects Hono's API design is clean enough that we can context-switch between frontend and backend work efficiently. This matters when you're a small team.

## Current Status & Future

*Metrics so far*: - 120+ users across free and paid tiers - 99.97% uptime - ~50ms average global response time

*What's next*: - Analytics dashboard (in beta) - API for programmatic link creation - Bulk operations for enterprise users

We're intentionally growing slowly. The goal isn't to become the next unicorn—it's to build something that works reliably for people who depend on their links.

## Technical Takeaways

If you're building on Cloudflare Workers:

1. *Embrace the constraints*: 10ms CPU limit forces good architecture 2. *KV is your friend*: But design for cache misses 3. *D1 eventual consistency*: Plan for it, don't fight it 4. *Bundle size matters*: Every KB counts on edge workers

The full stack feels like the future of web apps: globally distributed, serverless, and surprisingly affordable at scale.

## Open Questions

We're still figuring out: - Best practices for D1 schema migrations in production - How to handle analytics at scale without blowing the KV budget - Whether edge-first architecture is worth the complexity for smaller apps

Would love to hear from others building on similar stacks. What patterns have you found that work well?

---

Built by a small team who got tired of unreliable infrastructure. We're trying to solve the "URL shortener problem" with boring, reliable technology rather than fancy features.

*Try it*: https://trustbit.me (free tier, no credit card) *Tech questions*: Happy to answer in the comments