Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 36 additions & 29 deletions docs/local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

## Introduction

Dub's codebase is set up in a monorepo (via [Turborepo](https://turbo.build/repo)) and is fully [open-source on GitHub](https://github.com/dubinc/dub).

Check warning on line 18 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L18

Did you really mean 'monorepo'?

Here's the monorepo structure:

Check warning on line 20 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L20

Did you really mean 'monorepo'?

```
apps
Expand All @@ -44,10 +44,10 @@
- `cli`: A CLI for easily shortening URLs with the Dub API.
- `email`: Dub's email application with function to send emails and templates.
- `embeds`: A package used embed Dub's referral dashboard.
- `prisma`: Prisma Configuration for Dub's web-app.

Check warning on line 47 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L47

Did you really mean 'Prisma'?
- `stripe-app`: The Stripe app for dub conversions.
- `tailwind-config`: The Tailwind CSS configuration for Dub's web app.
- `tinybird`: Dub's Tinybird configuration.

Check warning on line 50 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L50

Did you really mean 'Tinybird'?
- `tsconfig`: The TypeScript configuration for Dub's web app.
- `ui`: Dub's UI component library.
- `utils`: A collection of utility functions and constants used across Dub's codebase.
Expand Down Expand Up @@ -80,7 +80,7 @@
- An [Upstash](https://upstash.com/) account
- A [PlanetScale](https://planetscale.com/)-compatible MySQL database

Watch this video from our friends at Tinybird to learn how to set up Dub locally:

Check warning on line 83 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L83

Did you really mean 'Tinybird'?

<iframe
width="100%"
Expand Down Expand Up @@ -143,9 +143,9 @@

</Steps>

## Step 2: Set up Tinybird Clickhouse database

Check warning on line 146 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L146

Did you really mean 'Tinybird'?

Check warning on line 146 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L146

Did you really mean 'Clickhouse'?

Next, you'll need to set up the [Tinybird](https://tinybird.co) Clickhouse database. This will be used to store time-series click events data.

Check warning on line 148 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L148

Did you really mean 'Clickhouse'?

<Steps>

Expand All @@ -163,34 +163,43 @@

<Step title="Install Tinybird CLI and authenticate">

In your newly-cloned Dub repo, navigate to the `packages/tinybird` directory.
In your newly-cloned Dub repo, navigate to the `packages/tinybird` directory.

If you have `brew`, install `pipx` by running `brew install pipx`. If not, you can check [installation guide](https://pipx.pypa.io/stable/installation/) for other options. After that, install the Tinybird CLI with `pipx install tinybird-cli` (requires Python >= 3.8).
Install the Tinybird CLI:

Run `tb auth --interactive` and paste your `admin` Auth Token.
```bash Terminal
curl https://tinybird.co | sh
```

Then authenticate with Tinybird:

```bash Terminal
tb login
```

</Step>

<Step title="Publish Tinybird datasource and endpoints">

Run `tb deploy` to publish the datasource and endpoints in the `packages/tinybird` directory. You should see the following output (truncated for brevity):
Run `tb --cloud deploy` to publish the datasource and endpoints to your Tinybird Cloud workspace.

```bash Terminal
$ tb deploy

** Processing ./datasources/click_events.datasource
** Processing ./endpoints/clicks.pipe
...
** Building dependencies
** Running 'click_events'
** 'click_events' created
** Running 'device'
** => Test endpoint at https://api.us-east.tinybird.co/v0/pipes/device.json
** Token device_endpoint_read_8888 not found, creating one
** => Test endpoint with:
** $ curl https://api.us-east.tinybird.co/v0/pipes/device.json?token=p.ey...NWeaoTLM
** 'device' created
...
tb --cloud deploy
```

You should see output like this when the deployment is live:

```bash Terminal
Deployment URL: https://cloud.tinybird.co/aws/us-east-1/<workspace-name>/deployments/<deployment-id>
Job API URL: https://api.us-east.aws.tinybird.co/v0/jobs/<job-id>
Jobs URL: https://cloud.tinybird.co/aws/us-east-1/<workspace-name>/jobs

* Deployment submitted. It will be auto-promoted when ready.
» Waiting for deployment to be ready...
✓ Deployment is ready
» Waiting for deployment to be promoted...
✓ Deployment promoted
✓ Deployment #1 is live!
```
Comment on lines +184 to 203

@coderabbitai coderabbitai Bot Jun 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a temporary compatibility note for current Tinybird pipe schema requirements.

This guide can still fail on current main without the partner_tag_ids pipe update and Forward TYPE ENDPOINT adjustment referenced in PR context. Please add an explicit note here (or in Troubleshooting) so users don’t get blocked after following these steps.

Suggested doc patch
   <Step title="Publish Tinybird datasource and endpoints">
@@
     ```bash Terminal
     tb --cloud deploy
     ```
+
+    <Warning>
+      If deployment fails on current `main`, you may need the Tinybird Forward
+      compatibility updates (including `partner_tag_ids` in
+      `packages/tinybird/dub_links_metadata_pipe.pipe` and `TYPE ENDPOINT`
+      definitions). These changes are tracked in the Tinybird follow-up PR.
+    </Warning>
@@
   </Step>

Also applies to: 207-221

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/local-development.mdx` around lines 184 - 203, Add a temporary
compatibility warning to the deployment instructions explaining that deployments
may fail on current main without the Tinybird Forward compatibility updates;
specifically mention the need to include partner_tag_ids in
packages/tinybird/dub_links_metadata_pipe.pipe and the TYPE ENDPOINT adjustments
from the Tinybird follow-up PR, and place this note near the deployment output
example (also add the same note around the later occurrence covering lines
207-221) so users are aware to apply those changes if deployment errors occur.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed as part of dubinc/dub#3974 - when this gets merged / added issue will resolve

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description image shows the Dub Developer Docs page with the "Step 3: Set up Upstash Redis database" section, displaying the Redis database card (dub-test, Free Tier, AWS, N. Virginia USA, us-east-1) with REST API connection details and the QStash token setup instructions.

@general-adhoc, thanks for the context — noted that the Tinybird Forward compatibility fixes (partner_tag_ids and TYPE ENDPOINT requirements) are tracked and will land with dubinc/dub#3974. Once that PR merges, users following these updated docs should have a seamless experience. Would you like me to resolve this review comment now, or keep it open until #3974 is merged so it stays visible as a reminder?


</Step>
Expand All @@ -199,23 +208,23 @@

You will then need to update your [Tinybird API base URL](https://www.tinybird.co/docs/api-reference/api-reference.html#regions-and-endpoints) to match the region of your database.

From the previous step, take note of the **Test endpoint** URL. It should look something like this:
From the previous step, take note of the **Job API URL** in the deployment output. It should look something like this:

```bash Terminal
Test endpoint at https://api.us-east.tinybird.co/v0/pipes/device.json
Job API URL: https://api.us-east.aws.tinybird.co/v0/jobs/<job-id>
```

Copy the base URL and paste it as the `TINYBIRD_API_URL` environment variable in your `.env` file.
Copy the base URL before `/v0/jobs` and paste it as the `TINYBIRD_API_URL` environment variable in your `.env` file.

```bash Terminal
TINYBIRD_API_URL=https://api.us-east.tinybird.co
TINYBIRD_API_URL=https://api.us-east.aws.tinybird.co
```

</Step>

</Steps>

## Step 3: Set up Upstash Redis database

Check warning on line 227 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L227

Did you really mean 'Upstash'?

Next, you'll need to set up the [Upstash](https://upstash.com) Redis database. This will be used to cache link metadata and serve link redirects.

Expand All @@ -223,9 +232,7 @@

<Step title="Create Upstash database">

In your [Upstash account](https://console.upstash.com/), create a new database.

For better performance & read times, we recommend setting up a global database with several read regions.
In your [Upstash account](https://console.upstash.com/), create a new database in the `us-east-1` region.

<Frame>![Upstash Redis database](/images/upstash-create-db.png)</Frame>

Expand All @@ -237,23 +244,23 @@

<Frame>![Upstash Redis tokens](/images/upstash-redis-tokens.png)</Frame>

Navigate to the [QStash tab](https://console.upstash.com/qstash) and copy the `QSTASH_TOKEN`, `QSTASH_CURRENT_SIGNING_KEY`, and `QSTASH_NEXT_SIGNING_KEY` from the **Request Builder** section into your `.env` file.
Navigate to the [QStash tab](https://console.upstash.com/qstash) and copy `QSTASH_TOKEN`, `QSTASH_CURRENT_SIGNING_KEY`, and `QSTASH_NEXT_SIGNING_KEY` into your `.env` file. You don't need to copy `QSTASH_URL` for local Dub setup.

<Frame>![Upstash QStash tokens](/images/upstash-qstash-tokens.png)</Frame>

</Step>

<Step title="Optional: Set up Ngrok tunnel">

If you're planning to run Qstash-powered background jobs locally, you'll need to set up an Ngrok tunnel to expose your local server to the internet.
If you're testing features that enqueue QStash background jobs locally, you'll need to set up an Ngrok tunnel to expose your local server to the internet. Dub uses QStash for workflows like imports, exports, webhooks, payouts, and other `/api/cron/*` jobs. Without a tunnel, QStash won't be able to call back into your local app.

Follow [these steps](https://ngrok.com/docs/getting-started/) to setup `ngrok`, and then run the following command to start an Ngrok tunnel at port `8888`:

```bash Terminal
ngrok http 8888
```

Copy the `https` URL and paste it as the `NEXT_PUBLIC_NGROK_URL` environment variable in your `.env` file.
Copy the `https` URL and paste it as the `NEXT_PUBLIC_NGROK_URL` environment variable in your `.env` file. If you're using a free Ngrok account, this URL can change when you restart Ngrok, so make sure to update `NEXT_PUBLIC_NGROK_URL` whenever it changes.

</Step>

Expand Down Expand Up @@ -322,8 +329,8 @@
</Steps>

<Tip>
The docker-compose setup includes Mailhog, which acts as a mock SMTP server

Check warning on line 332 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L332

Did you really mean 'Mailhog'?
and shows received emails in a web UI. You can access the Mailhog web

Check warning on line 333 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L333

Did you really mean 'Mailhog'?
interface at [http://localhost:8025](http://localhost:8025). This is useful
for testing email functionality without sending real emails during local
development.
Expand Down Expand Up @@ -380,13 +387,13 @@

</Steps>

## Step 5: Set up Mailhog

Check warning on line 390 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L390

Did you really mean 'Mailhog'?

To view emails sent from your application during local development, you'll need to set up [Mailhog](https://github.com/mailhog/MailHog).

<Note>
If you've already run `docker compose up` as part of the database setup, you
can skip this step. Mailhog is included in the Docker Compose configuration

Check warning on line 396 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L396

Did you really mean 'Mailhog'?
and should already be running.
</Note>

Expand Down Expand Up @@ -460,7 +467,7 @@
pnpm dev
```

The web app (`apps/web`) will be available at [localhost:8888](http://localhost:8888). Additionally, you may access Prisma Studio to manage your MySQL database at [localhost:5555](http://localhost:5555).

Check warning on line 470 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L470

Did you really mean 'Prisma'?

### Logging into the application

Expand Down Expand Up @@ -494,9 +501,9 @@

</Steps>

### Testing your shortlinks locally

Check warning on line 504 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L504

Did you really mean 'shortlinks'?

Use the following url structure to ensure event tracking is working, and to populate analytics data, replacing `<shortlink-key>` with the shortlink key you've created.

Check warning on line 506 in docs/local-development.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dub) - vale-spellcheck

docs/local-development.mdx#L506

Did you really mean 'shortlink'?

```
http://dub.localhost:8888/<shortlink-key>
Expand Down
Binary file modified images/upstash-create-db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/upstash-qstash-tokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/upstash-redis-tokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.