Clew is a small URL shortener with a JSON API. Send a destination to /api/links and it returns a short URL. Following that URL sends a 302 redirect and records the visit.
For concurrent visits, each redirect starts a BEGIN IMMEDIATE transaction before updating the total and storing the click time. Clew keeps the total count and the newest 20 timestamps. A HEAD request checks the destination without adding a click.
Create and stats requests need an API key; redirects are public. It runs as one app instance with a persistent SQLite file. The repo has local setup and Docker instructions, and the API docs are online.
Top comments (0)