## File: README.md

<a href="https://dub.co">
  
</a>

<h3 align="center">Dub</h3>







## Introduction

Dub is the modern, open-source link attribution platform for [short links](https://dub.co/home), [conversion tracking](https://dub.co/analytics), and [affiliate programs](https://dub.co/partners).

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](https://dub.co/customers).

## Tech Stack

- [Next.js](https://nextjs.org/) – framework
- [TypeScript](https://www.typescriptlang.org/) – language
- [Tailwind](https://tailwindcss.com/) – CSS
- [Prisma](https://www.prisma.io/) – ORM
- [Upstash](https://upstash.com/) – redis
- [Tinybird](https://tinybird.com/) – analytics
- [PlanetScale](https://planetscale.com/) – database
- [NextAuth.js](https://next-auth.js.org/) – auth
- [BoxyHQ](https://boxyhq.com/enterprise-sso) – SAML/SSO
- [Turborepo](https://turbo.build/repo) – monorepo
- [Stripe](https://stripe.com/) – payments
- [Resend](https://resend.com/) – emails
- [Vercel](https://vercel.com/) – deployments

## Self-Hosting

You can self-host Dub for greater control over your data and design. [Read this guide](https://dub.co/docs/self-hosting/guide) to learn more.

## Contributing

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

- [Open an issue](https://github.com/dubinc/dub/issues) if you believe you've encountered a bug.
- Follow the [local development guide](https://dub.co/docs/local-development) to get your local dev environment set up.
- Make a [pull request](https://github.com/dubinc/dub/pull) 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.` - Run `pnpm prisma:push` push 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 `node` and `pnpm` match the recommended versions above. Delete all `node_modules`, `.next`, and `.turbo` directories in the `apps` and `packages` directory. You may now reinstall `node_modules` by running `pnpm install` and attempt to rebuild the project with `pnpm 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):**

```bash
cd apps/web
pnpm run script dev/seed
```

**Truncate database before seeding (deletes all existing data first):**

```bash
cd apps/web
pnpm run script dev/seed --truncate
```

When 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](https://opensource.org/license/agpl-v3) and the last 1% is covered under a commercial license (["/ee" Enterprise Edition](<https://github.com/dubinc/dub/tree/ee/apps/web/app/(ee)>)) 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)](<https://github.com/dubinc/dub/tree/main/apps/web/app/(ee)>) subfolder is the place for all the **Enterprise Edition** features from our [hosted](https://dub.co/pricing) plan and enterprise-grade features for [Enterprise](https://dub.co/enterprise), included but not limited to the following:

- [Dub Conversions](https://dub.co/help/article/dub-conversions)
- [Dub Partners](https://dub.co/help/article/dub-partners)
- [SAML/SSO + SCIM Directory sync ](https://dub.co/help/category/saml-sso)

> _❗ WARNING: This repository is copyrighted (unlike our [main repo](https://github.com/dubinc/dub)). You are not allowed to use this code to host your own version of app.dub.co without obtaining a proper [license](https://dub.co/enterprise) 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:

```bash
pnpm i @dub/utils
```

---

## File: 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

https://nucleoapp.com/

- Redistribution of icons is prohibited.
- Icons are restricted for use only within the product they are bundled with.

For more details:

https://nucleoapp.com/license

---

## 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:

```bash
pnpm i @dub/ui
```

---

## File: packages/tinybird/README.md

# Dub Tinybird Setup

```bash
├── 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.pipe
```

---

## File: packages/stripe-app/README.md

# Stripe App

This is the [Stripe app](https://marketplace.stripe.com/apps/dub-conversions) for Dub Conversions.

## Publish new version

1. Run `stripe login` in your terminal and sign in to `Dub Technologies, Inc.`.
2. Navigate to the `packages/stripe-app` directory.
3. Increment the `version` field in `stripe-app.json`.
4. Upload the updated app using `stripe apps upload`.
5. Publish the new version via the [Stripe dashboard](https://dashboard.stripe.com/apps/dub.co).

## Run locally

```
stripe apps start
```

---

## File: 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:

```bash
pnpm i @dub/embed-react
```

---

## File: 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:

```bash
pnpm i @dub/embed-core
```

---

## File: packages/cli/README.md

# `dub-cli`

A CLI for easily shortening URLs with the [Dub API](https://dub.co/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

1. Clone the repository, install dependencies and navigate to the `cli` folder:
   ```bash
   cd packages/cli
   ```
2. Build the package in watch mode:
   ```bash
   pnpm dev
   ```
3. In a separate terminal, navigate to the `cli` folder again and run an [available command](#available-commands):
   ```bash
   pnpm start [command]
   ```
4. See all [available commands](#available-commands) and options:
   ```bash
   pnpm start help
   ```

## Testing Production-like Setup

> **Warning**
> If you have previously installed `dub-cli` globally, uninstall it first to avoid conflicts

1. Clone the repository, install dependencies and navigate to the `cli` folder:
   ```bash
   cd packages/cli
   ```
2. Build the package:
   ```bash
   pnpm build
   ```
3. Link the package globally:
   ```bash
    npm link
   ```
4. Verify the installation:
   ```bash
    dub -v
   ```
5. Run commands:
   ```bash
   dub [command]
   ```