The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improved self-hosting guide
Steven Tey4edb83c0708a
diff --git a/apps/docs/images/thumbnail.png b/apps/docs/images/thumbnail.pngindex d04ceac60f..20ba2a7a17 100644Binary files a/apps/docs/images/thumbnail.png and b/apps/docs/images/thumbnail.png differdiff --git a/apps/docs/images/vercel-deploy-settings.png b/apps/docs/images/vercel-deploy-settings.pngnew file mode 100644index 0000000000..afe012e79aBinary files /dev/null and b/apps/docs/images/vercel-deploy-settings.png differdiff --git a/apps/docs/images/vercel-framework-preset.png b/apps/docs/images/vercel-framework-preset.pngnew file mode 100644index 0000000000..334c9e5964Binary files /dev/null and b/apps/docs/images/vercel-framework-preset.png differdiff --git a/apps/docs/mint.json b/apps/docs/mint.jsonindex b8371ee6d1..9f5a77ec65 100644--- a/apps/docs/mint.json+++ b/apps/docs/mint.json@@ -61,7 +61,7 @@"navigation": [{"group": "Getting Started",- "pages": ["introduction", "local-development", "self-hosting/guide"]+ "pages": ["introduction", "local-development", "self-hosting"]},{"group": "Resources",@@ -117,6 +117,10 @@{"source": "/integrations/:path*","destination": "/integrations"+ },+ {+ "source": "/self-hosting/guide",+ "destination": "/self-hosting"}]}diff --git a/apps/docs/self-hosting.mdx b/apps/docs/self-hosting.mdxnew file mode 100644index 0000000000..2b46334985--- /dev/null+++ b/apps/docs/self-hosting.mdx@@ -0,0 +1,323 @@+---+title: "Self-hosting Dub.co"+"og:title": "How to self-host Dub.co in 8 easy steps"+description: "An end-to-end guide on how to self-host Dub.co – the open-source link management platform."+---++++You can self-host Dub.co on your own servers and cloud infrastructure for greater control over your data and design. This guide will walk you through the entire process of setting up Dub.co on your own servers.++## Prerequisites++Before you begin, make sure you have the following:++- A [GitHub](https://github.com/) account+- A [Tinybird](https://www.tinybird.co/) account+- An [Upstash](https://upstash.com/) account+- A [Planetscale](https://planetscale.com/) account+- A [Vercel](https://vercel.com/) account++You'll also need a custom domain that you will be using for your Dub.co instance, with an optional custom short domain for your links.++In this guide, we'll use `acme.com` as a placeholder for your custom domain, and `ac.me` as a placeholder for your custom short domain.++## Step 1: Local setup++<Steps>++ <Step title="Clone the repo">++First, clone the [Dub repo](https://dub.sh/github) into a public GitHub repository. If you are planning to distribute the code, make sure to keep the source code public to comply with our [AGPLv3 license](https://dub.sh/license).++ ```bash+ git clone https://github.com/dubinc/dub.git+ ```++ </Step>++ <Step title="Install dependencies">++ Run the following command to install the dependencies:++ ```bash+ pnpm i+ ```++ </Step>++ <Step title="Remove unnecessary files">++ Delete the `apps/docs` directory since it's not needed for self-hosting:++ ```bash+ rm -rf apps/docs+ ```++ Delete the `apps/web/vercel.json` file since cron jobs are not required for the self-hosted version:++ ```bash+ rm apps/web/vercel.json+ ```++ </Step>++ <Step title="Set up environment variables">++ Convert the `.env.example` file to `.env`. You can start filling in the first few environment variables:++ ```bash+ # The domain that your app will be hosted on+ NEXT_PUBLIC_APP_DOMAIN=acme.com+ # The short domain that your app will be using (could be the same as the above)+ NEXT_PUBLIC_APP_SHORT_DOMAIN=ac.me+ # The ID of the Vercel team that your app will be deployed to: https://vercel.com/docs/accounts/create-a-team#find-your-team-id+ TEAM_ID_VERCEL=+ # The unique access token for your Vercel account: https://vercel.com/guides/how-do-i-use-a-vercel-api-access-token+ AUTH_BEARER_TOKEN=+ ```++ You will fill in the remaining environment variables in the following steps.++ </Step>++</Steps>++## Step 2: Set up Tinybird database++Next, you'll need to set up Tinybird for the analytics database:++<Steps>++ <Step title="Create Tinybird Workspace">++ In your [Tinybird](https://tinybird.co/) account, create a new Workspace.++ Copy your `admin` [Auth Token](https://www.tinybird.co/docs/concepts/auth-tokens.html). Paste this token as the `TINYBIRD_API_KEY` environment variable in your `.env` file.++ </Step>++ <Step title="Install Tinybird CLI and authenticate">++In your newly-cloned Dub.co repo, navigate to the `packages/tinybird` directory.++ Install the Tinybird CLI with `pip install tinybird-cli` (requires Python >= 3.8).++ Run `tb auth` and paste your `admin` Auth Token.++ </Step>++ <Step title="Publish Tinybird datasource and endpoints">++ Run `tb push` to publish the datasource and endpoints in the `packages/tinybird` directory. You should see the following output (truncated for brevity):++ ```bash+ $ tb push++ ** 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+ ...+ ```++ </Step>++</Steps>++## Step 3: Set up Upstash Redis database++Next, you'll need to set up the Upstash Redis database:++<Steps>++ <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.++++ </Step>++ <Step title="Set up Upstash environment variables">++Once your database is created, copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from the **REST API** section into your `.env` file.++++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.++++ </Step>++</Steps>++## Step 4: Set up Planetscale database++Next, you'll need to set up the Planetscale MySQL database:++<Steps>++ <Step title="Create Planetscale database">++ In your [Planetscale account](https://app.planetscale.com/), create a new database. You can use the free tier for this project.++ Once your database is created, you'll be prompted to select your language or Framework. Select **Prisma**.++ ++ </Step>++ <Step title="Set up Planetscale environment variables">++ Then, you'll have to create a new password for your database. Once the password is created, scroll down to the **Add credentials to .env** section and copy the `DATABASE_URL` into your `.env` file.++ ++ </Step>++ <Step title="Generate Prisma client and create database tables">++In your Dub.co codebase, navigate to `apps/web/prisma/schema.prisma` and change the `metadata` field under the `Project` model to use your custom short domain:++ ```prisma+ model Project {+ ...+ metadata Json? @default("{\"defaultDomains\":[\"ac.me\"]}")+ }+ ```++ In the terminal, navigate to the `apps/web` directory and run the following command to generate the Prisma client:++ ```bash+ npx prisma generate+ ```++ Then, create the database tables with the following command:++ ```bash+ npx prisma db push+ ```++ </Step>++</Steps>++## Step 5: Set up GitHub OAuth++Next, follow [these steps](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps) to create a GitHub App. This will allow users to sign in with their GitHub accounts.++Don't forget to set the following Callback URLs:++- `https://app.yourdomain.com/api/auth/callback/github`+- `http://localhost:8888/api/auth/callback/github` for local development.++<Info>+ Optional: Set the "Email addresses" account permission to **read-only** in+ order to access private email addresses on GitHub.+</Info>++Once your GitHub App is created, copy the `Client ID` and `Client Secret` into your `.env` file as the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables.++## Step 6: Set up Resend (optional)++<Note>+ Note that if you want to use magic link sign-in, this is a required step.+</Note>++Next, you'll need to set up Resend for transactional emails (e.g. magic link emails):++1. In your [Resend account](https://resend.com/overview), create a new API key.+2. Copy the API key into your `.env` file as the `RESEND_API_KEY` environment variable.+3. You'll then need to set up MX records for your domain to start working. You can follow this guide to learn [how to set up MX records with Resend](https://resend.com/docs/dashboard/domains/introduction).++## Step 7: Set up Cloudinary & Unsplash (optional)++If you want to enable the [Custom Social Media Cards](https://dub.co/help/article/custom-social-media-cards) feature, you'll need to set up Cloudinary and Unsplash:++- [How to set up `CLOUDINARY_URL` env var](https://cloudinary.com/documentation/node_quickstart#set_your_api_environment_variable)+- [How to set up `UNSPLASH_ACCESS_KEY` env var](https://unsplash.com/documentation#creating-a-developer-account)++## Step 8: Deploy to Vercel++Once you've set up all of the above services, you can now deploy your app to Vercel.++<Steps>+ <Step title="Deploy code to GitHub">+ If you haven't already, push up your cloned repository to GitHub by running the following commands:++ ```bash+ git add .+ git commit -m "Initial commit"+ git push origin main+ ```++ </Step>++ <Step title="Create a new Vercel project">+ In your [Vercel account](https://vercel.com/), create a new project. Then, select your GitHub repository and click **Import**.++ Make sure that your **Framework Preset** is set to **Next.js** and the **Root Directory** is set to `apps/web`.++ ++ In the **Environment Variables** section, add all of the environment variables from your `.env` file by copying all of them and pasting it into the first input field. A few notes:++ - Remove the `PROJECT_ID_VERCEL` environment variable for now since we will only get the project ID after deploying the project.+ - Replace the `NEXTAUTH_URL` environment variable with the app domain that you will be using (e.g. `https://app.yourdomain.com`).++ Click on **Deploy** to deploy your project.++ <Tip>+ If you get a `No Output Directory called "public" was found after the build+ completed` error, make sure that your [Vercel deployment+ settings](https://vercel.com/docs/deployments/configure-a-build) to make sure that they match the following:++ ++ </Tip>++ </Step>++ <Step title="Add required environment variables">++Once the project deploys, retrieve your [Vercel project ID](https://vercel.com/docs/projects/overview#project-id) and add it as the `PROJECT_ID_VERCEL` environment variable – both in your `.env` file and in your newly created Vercel project's settings (under **Settings > Environment Variables**)++Add both the `NEXT_PUBLIC_APP_DOMAIN` and `NEXT_PUBLIC_APP_SHORT_DOMAIN` as domains in your Vercel project's settings (under **Settings** > **Domains**). You can follow this guide to learn [how to set up a custom domain on Vercel](https://vercel.com/docs/projects/domains/add-a-domain).++ </Step>++ <Step title="Redeploy your Vercel project">+ Go back to the **Deployments** page and redeploy your project.++ Once the deployment is complete, you should be able to visit your app domain (e.g. `https://app.yourdomain.com`) and see the following login page:++++</Step>++</Steps>++## Caveats++This guide is meant to be a starting point for self-hosting Dub.co. It currently depends on the following services to work:++- [Tinybird](https://www.tinybird.co/) for the analytics database+- [Upstash](https://upstash.com/) for the Redis database+- [Planetscale](https://planetscale.com/) for the MySQL database+- [Vercel](https://vercel.com/) for hosting & [Edge Middleware](https://vercel.com/docs/functions/edge-middleware)++In the future, we plan to make it easier to self-host Dub.co by making these dependencies optional by swapping them out for native databases (e.g. mysql, redis, clickhouse, [GeoLite2](https://github.com/GitSquared/node-geolite2-redist) etc.)++Also, Docker is currently not supported, but we have a few [open](https://github.com/dubinc/dub/issues/25) [issues](https://github.com/dubinc/dub/issues/378) and [PRs](https://github.com/dubinc/dub/pull/391) for it.diff --git a/apps/docs/self-hosting/guide.mdx b/apps/docs/self-hosting/guide.mdxdeleted file mode 100644index 128f9971b8..0000000000--- a/apps/docs/self-hosting/guide.mdx+++ /dev/null@@ -1,203 +0,0 @@-----title: "Self-hosting Dub.co"-'og:title': "How to self-host Dub.co in 8 easy steps"-description: "An end-to-end guide on how to self-host Dub.co – the open-source link management platform."------<img- className="rounded-lg border border-gray-100"- src="https://dub.co/_static/thumbnail.png"- alt="Dub.co Thumbnail"-/>--You can self-host Dub.co on your own servers and cloud infrastructure for greater control over your data and design. This guide will walk you through the entire process of setting up Dub.co on your own servers.--## Prerequisites--Before you begin, make sure you have the following:--- A [GitHub](https://github.com/) account-- A [Tinybird](https://www.tinybird.co/) account-- An [Upstash](https://upstash.com/) account-- A [Planetscale](https://planetscale.com/) account-- A [Vercel](https://vercel.com/) account--## Step 1: Local setup--First, clone the [Dub repo](https://dub.sh/github) into a public GitHub repository. If you are planning to distribute the code, make sure to keep the source code public to comply with our [AGPLv3 license](https://dub.sh/license).--```bash-git clone https://github.com/dubinc/dub.git-```--Run the following command to install the dependencies:--```bash-pnpm i-```--Delete the `apps/docs` directory since it's not needed for self-hosting:--```bash-rm -rf apps/docs-```--Delete the `apps/web/vercel.json` file since cron jobs are not required for the self-hosted version:--```bash-rm apps/web/vercel.json-```--Convert the `.env.example` file to `.env`. You can start filling in the first few environment variables:--```bash-# The domain that your app will be hosted on-NEXT_PUBLIC_APP_DOMAIN=-# The short domain that your app will be using (could be the same as the above)-NEXT_PUBLIC_APP_SHORT_DOMAIN=-# The ID of the Vercel team that your app will be deployed to: https://vercel.com/docs/accounts/create-a-team#find-your-team-id-TEAM_ID_VERCEL=-# The unique access token for your Vercel account: https://vercel.com/guides/how-do-i-use-a-vercel-api-access-token-AUTH_BEARER_TOKEN=-```--You will fill in the remaining environment variables in the following steps.--## Step 2: Publish Tinybird endpoints--Next, you'll need to publish the Tinybird endpoints:--1. In your [Tinybird](https://tinybird.co/) account, create a new Workspace.-2. Copy your `admin` [Auth Token](https://www.tinybird.co/docs/concepts/auth-tokens.html). Paste this token as the `TINYBIRD_API_KEY` environment variable in your `.env` file.-3. In your cloned Dub repo, navigate to the `packages/tinybird` directory.-4. Install the Tinybird CLI with `pip install tinybird-cli` (requires Python >= 3.8).-5. Run `tb auth` and paste your `admin` Auth Token.-6. Run `tb push` to publish the datasource and endpoints in the `packages/tinybird` directory. You should see the following output (truncated for brevity):--```bash-$ tb push--** 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-...-```--## Step 3: Set up Upstash Redis database--Next, you'll need to set up the Upstash Redis database:--1. In your [Upstash account](https://console.upstash.com/), create a new database.-2. For better performance & read times, we recommend setting up a global database with several read regions.----3. Once your database is created, copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from the **REST API** section into your `.env` file.----4. 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.----## Step 4: Set up Planetscale database--In your [Planetscale account](https://app.planetscale.com/), create a new database. You can use the free tier for this project.--Once your database is created, you'll be prompted to select your language or Framework. Select **Prisma**.----Then, you'll have to create a new password for your database. Once the password is created, scroll down to the **Add credentials to .env** section and copy the `DATABASE_URL` into your `.env` file.----Going back to your terminal, navigate to the `apps/web` directory and run the following command to generate the Prisma client:--```bash-npx prisma generate-```--Then, create the database tables with the following command:--```bash-npx prisma db push-```--## Step 5: Set up GitHub OAuth--Next, follow [these steps](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps) to create a GitHub App. This will allow users to sign in with their GitHub accounts.--Don't forget to set the following Callback URLs:--- `https://app.yourdomain.com/api/auth/callback/github`-- `http://localhost:8888/api/auth/callback/github` for local development.--<Info>- Optional: Set the "Email addresses" account permission to **read-only** in- order to access private email addresses on GitHub.-</Info>--Once your GitHub App is created, copy the `Client ID` and `Client Secret` into your `.env` file as the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables.--## Step 6: Set up Resend (optional)--Next, you'll need to set up Resend for transactional emails (e.g. magic link emails):--1. In your [Resend account](https://resend.com/overview), create a new API key.-2. Copy the API key into your `.env` file as the `RESEND_API_KEY` environment variable.-3. You'll then need to set up MX records for your domain to start working. You can follow this guide to learn [how to set up MX records with Resend](https://resend.com/docs/dashboard/domains/introduction).--## Step 7: Set up Cloudinary & Unsplash (optional)--If you want to enable the [Custom Social Media Cards](https://dub.co/help/article/custom-social-media-cards) feature, you'll need to set up Cloudinary and Unsplash:--- [How to set up `CLOUDINARY_URL` env var](https://cloudinary.com/documentation/node_quickstart#set_your_api_environment_variable)-- [How to set up `UNSPLASH_ACCESS_KEY` env var](https://unsplash.com/documentation#creating-a-developer-account)--## Step 8: Deploy to Vercel--Once you've set up all of the above services, you can now deploy your app to Vercel:--1. If you haven't already, push up your cloned repository to GitHub.--```bash-git add .-git commit -m "Initial commit"-git push origin main-```--2. In your [Vercel account](https://vercel.com/), create a new project.-3. Select your GitHub repository and click **Import**.-4. In the **Environment Variables** section, add all of the environment variables from your `.env` file by copying all of them and pasting it into the first input field. A few notes:- - Remove the `PROJECT_ID_VERCEL` environment variable for now since we will only get the project ID after deploying the project.- - Replace the `NEXTAUTH_URL` environment variable with the app domain that you will be using (e.g. `https://app.yourdomain.com`).-5. Click **Deploy**.-6. Once the project deploys, [retrieve your Vercel project ID](https://vercel.com/docs/projects/overview#project-id) and add it as the `PROJECT_ID_VERCEL` environment variable – both in your `.env` file and in your newly created Vercel project's settings (under **Settings** > **Environment Variables**).-7. Add both the `NEXT_PUBLIC_APP_DOMAIN` and `NEXT_PUBLIC_APP_SHORT_DOMAIN` as domains in your Vercel project's settings (under **Settings** > **Domains**). You can follow this guide to learn [how to set up a custom domain on Vercel](https://vercel.com/docs/projects/domains/add-a-domain).-8. Go back to the **Deployments** page and redeploy your project.-9. Visit your app domain (e.g. `https://app.yourdomain.com`) and, voila, you should see the following login page:----## Caveats--This guide is meant to be a starting point for self-hosting Dub.co. It currently depends on the following services to work:--- [Tinybird](https://www.tinybird.co/) for the analytics database-- [Upstash](https://upstash.com/) for the Redis database-- [Planetscale](https://planetscale.com/) for the MySQL database-- [Vercel](https://vercel.com/) for hosting & [Edge Middleware](https://vercel.com/docs/functions/edge-middleware)--In the future, we plan to make it easier to self-host Dub.co by making these dependencies optional by swapping them out for native databases (e.g. mysql, redis, clickhouse, [GeoLite2](https://github.com/GitSquared/node-geolite2-redist) etc.)--Also, Docker is currently not supported, but we have a few [open](https://github.com/dubinc/dub/issues/25) [issues](https://github.com/dubinc/dub/issues/378) and [PRs](https://github.com/dubinc/dub/pull/391) for it.diff --git a/apps/web/lib/swr/use-links.ts b/apps/web/lib/swr/use-links.tsindex 60339cab6f..eb5dc1c0c5 100644--- a/apps/web/lib/swr/use-links.ts+++ b/apps/web/lib/swr/use-links.ts@@ -1,6 +1,6 @@+import { LinkProps } from "@/lib/types";import { useRouterStuff } from "@dub/ui";import { fetcher } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useParams } from "next/navigation";import { useEffect, useState } from "react";import useSWR from "swr";@@ -30,8 +30,8 @@ export default function useLinks() {},)}`: admin- ? `/api/admin/links${getQueryString()}`- : null,+ ? `/api/admin/links${getQueryString()}`+ : null,fetcher,{dedupingInterval: 20000,diff --git a/apps/web/ui/links/link-card.tsx b/apps/web/ui/links/link-card.tsxindex c21cd7a3ff..795e30db00 100644--- a/apps/web/ui/links/link-card.tsx+++ b/apps/web/ui/links/link-card.tsx@@ -1,7 +1,7 @@import useDomains from "@/lib/swr/use-domains";import useProject from "@/lib/swr/use-project";import useTags from "@/lib/swr/use-tags";-import { UserProps } from "@/lib/types";+import { LinkProps, UserProps } from "@/lib/types";import TagBadge from "@/ui/links/tag-badge";import { useAddEditLinkModal } from "@/ui/modals/add-edit-link-modal";import { useArchiveLinkModal } from "@/ui/modals/archive-link-modal";@@ -34,7 +34,6 @@ import {nFormatter,timeAgo,} from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import {Archive,CopyPlus,diff --git a/apps/web/ui/modals/add-edit-link-modal/android-section.tsx b/apps/web/ui/modals/add-edit-link-modal/android-section.tsxindex ad54804f96..6a46b916c7 100644--- a/apps/web/ui/modals/add-edit-link-modal/android-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/android-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import {InfoTooltip,SimpleTooltipContent,@@ -7,7 +8,6 @@ import {useRouterStuff,} from "@dub/ui";import { FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useState } from "react";diff --git a/apps/web/ui/modals/add-edit-link-modal/comments-section.tsx b/apps/web/ui/modals/add-edit-link-modal/comments-section.tsxindex 306f2b8fb0..47e7bd3133 100644--- a/apps/web/ui/modals/add-edit-link-modal/comments-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/comments-section.tsx@@ -1,6 +1,6 @@+import { LinkProps } from "@/lib/types";import { InfoTooltip, SimpleTooltipContent, Switch } from "@dub/ui";import { FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useState } from "react";import TextareaAutosize from "react-textarea-autosize";diff --git a/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx b/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsxindex 18673407de..b2ea9c8ce0 100644--- a/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import {InfoTooltip,SimpleTooltipContent,@@ -11,7 +12,6 @@ import {HOME_DOMAIN,getDateTimeLocal,} from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useState } from "react";diff --git a/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx b/apps/web/ui/modals/add-edit-link-modal/geo-section.tsxindex e4b1ab3636..346897be56 100644--- a/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import {InfoTooltip,SimpleTooltipContent,@@ -7,7 +8,6 @@ import {useRouterStuff,} from "@dub/ui";import { COUNTRIES, FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Trash } from "lucide-react";import { Dispatch, SetStateAction, useEffect, useState } from "react";diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsxindex 1350daf89d..ab89592c32 100644--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx@@ -2,6 +2,7 @@import useDomains from "@/lib/swr/use-domains";import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import { AlertCircleFill, Lock, Random, X } from "@/ui/shared/icons";import {BlurImage,@@ -25,7 +26,6 @@ import {linkConstructor,truncate,} from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useParams, usePathname, useRouter } from "next/navigation";import punycode from "punycode/";import {diff --git a/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx b/apps/web/ui/modals/add-edit-link-modal/ios-section.tsxindex 927fe3a214..889cb73b2d 100644--- a/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import {InfoTooltip,SimpleTooltipContent,@@ -7,7 +8,6 @@ import {useRouterStuff,} from "@dub/ui";import { FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useState } from "react";diff --git a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx b/apps/web/ui/modals/add-edit-link-modal/og-section.tsxindex d49014a6a0..1d2431adbb 100644--- a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import { UploadCloud } from "@/ui/shared/icons";import {InfoTooltip,@@ -11,7 +12,6 @@ import {} from "@dub/ui";import { TooltipContent } from "@dub/ui/src/tooltip";import { FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Link2 } from "lucide-react";import {diff --git a/apps/web/ui/modals/add-edit-link-modal/password-section.tsx b/apps/web/ui/modals/add-edit-link-modal/password-section.tsxindex 2243bcd3f1..9130e36e37 100644--- a/apps/web/ui/modals/add-edit-link-modal/password-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/password-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import { Eye, EyeOff } from "@/ui/shared/icons";import {InfoTooltip,@@ -8,7 +9,6 @@ import {} from "@dub/ui";import { TooltipContent } from "@dub/ui/src/tooltip";import { FADE_IN_ANIMATION_SETTINGS, HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useState } from "react";diff --git a/apps/web/ui/modals/add-edit-link-modal/preview.tsx b/apps/web/ui/modals/add-edit-link-modal/preview.tsxindex df576a6da1..735c64874f 100644--- a/apps/web/ui/modals/add-edit-link-modal/preview.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/preview.tsx@@ -1,3 +1,4 @@+import { LinkProps } from "@/lib/types";import {BlurImage,Facebook,@@ -7,7 +8,6 @@ import {Twitter,} from "@dub/ui";import { getDomainWithoutWWW } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useMemo } from "react";import { useDebounce } from "use-debounce";diff --git a/apps/web/ui/modals/add-edit-link-modal/rewrite-section.tsx b/apps/web/ui/modals/add-edit-link-modal/rewrite-section.tsxindex 323611ac04..ea45ec1b35 100644--- a/apps/web/ui/modals/add-edit-link-modal/rewrite-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/rewrite-section.tsx@@ -1,4 +1,5 @@import useProject from "@/lib/swr/use-project";+import { LinkProps } from "@/lib/types";import {InfoTooltip,SimpleTooltipContent,@@ -7,7 +8,6 @@ import {useRouterStuff,} from "@dub/ui";import { HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { Dispatch, SetStateAction, useEffect, useState } from "react";export default function RewriteSection({diff --git a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsxindex 4f29b05106..c494710396 100644--- a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx@@ -1,8 +1,8 @@import useTags from "@/lib/swr/use-tags";+import { LinkProps } from "@/lib/types";import TagBadge from "@/ui/links/tag-badge";import { LoadingCircle, SimpleTooltipContent, Tooltip } from "@dub/ui";import { HOME_DOMAIN } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { Command, useCommandState } from "cmdk";import { Check, ChevronDown, Tag, X } from "lucide-react";import { useParams } from "next/navigation";diff --git a/apps/web/ui/modals/add-edit-link-modal/unsplash-search.tsx b/apps/web/ui/modals/add-edit-link-modal/unsplash-search.tsxindex 6fc7f679fd..9a784bf02f 100644--- a/apps/web/ui/modals/add-edit-link-modal/unsplash-search.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/unsplash-search.tsx@@ -1,6 +1,6 @@+import { LinkProps } from "@/lib/types";import { LoadingSpinner, useMediaQuery } from "@dub/ui";import { fetcher } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { Dispatch, SetStateAction, useState } from "react";import { toast } from "sonner";import useSWR from "swr";diff --git a/apps/web/ui/modals/add-edit-link-modal/utm-section.tsx b/apps/web/ui/modals/add-edit-link-modal/utm-section.tsxindex e19f7afbf7..5ec031f6b6 100644--- a/apps/web/ui/modals/add-edit-link-modal/utm-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/utm-section.tsx@@ -1,3 +1,4 @@+import { LinkProps } from "@/lib/types";import { InfoTooltip, SimpleTooltipContent, Switch } from "@dub/ui";import {FADE_IN_ANIMATION_SETTINGS,@@ -7,7 +8,6 @@ import {getUrlWithoutUTMParams,paramsMetadata,} from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { motion } from "framer-motion";import { Dispatch, SetStateAction, useEffect, useMemo, useState } from "react";diff --git a/apps/web/ui/modals/archive-link-modal.tsx b/apps/web/ui/modals/archive-link-modal.tsxindex 7b8ec2e4d1..df8d619392 100644--- a/apps/web/ui/modals/archive-link-modal.tsx+++ b/apps/web/ui/modals/archive-link-modal.tsx@@ -1,6 +1,6 @@+import { LinkProps } from "@/lib/types";import { BlurImage, Button, Modal, useToastWithUndo } from "@dub/ui";import { GOOGLE_FAVICON_URL, getApexDomain, linkConstructor } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useParams } from "next/navigation";import {Dispatch,diff --git a/apps/web/ui/modals/delete-link-modal.tsx b/apps/web/ui/modals/delete-link-modal.tsxindex f9ea7c52b7..e8a161f475 100644--- a/apps/web/ui/modals/delete-link-modal.tsx+++ b/apps/web/ui/modals/delete-link-modal.tsx@@ -1,6 +1,6 @@+import { LinkProps } from "@/lib/types";import { BlurImage, Button, Modal, useMediaQuery } from "@dub/ui";import { GOOGLE_FAVICON_URL, getApexDomain, linkConstructor } from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useParams, useSearchParams } from "next/navigation";import {Dispatch,diff --git a/apps/web/ui/modals/transfer-link-modal.tsx b/apps/web/ui/modals/transfer-link-modal.tsxindex 4aff262520..f99394110c 100644--- a/apps/web/ui/modals/transfer-link-modal.tsx+++ b/apps/web/ui/modals/transfer-link-modal.tsx@@ -1,4 +1,5 @@import useProjects from "@/lib/swr/use-projects";+import { LinkProps } from "@/lib/types";import {BlurImage,Button,@@ -14,7 +15,6 @@ import {isDubDomain,linkConstructor,} from "@dub/utils";-import { type Link as LinkProps } from "@prisma/client";import { useParams } from "next/navigation";import {Dispatch,