# Linky

> An open-source link shortener with branded QR codes, click analytics, link-in-bio pages, a REST API and signed webhooks, built in the AgentBuff family and released under the MIT license.

Shops, creators and students share links all day: in a bio, a WhatsApp broadcast or a printed menu. A long URL looks untidy, cannot change once it is printed and says nothing about who opened it, and hosted tools that fix this often keep custom slugs, analytics or branded QR codes behind paid plans. Linky puts all of it in one self-hostable app with no plan tiers in its code.

- No plan tiers in the code: custom slugs, branded QR codes, analytics and link-in-bio pages are open to every workspace.
- Webhooks are signed with HMAC-SHA256, and the target host is checked again before every delivery to block requests into private networks.
- Visitor IP addresses are stored only as salted hashes, and bot clicks are left out of every count.

- 146 unit tests, all passing
- 9 REST API v1 operations
- 8 link-in-bio block types

- Role: Author and maintainer
- Company: AgentBuff
- Period: Apr to Jun 2026
- Stack: Next.js 15, React 19, TypeScript, PostgreSQL, Drizzle ORM, Tailwind CSS 4, Docker, GitHub Actions
- Code on GitHub: Linky-Agentbuff (https://github.com/nugrahalabib/Linky-Agentbuff)

## The problem

Small businesses, creators and students share links all day: in an Instagram bio, a WhatsApp broadcast, a TikTok profile or a printed flyer. A long URL looks untidy, cannot be changed once it is printed, and says nothing about who opened it.

Hosted link shorteners solve part of this, but **custom slugs, detailed analytics, branded QR codes and link-in-bio pages often sit in different tools or behind paid plans**. Leaving one shortener also means retyping every old link, and developers who want to create links from their own systems, or react when a link is clicked, need an API and webhooks rather than a dashboard-only tool.

*What changes with Linky*

| Before | With Linky |
| --- | --- |
| A long URL pasted into a bio or a broadcast message | A short link with a readable slug whose destination can change later |
| A plain QR code from a free generator, fixed to one URL | A branded QR code with colours, a logo and a frame text, pointing at an editable short link |
| No idea who opened the link | Clicks, unique visitors, countries, devices, browsers and referrers, with bot clicks filtered out |
| A separate tool for the link-in-bio page | A Linky Page in the same workspace, built from blocks with a live phone preview |
| Leaving another shortener means retyping every link | A CSV import that recognises exports from 5 shorteners, up to 10,000 rows at a time |

## Who it is for

I wrote Linky for Indonesian creators, marketers, students and small businesses, so the interface is in Bahasa Indonesia. Creating a link needs an account by design, signed in with Google, so every link belongs to someone who can be traced.

*Who uses Linky and how*

| Who | What they do |
| --- | --- |
| Shop or creator | Makes short links and QR codes for menus, promos and events, and builds one link-in-bio page for social profiles |
| Marketer | Organises campaign links with folders, tags and saved UTM recipes, tests two landing pages with an A/B split, and reads clicks by country, device and referrer |
| Developer | Creates an API key, calls the REST API from a script or backend, and receives signed webhook events when links are created or clicked |
| Visitor | Opens a short link and lands on the right page for their phone, country or variant, or meets a password gate or an expiry page |
| Self-hoster | Runs the Docker image with PostgreSQL and a Google OAuth client on their own server and domain |

## From a long URL to a click report

**One link in Linky** (Every click is recorded in the background, so the visitor is never kept waiting.)
1. Sign in: Google sign-in creates a personal workspace
2. Create a link: Slug, folder, tags, password or expiry
3. Brand the QR: Colours, logo and frame text, PNG or SVG
4. Visitor clicks: Rules pick the right destination
5. Click recorded: Bots left out, webhook sent
6. Read the results: Trend, top links and breakdown

When a visitor opens a short link, Linky first checks whether it has expired, passed its click limit or needs a password. Then it picks the target in a fixed order: **the A/B variant, then a country rule, then the iOS or Android link, then the main destination**, appends any UTM parameters and answers with a redirect. The same visitor always gets the same A/B variant, because the choice comes from a hash of the link and the visitor.

## Inside the product

The screenshots below come from a local run of the public repository with invented demo data for a fictional coffee shop, Kedai Rasa. Every click count in them is synthetic.

**Analytics**
The analytics page shows a workspace or a single link over 7, 30 or 90 days: totals, unique visitors, the daily average, a click trend, the top 10 links and the breakdown by country, referrer, device and browser. Unique visitors are counted from salted IP hashes, never raw addresses.

*Clicks by country, referrer, device and browser, on invented demo data.*

**Links and targeting**
A link needs only a destination. Everything else is optional: a custom slug, title, folder and tags, a password, an expiry by date or click count, app links for iOS and Android, and UTM values from a saved recipe. The targeting tab adds an A/B split across up to 4 weighted variants and up to 20 country rules.

*An A/B split with two weighted variants for one link.*

**QR studio**
Five presets give a starting look; then colours, a gradient, square, rounded or dotted modules, a centre logo, a frame text and the size can be changed. Codes use the highest error correction level, so a logo in the middle still scans, and they download as PNG or SVG.

*QR studio with the Sunset preset, rounded modules and a frame text.*

**Linky Page**
A Linky Page is a public link-in-bio page. The editor sets the title, bio, avatar and theme, and stacks 8 block types (header, link button, social icons, text, divider, YouTube, image and countdown) while a phone preview updates beside it. There are 5 theme presets and 4 button styles, and content is sanitised both when it is saved and when it is shown.

*Linky Page editor with the UMKM theme and a live phone preview.*

**CSV import**
The import wizard moves links in from Bit.ly, Rebrandly, TinyURL, Dub.co and Short.io in three steps: upload, map columns, review. It detects the provider from the headers, maps more than 50 column names to Linky fields and lets the user fix the mapping. Slug conflicts can be skipped, renamed or made to stop the import.

*Step two of the import: an invented Bit.ly export detected and mapped.*

## Built for other systems too

A link manager becomes far more useful when scripts, backends and AI agents can drive it. Linky has a public REST API and webhooks so that other systems can create links and react to clicks without anyone opening the dashboard.

*API keys, shown by prefix only, with last use and expiry.*

- **REST API v1**: 9 operations for links, analytics, QR codes and key checks, described in an OpenAPI 3.1 file.
- **Keys**: shown in full once and stored only as a SHA-256 hash; they can expire and are limited to 120 requests per minute.
- **Webhooks**: four link events, signed with HMAC-SHA256, retried after 1, 5 and 30 minutes, with the last 50 deliveries logged.
- **Docs**: a public page with five recipes and signature checks in Node.js, Python and PHP.

## How it is built

Linky is one Next.js 15 app in strict TypeScript: the dashboard, the redirect route, the public pages and the API share one build and one deploy. Data lives in PostgreSQL through Drizzle ORM across 18 tables. The project started on SQLite and moved its runtime to PostgreSQL, using a pure JavaScript driver so there is no native binding to build.

- Own sessions: A sessions table plus a signed cookie, so every device can be listed and signed out, and sessions last 30 days.
- Strict page policy: Pages get a Content-Security-Policy with a fresh nonce per request in production.
- Safe bio pages: Links must be http(s), mailto or tel and colours hex only, checked when saved and again when shown.
- No private targets: Webhook URLs that point to loopback, private or cloud metadata addresses are refused at registration and after DNS resolution.
- Verified emails only: A Google identity joins an existing account only when the provider marks the email as verified.
- Fast redirects: The redirect answers first and the click is written in the background, so logging never slows the visitor.

**146 unit tests in 51 suites** run on Node's built-in test runner and cover slugs, link resolution, CSV mapping, QR output, sign-in, URL safety and validators; all of them passed when I re-ran them on 26 November 2026. CI runs lint, type checks, the tests, a production build and an npm audit that fails on high or critical issues, plus Gitleaks secret scanning. For self-hosting, the repo carries a Docker image that runs as a non-root user and a deploy workflow that backs up the database, migrates, starts the app and rolls back if the health check fails.

**At a glance**
- License: MIT
- Built: April to June 2026, 64 commits
- Interface: Bahasa Indonesia
- Data: PostgreSQL with Drizzle ORM, 18 tables
- API: REST API v1, OpenAPI 3.1, signed webhooks
- Tests: 146 unit tests, all passing
- Hosting: Self-hosted with Docker; no public instance yet

**Want links, QR codes and analytics on your own server?** I build tools that people and AI agents can both use safely, from short links to full business systems.

Source: https://nugrahalabib.com/work/linky
Author: Nugraha Labib Mujaddid (https://nugrahalabib.com)
Published: 2026-11-27. Updated: 2026-11-27.
