iShortn
Short links that track every click. Create branded short links with powerful analytics, QR codes, UTM templates, custom domains, and more.
ishortn.ink ·
About ·
Features ·
Screenshots ·
Tech Stack ·
Getting Started ·
Contributing
Try it: hosted version at https://ishortn.ink (free plan), or the no-account QR code generator at https://ishortn.ink/qr-code-generator/logo
> **Self-hosting at a glance**
>
> - Runs as one Cloudflare Worker and needs the [Workers Paid plan](https://developers.cloudflare.com/workers/platform/pricing/) (KV, Hyperdrive, Queues and a raised CPU limit).
> - Needs a MySQL 8 database Cloudflare can reach, and a Clerk application for sign-in.
> - There is no Docker image (`compose.yaml` is only for local development); you deploy from a clone with `bun run deploy`.
>
> Full steps: [self-hosting guide](./docs/self-hosting.md).
## About
iShortn is an open-source (MIT) link shortener with custom domains, editable QR codes, bio pages and click analytics.
Use it for marketing campaigns, product onboarding, event tracking, newsletter links, QR codes on printed material, or as a self-hosted alternative to proprietary shorteners.
## Features
### Link management
- Custom short aliases and friendly names
- Custom domains
- Password-protected links
- Expiration dates and click limits
- One-click deactivation
- Folders to organise links
- UTM builder and reusable templates
- Bulk CSV import and export
- Full REST API for links
### QR codes
- Dynamic QR codes you can edit after printing, with logo overlay
- Static Wi-Fi, email, SMS, phone and text codes
- Hosted contact-card codes that stay editable
- One QR code for several links (opens a bio page)
- Bulk QR codes from a CSV import, downloaded as a ZIP of SVG and PNG files
- Print-ready PDF at an exact size
- Broken-destination checks for QR code links, with an alert email
### Bio pages
- Link-in-bio pages with tracked link blocks
- Import from a Linktree page: title, photo, social icons and links, with a tracked short link for each link
### Analytics
- Total clicks and unique visitors
- Human clicks (browsers and apps) shown apart from scripts and bots
- Country, region, and city breakdowns
- Device, OS, and browser stats
- Referrer and source tracking, with in-app browsers (Instagram, TikTok) and QR scans credited to the right source
- Time-series click charts
- Per-link dashboards
- Shareable read-only stats pages
- Scheduled email reports
- Privacy-friendly tracking (no third-party cookies)
### Integrations
- Remote MCP server at `/mcp` (MCP Registry: `ink.ishortn/mcp`), using the same API keys as the REST API
- Signed webhooks (HMAC-SHA256 over timestamp and body, retried for 24 hours)
- Browser extension for Chrome and Edge
### Free tools (no account needed)
- [QR code generator with logo](https://ishortn.ink/qr-code-generator/logo)
- [Bulk QR code generator](https://ishortn.ink/qr-code-generator/bulk) (up to 500 codes)
- [URL expander](https://ishortn.ink/url-expander)
- [UTM builder](https://ishortn.ink/utm-builder)
### Platform
- Authenticated workspaces via Clerk
- Team workspaces with team API keys
- Subscription billing with Lemon Squeezy
- Transactional email via Resend and React Email
- S3-compatible object storage via Cloudflare R2
- Dark and light themes
- Safety checks on new links; live links re-checked against phishing feeds and Google Safe Browsing every 6 hours, and refused links can be sent for manual review
## Screenshots
### Dashboard
Manage all your links, filter by status and tags, and see click counts at a glance.
### Analytics
Per-link analytics with click volume over time, unique visitor counts, and geography and device breakdowns.
## Tech Stack
- **Framework** — [Next.js 15](https://nextjs.org) (App Router, Turbopack) on [React 19](https://react.dev)
- **Language** — [TypeScript](https://www.typescriptlang.org)
- **Styling** — [Tailwind CSS](https://tailwindcss.com), [Radix UI](https://www.radix-ui.com), [Framer Motion](https://www.framer.com/motion/)
- **Database** — [MySQL](https://www.mysql.com) with [Drizzle ORM](https://orm.drizzle.team)
- **Cache / queue** — [Cloudflare KV](https://developers.cloudflare.com/kv/) and [Queues](https://developers.cloudflare.com/queues/) via [OpenNext](https://opennext.js.org/cloudflare)
- **API layer** — [tRPC](https://trpc.io) with [TanStack Query](https://tanstack.com/query)
- **Auth** — [Clerk](https://clerk.com)
- **Billing** — [Lemon Squeezy](https://www.lemonsqueezy.com)
- **Object storage** — [Cloudflare R2](https://developers.cloudflare.com/r2/)
- **Email** — [Resend](https://resend.com) with [React Email](https://react.email)
- **Product analytics** — [PostHog](https://posthog.com)
- **AI** — [Vercel AI SDK](https://sdk.vercel.ai) with OpenAI
- **Package manager / runtime** — [Bun](https://bun.sh)
## Getting Started
### Prerequisites
- [Bun](https://bun.sh) 1.1+ and Node 22 (`mise install` picks both up from `mise.toml`)
- [Docker](https://docs.docker.com/get-docker/) with Compose v2, for the local MySQL
- A free [Clerk](https://clerk.com) application: copy the two keys from **API keys** in the dashboard
### One command
```bash
git clone https://github.com/AmoabaKelvin/ishortn.ink.git
cd ishortn.ink
bun install
bun run setup # .env + secrets, MySQL via compose, schema, sample data
bun dev
```
`bun run setup` is idempotent: it creates `.env` from `.env.example`, generates the secrets the app
needs (`IP_HASH_SECRET`, `VERIFIED_CLICKS_SECRET`, `CRON_SECRET`, a local `WEBHOOK_SECRET`), asks
for your Clerk keys if they are still placeholders, starts `compose.yaml`, pushes the Drizzle schema
and seeds a dev user with links, folders, tags and two weeks of click analytics. `bun run d` runs
setup and the dev server in one go.
Then open [http://localhost:3000](http://localhost:3000) and sign in. Clerk development instances
have test mode on: any `name+clerk_test@example.com` address works with the verification code
`424242`, so no email is sent (if your instance verifies by link instead, switch it to **Email
verification code** under _User & Authentication → Email_). The first authenticated request
creates your user row; run `bun run seed --email you+clerk_test@example.com` afterwards to attach
the sample data to that account. Short links resolve straight away, for example
[http://localhost:3000/seed-docs](http://localhost:3000/seed-docs).
Everything else is optional and documented per feature in [`.env.example`](./.env.example):
billing (Lemon Squeezy), email (Resend), custom domains (Cloudflare for SaaS), AI, analytics.
### Webhooks without a tunnel
Both inbound webhooks can be replayed against the running dev server with a signed fixture:
```bash
bun run webhook clerk user.created # svix-signed with WEBHOOK_SECRET
bun run webhook lemonsqueezy subscription_created # HMAC-signed with LEMONSQUEEZY_WEBHOOK_SECRET
bun run webhook lemonsqueezy subscription_cancelled --user user_xxx
```
Fixtures live in `scripts/dev/fixtures/`. For real deliveries from a provider dashboard, expose the
dev server with `bun run tunnel` (needs [`cloudflared`](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/),
no account required) and paste the printed URL plus `/api/webhooks/clerk` or
`/api/webhooks/lemonsqueezy` into the provider, using the provider's signing secret in `.env`.
### Cron jobs and the click queue
In production a Worker (`custom-worker.ts`) calls the `/api/cron/*` routes on a schedule and feeds
click batches to `/api/queue/clicks`. Locally, trigger a cron the same way the Worker does:
```bash
bun run cron cleanup-expired # or any route in CRON_ROUTES, such as entitlements
```
Under `bun dev` clicks are written inline instead of queued, so analytics update immediately.
`bun run preview` builds the OpenNext bundle and runs it in workerd with the queue and KV
emulated, for checking Worker-specific behaviour before deploying.
### Image uploads
Uploads go to Cloudflare R2. Locally you can run MinIO as a stand-in:
```bash
docker compose --profile storage up -d
```
then uncomment the `R2_*` block in `.env.example` into your `.env`. `bun run setup` starts MinIO
automatically once `R2_ENDPOINT` is set.
### Email templates
`bun run email:dev` opens the React Email preview for `src/emails` on port 3001. Sending needs
`RESEND_API_KEY`; without it sends are skipped and logged.
## Self-hosting
To run your own instance on Cloudflare Workers with MySQL and Clerk, follow the
[self-hosting guide](./docs/self-hosting.md). It starts from
[`wrangler.example.jsonc`](./wrangler.example.jsonc); the committed `wrangler.jsonc` holds the
hosted service's resource IDs.
## Scripts
| Command | Purpose |
| --------------------------------------- | -------------------------------------------------------------------- |
| `bun run setup` | Bootstrap: `.env`, secrets, compose stack, schema, seed (idempotent) |
| `bun dev` | Start the Next.js dev server with Turbopack |
| `bun run d` | `setup` then `dev` |
| `bun run seed [--email x \| --user id]` | Seed sample links and analytics for a user |
| `bun run webhook ` | Replay a signed webhook fixture against the dev server |
| `bun run cron ` | Trigger a cron route with the `CRON_SECRET` bearer |
| `bun run tunnel` | Expose port 3000 through a Cloudflare quick tunnel |
| `bun run email:dev` | Preview email templates |
| `bun run preview` | Build with OpenNext and run under workerd (queues, KV, crons) |
| `bun run stack:down` / `stack:reset` | Stop the compose stack / stop and delete its volumes |
| `bun run db:push` | Push `schema.ts` to the database (what `setup` uses locally) |
| `bun run db:generate` | Generate a SQL migration for production |
| `bun run db:migrate` | Apply migrations to a deployed database |
| `bun run db:baseline` | Record `drizzle/` as applied on a new self-hosted database |
| `bun run db:studio` | Open Drizzle Studio |
| `bun test` | Run the unit tests |
| `bun run typecheck` | `tsc --noEmit` |
| `bun run lint` | oxlint (with the anti-slop rules) |
| `bun run format` / `format:check` | oxfmt |
| `bun run build` / `deploy` | Production build / OpenNext deploy to Cloudflare |
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow, conventions and how to
submit a pull request.
## License
Released under the [MIT License](./LICENSE).