DEV Community

Sathvic Kollu
Sathvic Kollu

Posted on

Introducing Slug API — Unicode URL slugs in one call, on the Cloudflare edge

The problem

Every CMS, blog engine, and e-commerce site needs URL slugs. Every one of them re-implements slugify. And most implementations break the moment someone types München or café.

The API

One endpoint. Handles Unicode properly. Sub-100ms globally.

curl 'https://slug-api.techtenstein.workers.dev/?text=Hello%20World%202026'
# {"slug":"hello-world-2026","length":16,"processing_ms":0}
Enter fullscreen mode Exit fullscreen mode

Unicode is the differentiator

Most slugify libraries strip accented characters. Ours transliterates them properly:

curl 'https://slug-api.techtenstein.workers.dev/?text=M%C3%BCnchen%20Stra%C3%9Fe%20caf%C3%A9%20se%C3%B1or'
# {"slug":"muenchen-strasse-cafe-senor"}
Enter fullscreen mode Exit fullscreen mode

Notice: Münchenmuenchen (not mnchen), Straßestrasse (not strae), cafécafe, señorsenor.

Configurable

curl 'https://slug-api.techtenstein.workers.dev/?text=The+quick+brown+fox+jumps&max=20&sep=_'
# {"slug":"the_quick_brown_fox"}
Enter fullscreen mode Exit fullscreen mode
  • max — length cap, cleanly truncated at word boundary
  • sep — separator character
  • lower — case control

POST support for larger inputs

curl -X POST https://slug-api.techtenstein.workers.dev/ \
  -H 'Content-Type: application/json' \
  -d '{"text":"Blog post with emoji ✨ and \"quotes\"", "max":40}'
Enter fullscreen mode Exit fullscreen mode

How it's built

  • Deploy target: Cloudflare Workers (single-file JS, module syntax)
  • Total code: ~120 lines
  • Cold start: none — Workers keep JS warm at every edge
  • Latency: 60-120ms globally (p50 68ms in test)
  • Cost: free 100K req/day, then $5/mo for 10M

Free vs. paid

Try it

👉 slug-api.techtenstein.workers.dev

Docs live at that URL. Zero signup for the free tier.

Top comments (0)