Skip to content

Moving the docs examples section into guides #1356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 25, 2024
Merged
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
4 changes: 2 additions & 2 deletions docs/config/config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ And add the following environment variable in your Trigger.dev dashboard on the
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable",
```

Follow [this example](/examples/puppeteer) to get setup with Trigger.dev and Puppeteer in your project.
Follow [this example](/guides/examples/puppeteer) to get setup with Trigger.dev and Puppeteer in your project.

#### ffmpeg

Expand Down Expand Up @@ -532,7 +532,7 @@ export default defineConfig({

This extension will also add the `FFMPEG_PATH` and `FFPROBE_PATH` to your environment variables, making it easy to use popular ffmpeg libraries like `fluent-ffmpeg`.

Follow [this example](/examples/ffmpeg-video-processing) to get setup with Trigger.dev and FFmpeg in your project.
Follow [this example](/guides/examples/ffmpeg-video-processing) to get setup with Trigger.dev and FFmpeg in your project.

#### esbuild plugins

Expand Down
19 changes: 0 additions & 19 deletions docs/examples/intro.mdx

This file was deleted.

19 changes: 19 additions & 0 deletions docs/guides/examples/intro.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Introduction"
sidebarTitle: "Introduction"
description: "Learn how to use Trigger.dev with these practical task examples."
---

| Example task | Description |
| :------------------------------------------------------------ | :-------------------------------------------------------------------------- |
| [DALL·E 3 image generation](/guides/examples/dall-e3-generate-image) | Use OpenAI's GPT-4o and DALL·E 3 to generate an image and text. |
| [FFmpeg video processing](/guides/examples/ffmpeg-video-processing) | Use FFmpeg to process a video in various ways and save it to Cloudflare R2. |
| [OpenAI with retrying](/guides/examples/open-ai-with-retrying) | Create a reusable OpenAI task with custom retry options. |
| [PDF to image](/guides/examples/pdf-to-image) | Use `MuPDF` to turn a PDF into images and save them to Cloudflare R2. |
| [React to PDF](/guides/examples/react-pdf) | Use `react-pdf` to generate a PDF and save it to Cloudflare R2. |
| [Puppeteer](/guides/examples/puppeteer) | Use Puppeteer to generate a PDF or scrape a webpage. |
| [Resend email sequence](/guides/examples/resend-email-sequence) | Send a sequence of emails over several days using Resend with Trigger.dev. |
| [Sharp image processing](/guides/examples/sharp-image-processing) | Use Sharp to process an image and save it to Cloudflare R2. |
| [Stripe webhook](/guides/examples/stripe-webhook) | Trigger a task from Stripe webhook events. |
| [Supabase Storage upload](/guides/examples/supabase-storage-upload) | Download a video from a URL and upload it to Supabase Storage using S3. |
| [Vercel AI SDK](/guides/examples/vercel-ai-sdk) | Use Vercel AI SDK to generate text using OpenAI. |
File renamed without changes.
14 changes: 4 additions & 10 deletions docs/examples/puppeteer.mdx → docs/guides/examples/puppeteer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import ScrapingWarning from "/snippets/web-scraping-warning.mdx";

There are 3 example tasks to follow on this page:

1. [Basic example](/examples/puppeteer#basic-example)
2. [Generate a PDF from a web page](/examples/puppeteer#generate-a-pdf-from-a-web-page)
3. [Scrape content from a web page](/examples/puppeteer#scrape-content-from-a-web-page)
1. [Basic example](/guides/examples/puppeteer#basic-example)
2. [Generate a PDF from a web page](/guides/examples/puppeteer#generate-a-pdf-from-a-web-page)
3. [Scrape content from a web page](/guides/examples/puppeteer#scrape-content-from-a-web-page)

<ScrapingWarning/>

Expand Down Expand Up @@ -143,7 +143,7 @@ There's no payload required for this task so you can just click "Run test" from

### Overview

In this example we use [Puppeteer](https://pptr.dev/) with a [BrowserBase](https://www.browserbase.com/) proxy to scrape the GitHub stars count from the [Trigger.dev](https://trigger.dev) landing page and log it out. See [this list](/examples/puppeteer#proxying) for more proxying services we recommend.
In this example we use [Puppeteer](https://pptr.dev/) with a [BrowserBase](https://www.browserbase.com/) proxy to scrape the GitHub stars count from the [Trigger.dev](https://trigger.dev) landing page and log it out. See [this list](/guides/examples/puppeteer#proxying) for more proxying services we recommend.

<Note>
When web scraping, you MUST use the technique below which uses a proxy with Puppeteer. Direct scraping without using `browserWSEndpoint` is prohibited and will result in account suspension.
Expand All @@ -164,12 +164,6 @@ export const puppeteerScrapeWithProxy = task({

const page = await browser.newPage();

// Set up BrowserBase proxy authentication
await page.authenticate({
username: "api",
password: process.env.BROWSERBASE_API_KEY || "",
});

try {
// Navigate to the target website
await page.goto("https://trigger.dev", { waitUntil: "networkidle0" });
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ We're [open source](https://github.com/triggerdotdev/trigger.dev) and you can ch
<Card title="Writing tasks" icon="wand-magic-sparkles" href="/tasks/overview">
Tasks are the core of Trigger.dev. Learn what they are and how to write them.
</Card>
<Card title="Framework guides" icon="wand-magic-sparkles" href="/guides/frameworks/introduction">
Get started with Trigger.dev in your existing framework.
</Card>
<Card title="Example tasks" icon="wand-magic-sparkles" href="/guides/examples/intro">
Example tasks to get you started.
</Card>
</CardGroup>

## Getting help
Expand Down
106 changes: 33 additions & 73 deletions docs/mint.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"$schema": "https://mintlify.com/schema.json",
"name": "Trigger.dev",
"openapi": [
"/openapi.yml",
"/v3-openapi.yaml"
],
"openapi": ["/openapi.yml", "/v3-openapi.yaml"],
"api": {
"playground": {
"mode": "simple"
Expand Down Expand Up @@ -90,58 +87,42 @@
{
"source": "/trigger-config",
"destination": "/config/config-file"
},
{
"source": "/examples/:slug*",
"destination": "/guides/examples/:slug*"
}
],
"anchors": [
{
"name": "Guides",
"name": "Guides & examples",
"icon": "book",
"url": "guides"
},
{
"name": "Examples",
"icon": "code",
"url": "examples"
}
],
"navigation": [
{
"group": "Getting Started",
"pages": [
"introduction",
"quick-start",
"how-it-works",
"upgrading-beta",
"limits"
]
"pages": ["introduction", "quick-start", "how-it-works", "upgrading-beta", "limits"]
},
{
"group": "Fundamentals",
"pages": [
{
"group": "Tasks",
"pages": [
"tasks/overview",
"tasks/scheduled"
]
"pages": ["tasks/overview", "tasks/scheduled"]
},
"triggering",
"apikeys",
{
"group": "Configuration",
"pages": [
"config/config-file",
"config/extensions/overview"
]
"pages": ["config/config-file", "config/extensions/overview"]
}
]
},
{
"group": "Development",
"pages": [
"cli-dev",
"run-tests"
]
"pages": ["cli-dev", "run-tests"]
},
{
"group": "Deployment",
Expand All @@ -151,9 +132,7 @@
"github-actions",
{
"group": "Deployment integrations",
"pages": [
"vercel-integration"
]
"pages": ["vercel-integration"]
}
]
},
Expand All @@ -165,13 +144,7 @@
"errors-retrying",
{
"group": "Wait",
"pages": [
"wait",
"wait-for",
"wait-until",
"wait-for-event",
"wait-for-request"
]
"pages": ["wait", "wait-for", "wait-until", "wait-for-event", "wait-for-request"]
},
"queue-concurrency",
"versioning",
Expand All @@ -189,10 +162,7 @@
"management/overview",
{
"group": "Tasks API",
"pages": [
"management/tasks/trigger",
"management/tasks/batch-trigger"
]
"pages": ["management/tasks/trigger", "management/tasks/batch-trigger"]
},
{
"group": "Runs API",
Expand Down Expand Up @@ -230,9 +200,7 @@
},
{
"group": "Projects API",
"pages": [
"management/projects/runs"
]
"pages": ["management/projects/runs"]
}
]
},
Expand Down Expand Up @@ -278,11 +246,7 @@
},
{
"group": "Help",
"pages": [
"community",
"help-slack",
"help-email"
]
"pages": ["community", "help-slack", "help-email"]
},
{
"group": "Frameworks",
Expand All @@ -305,38 +269,34 @@
]
},
{
"group": "Dashboard",
"group": "Example tasks",
"pages": [
"guides/dashboard/creating-a-project"
"guides/examples/intro",
"guides/examples/dall-e3-generate-image",
"guides/examples/ffmpeg-video-processing",
"guides/examples/open-ai-with-retrying",
"guides/examples/pdf-to-image",
"guides/examples/puppeteer",
"guides/examples/sharp-image-processing",
"guides/examples/stripe-webhook",
"guides/examples/supabase-storage-upload",
"guides/examples/react-pdf",
"guides/examples/resend-email-sequence",
"guides/examples/vercel-ai-sdk"
]
},
{
"group": "Migrations",
"pages": [
"guides/use-cases/upgrading-from-v2"
]
"group": "Dashboard",
"pages": ["guides/dashboard/creating-a-project"]
},
{
"group": "Examples",
"pages": [
"examples/intro",
"examples/dall-e3-generate-image",
"examples/ffmpeg-video-processing",
"examples/open-ai-with-retrying",
"examples/pdf-to-image",
"examples/puppeteer",
"examples/sharp-image-processing",
"examples/stripe-webhook",
"examples/supabase-storage-upload",
"examples/react-pdf",
"examples/resend-email-sequence",
"examples/vercel-ai-sdk"
]
"group": "Migrations",
"pages": ["guides/use-cases/upgrading-from-v2"]
}
],
"footerSocials": {
"twitter": "https://twitter.com/triggerdotdev",
"github": "https://github.com/triggerdotdev",
"linkedin": "https://www.linkedin.com/company/triggerdotdev"
}
}
}
2 changes: 1 addition & 1 deletion docs/snippets/web-scraping-warning.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Warning>
**WEB SCRAPING:** When web scraping, you MUST use a proxy to comply with our terms of service. Direct scraping of third-party websites without the site owner's permission using Trigger.dev Cloud is prohibited and will result in account suspension. See [this example](/examples/puppeteer#scrape-content-from-a-web-page) using a proxy.
**WEB SCRAPING:** When web scraping, you MUST use a proxy to comply with our terms of service. Direct scraping of third-party websites without the site owner's permission using Trigger.dev Cloud is prohibited and will result in account suspension. See [this example](/guides/examples/puppeteer#scrape-content-from-a-web-page) using a proxy.
</Warning>