File: README.md
Dub
Introduction
Dub is the modern, open-source link attribution platform for short links, conversion tracking, and affiliate programs.
Our platform powers 100M+ clicks and 2M+ links monthly, and is used by world-class marketing teams from companies like Twilio, Buffer, Framer, Perplexity, Vercel, Laravel, and more.
Tech Stack
- Next.js β framework
- TypeScript βΒ language
- Tailwind βΒ CSS
- Prisma βΒ ORM
- Upstash βΒ redis
- Tinybird βΒ analytics
- PlanetScale βΒ database
- NextAuth.js β auth
- BoxyHQ β SAML/SSO
- Turborepo β monorepo
- Stripe βΒ payments
- Resend β emails
- Vercel β deployments
Self-Hosting
You can self-host Dub for greater control over your data and design. Read this guide to learn more.
Contributing
We love our contributors! Here's how you can contribute:
- Open an issue if you believe you've encountered a bug.
- Follow the local development guide to get your local dev environment set up.
- Make a pull request to add new features/make quality-of-life improvements/fix bugs.
Recommended Versions
| Package | Version |
|---|---|
| node | v23.11.0 |
| pnpm | 9.15.9 |
Common Local Development Issues
The table does not exist in the current database.- Runpnpm prisma:pushpush the state of the Prisma schema file to the database without using migrations files.- The project is not building correctly locally - verify your versions of
nodeandpnpmmatch the recommended versions above. Delete allnode_modules,.next, and.turbodirectories in theappsandpackagesdirectory. You may now reinstallnode_modulesby runningpnpm installand attempt to rebuild the project withpnpm build.
Dev Seed Script
This script seeds the database with development data for testing and development purposes.
Basic seeding (adds data without deleting existing data):
cd apps/web
pnpm run script dev/seedTruncate database before seeding (deletes all existing data first):
cd apps/web
pnpm run script dev/seed --truncateWhen using --truncate, the script will ask for confirmation before deleting any data.
Repo Activity
License
Dub Technologies, Inc. is a commercial open-source company, which means some parts of this open-source repository require a commercial license. The concept is called "Open Core" where the core technology (99%) is fully open source, licensed under AGPLv3 and the last 1% is covered under a commercial license ("/ee" Enterprise Edition) which we believe is entirely relevant for larger organisations that require enterprise features. Enterprise features are built by the core engineering team of Dub Technologies, Inc., which is hired full-time.
File: apps/web/app/(ee)/README.md
Enterprise Edition
Welcome to the Enterprise Edition of Dub.co.
The /(ee) subfolder is the place for all the Enterprise Edition features from our hosted plan and enterprise-grade features for Enterprise, included but not limited to the following:
β WARNING: This repository is copyrighted (unlike our main repo). You are not allowed to use this code to host your own version of app.dub.co without obtaining a proper license firstβ
File: packages/utils/README.md
`@dub/utils`
@dub/utils is a library of utility functions that are used across Dub's web applications.
Installation
To install the package, run:
pnpm i @dub/utilsFile: packages/ui/src/icons/nucleo/README.md
Nucleo Icons
β These icons are copyrighted and redistribution is prohibited. See the full Nucleo copyright notice below.
Copyright Β© Nucleo
Version 1.3, January 3, 2024
Nucleo Icons
- Redistribution of icons is prohibited.
- Icons are restricted for use only within the product they are bundled with.
For more details:
File: packages/ui/README.md
`@dub/ui`
@dub/ui is a library of React components that are used across Dub's web applications.
Installation
To install the package, run:
pnpm i @dub/uiFile: packages/tinybird/README.md
Dub Tinybird Setup
βββ datasources
β βββ dub_click_events.datasource
β βββ dub_click_events_mv.datasource
β βββ dub_links_metadata.datasource
β βββ dub_links_metadata_latest.datasource
βββ endpoints
β βββ browser.pipe
β βββ city.pipe
β βββ clicks.pipe
β βββ country.pipe
β βββ device.pipe
β βββ os.pipe
β βββ referer.pipe
β βββ timeseries.pipe
β βββ top_links.pipe
β βββ top_urls.pipe
βββ pipes
β βββ dub_click_events_pipe.pipe
β βββ dub_links_metadata_pipe.pipeFile: packages/stripe-app/README.md
Stripe App
This is the Stripe app for Dub Conversions.
Publish new version
- Run
stripe loginin your terminal and sign in toDub Technologies, Inc.. - Navigate to the
packages/stripe-appdirectory. - Increment the
versionfield instripe-app.json. - Upload the updated app using
stripe apps upload. - Publish the new version via the Stripe dashboard.
Run locally
stripe apps startFile: packages/embeds/react/README.md
`@dub/embed-react`
@dub/embed-react is a library of React components that are used embed Dub's referral dashboard on third-party websites.
Installation
To install the package, run:
pnpm i @dub/embed-reactFile: packages/embeds/core/README.md
`@dub/embed-core`
@dub/embed-core is a library that contains the core logic for embedding Dub's referral dashboard on third-party websites.
Installation
To install the package, run:
pnpm i @dub/embed-coreFile: packages/cli/README.md
`dub-cli`
A CLI for easily shortening URLs with the Dub API.
https://github.com/user-attachments/assets/2ce9fe51-68ab-4e6d-b08d-4da09c17f90e
Available Commands
| Command | Description |
|---|---|
dub login |
Log into the DUB platform |
dub config |
See your configured workspace credentials |
dub domains |
Configure your workspace domain |
dub shorten [url] [key] |
Create a short link. You can preemptively pass the URL and the generated short link key, or go through the CLI prompts. |
dub links [options] |
Search for links in your Dub workspace. Available options include: -s, --search <search> to search for a link by name, or -l, --limit <limit> to limit the number of links returned (default is 10). |
dub help [command] |
Display help for a specific command |
Running Locally for Development
- Clone the repository, install dependencies and navigate to the
clifolder:bashcd packages/cli - Build the package in watch mode:bash
pnpm dev - In a separate terminal, navigate to the
clifolder again and run an available command:bashpnpm start [command] - See all available commands and options:bash
pnpm start help
Testing Production-like Setup
Warning
If you have previously installeddub-cliglobally, uninstall it first to avoid conflicts
- Clone the repository, install dependencies and navigate to the
clifolder:bashcd packages/cli - Build the package:bash
pnpm build - Link the package globally:bash
npm link - Verify the installation:bash
dub -v - Run commands:bash
dub [command]