Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

updated docs

Steven Teyc00391ddd4b9
diff --git a/apps/docs/images/cloudflare-r2-manage-api-tokens.png b/apps/docs/images/cloudflare-r2-manage-api-tokens.png
new file mode 100644
index 0000000000..cdb80e4e3f
Binary files /dev/null and b/apps/docs/images/cloudflare-r2-manage-api-tokens.png differ
diff --git a/apps/docs/self-hosting.mdx b/apps/docs/self-hosting.mdx
index 5c6942c084..8f35962840 100644
--- a/apps/docs/self-hosting.mdx
+++ b/apps/docs/self-hosting.mdx
@@ -273,62 +273,62 @@ Don't forget to set the following Callback URLs:
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 Postmark (optional)
+## Step 6: Set up Cloudflare R2
-<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 Postmark for transactional emails (e.g. magic link emails):
-
-1. Follow [this guide](https://postmarkapp.com/support/article/1008-what-are-the-account-and-server-api-tokens) to create a new API token.
-2. Copy the API key into your `.env` file as the `POSTMARK_API_KEY` environment variable.
-3. You'll then need to set up DKIM records and for your domain to start working. You can [follow this guide](https://postmarkapp.com/support/article/1002-getting-started-with-postmark) to learn how to do so.
+Dub stores user-generated assets in either S3 or S3-compatible services like [Cloudflare R2](https://cloudflare.com/r2). These include:
-## Step 7: Set up a storage bucket
+- Project logos
+- User avatars
+- [Custom Social Media Cards](https://dub.co/help/article/custom-social-media-cards) images
-Dub stores project logos, user avatars, and images for the [Custom Social Media Cards](https://dub.co/help/article/custom-social-media-cards) feature in either S3 or S3-compatible services like [Cloudflare R2](https://cloudflare.com/r2).
-
-We recommend using [Cloudflare R2](https://cloudflare.com/r2) for a cheaper and simploer alternative. Here is how you set it up:
+We recommend using [Cloudflare R2](https://cloudflare.com/r2) for self-hosting Dub.co, as it's a more cost-effective solution compared to AWS S3. Here's how you can set it up:
<Steps>
<Step title="Create R2 bucket">
-_Note: You'll need to subscribe to the R2 service if you haven't already._
+<Note>You'll need to subscribe to the R2 service if you haven't already.</Note>
-In your [Cloudflare account](https://dash.cloudflare.com/), create a new R2 bucket.
+In your [Cloudflare account](https://dash.cloudflare.com/), create a new R2 bucket. We recommend giving your bucket a descriptive name (e.g. `dubassets`) and leaving the remaining settings as is.
<Frame>![Cloudflare R2 bucket](/images/cloudflare-r2-create-bucket.png)</Frame>
+In your bucket settings, copy the **S3 API** value – you'll need it in Step 3.
+
</Step>
<Step title="Set up access to R2">
-From the R2 main page, click "Manage R2 API Tokens" on the right-hand side. Then, click "Create API Token".
-
-Make sure to name it something relevant to the service that will be using the token.
+From the R2 main page, click **Manage R2 API Tokens** on the right-hand column.
-Give it "Object Read & Write" permissions.
-
-And we recommend only applying ito to a single bucket.
+<Frame>
+ ![Cloudflare manage API tokens](/images/cloudflare-r2-manage-api-tokens.png)
+</Frame>
-After you create you token, copy the `Access Key ID`, `Secret Access Key` and `Endpoints for S3 clients`.
+Then, click **Create API Token**.
<Frame>
![Cloudflare R2 API token](/images/cloudflare-r2-create-api-token.png)
</Frame>
+Make sure to name your API token something relevant to the service that will be using the token.
+
+Give it "Object Read & Write" permissions, and we recommend only applying ito to a single bucket.
+
+You can leave the remaining settings (TTL, Client IP Address Filtering) as is, and click **Create API Token**.
+
+After you create you token, copy the `Access Key ID` and `Secret Access Key` values – you'll need them in the next step.
+
</Step>
<Step title="Set up R2 environment variables">
Once you have your credentials, set them in your `.env` file:
-```bash
-STORAGE_ACCESS_KEY_ID={Access Key ID}
-STORAGE_SECRET_ACCESS_KEY={Secret Access Key}
-STORAGE_ENDPOINT={Storage Endpoint}/{Bucket Name}
+```TypeScript .env
+STORAGE_ACCESS_KEY_ID= // this is the Access Key ID value from Step 2
+STORAGE_SECRET_ACCESS_KEY= // this is the Secret Access Key value from Step 2
+STORAGE_ENDPOINT= // this is the S3 API value from Step 1
```
</Step>
@@ -353,9 +353,28 @@ STORAGE_DOMAIN={Your Domain}
</Steps>
+## Step 7: Set up Postmark (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 Postmark for transactional emails (e.g. magic link emails):
+
+1. Follow [this guide](https://postmarkapp.com/support/article/1008-what-are-the-account-and-server-api-tokens) to create a new API token.
+2. Copy the API key into your `.env` file as the `POSTMARK_API_KEY` environment variable.
+3. You'll then need to set up DKIM records and for your domain to start working. You can [follow this guide](https://postmarkapp.com/support/article/1002-getting-started-with-postmark) to learn how to do so.
+
## Step 8: Set up Unsplash (optional)
-- [How to set up `UNSPLASH_ACCESS_KEY` env var](https://unsplash.com/documentation#creating-a-developer-account)
+Dub uses Unsplash's API for the [Custom Social Media Cards](https://dub.co/help/article/custom-social-media-cards) feature. You'll need to set up an Unsplash application to get an access key.
+
+<Frame>
+ ![Custom social media
+ cards](https://assets.dub.co/changelog/custom-social-cards.png)
+</Frame>
+
+Check out Unsplash's [official documentation](https://unsplash.com/documentation#creating-a-developer-account) to learn how you can set up the `UNSPLASH_ACCESS_KEY` env var.
## Step 9: Deploy to Vercel