An open-source link shortener with built-in analytics + free custom domains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Steven Tey a9ad3bcba6 Added Spline back 🥳 2 days ago
components swapped Destination URL & Shortlink (h/t to @peerrich for the feedback) 7 days ago
emails remove redundant CTA 4 weeks ago
lib convert proxy to gerServerSideProps 5 days ago
pages Added Spline back 🥳 2 days ago
prisma Added Android section and a bunch of small UI optimizations 2 weeks ago
public Reposition Marketing 2 weeks ago
styles Upgrade to Next.js 13. Also upgraded next-auth, mailing + added next/font 3 weeks ago
.env.example Added /domains and /links cron endpoints 2 months ago
.gitignore started adding mailing.run 2 months ago
.prettierignore ran prettier format 2 months ago
LICENSE.md Added AGPL License 3 months ago
README.md Reposition Marketing 2 weeks ago
mailing.config.json started adding mailing.run 2 months ago
middleware.ts Added middleware rewrite for `api` subdomain 1 week ago
next.config.js switched from avatar.tobi.sh to avatar.vercel.sh, accounted for a few more edge cases 2 weeks ago
package.json Added Spline back 🥳 2 days ago
postcss.config.js ran prettier format 2 months ago
prettier.config.js Added and ran tailwind prettier 1 month ago
tailwind.config.js Upgrade to Next.js 13. Also upgraded next-auth, mailing + added next/font 3 weeks ago
tsconfig.json improved Accordion UI, added UTM builder 1 month ago
vercel.json disable comments for now 2 months ago
yarn.lock Added Spline back 🥳 2 days ago

README.md

Dub – an open-source link management tool for modern marketing teams to create, share, and track short links.

Dub

An open-source link management tool for modern marketing teams to create, share, and track short links.

Twitter Hacker News License

Introduction · Deploy Your Own · Tech Stack · Implementation · Contributing


Introduction

Dub is an open-source link management tool for modern marketing teams to create, share, and track short links. Built with Vercel Edge Functions, Upstash Redis, and Planetscale MySQL.

Here are some of the features that Dub provides out-of-the-box:

Built-in Analytics

Dub provides a powerful analytics dashboard for your links, including geolocation, device, and browser information.

Analytics Dashboard

Custom domains

You can easily configure custom domains on Dub – just add an A/CNAME record to your DNS provider and you're good to go. This is built on the Vercel Domains API.

Custom Domains

QR Code Generator

You can easily generate and customize QR codes for your links, which can be used for flyers, posters, powerpoint presentations, etc.

QR Code

OG Image Proxy

Add a custom OG image in front of your target URL. Bots like Twitter/Facebook will be served this image, while users will be redirected to your target URL.

OG Image Proxy

Deploy Your Own

You can deploy your own hosted version of Dub for greater privacy & control. Just click the link below to deploy a ready-to-go version of Dub to Vercel.

Deploy with Vercel

Tech Stack

Implementation

Dub is built as a standard Next.js application with Middleware to handle multi-tenancy, inspired by the Vercel Platforms Starter Kit.

Redis is used as the caching layer for all short links. Redis also has the Sorted Set data type, which is perfect for storing & retrieving time-series analytics data. Here's the full schema:

  • {domain}:{key} – string containing a JSON object with the target URL and password (optional). Also has an optional TTL.
  • {domain}:clicks:{key} sorted set of all clicks for a given link (e.g. dub.sh:clicks:github)
  • {domain}:root:clicks sorted set of all root link clicks for a given domain (e.g. dub.sh:root:clicks)

MySQL is used as the database for storing user data, project data, and link metadata. You can refer to the Prisma schema here.

Contributing

We love our contributors! Here's how you can contribute:

  • Open an issue if you believe you've encountered a bug.
  • Make a pull request to add new features/make quality-of-life improvements/fix bugs.

Author

License

Inspired by Plausible, Dub is open-source under the GNU Affero General Public License Version 3 (AGPLv3) or any later version. You can find it here.