Files
nicktrn 0631c8373c chore: retire legacy v3 dev websocket + delete legacy self-hosting docs (#4198)
Follow-up to #4194 (v3 execution app + core-helper removal). The v3
(engine V1) is end-of-lifed and enforced off in prod, so this removes a
self-contained slice of the remaining dead v3 code while **keeping every
user-facing deprecation message** - a user still on v3 must still be
told to upgrade.

## Legacy dev websocket

`app/v3/handleWebsockets.server.ts` backs the `/ws` transport used
**only** by the legacy v3 `trigger dev` CLI (v4 dev uses a different
transport). It's now authenticate-then-close with
`V3_DEV_DEPRECATION_MESSAGE`, so an old CLI is still told what to do -
only the legacy `AuthenticatedSocketConnection` / `DevQueueConsumer`
execution behind it (which can no longer run) is removed.

- Deleted `app/v3/authenticatedSocketConnection.server.ts` (its only
consumer).
- `engineDeprecation.server.ts` and the deprecation message constants
are untouched.

## Docs

Deleted the intentionally-legacy "Docker (legacy)" self-hosting page
(`open-source-self-hosting.mdx`) and redirected
`/open-source-self-hosting` (+ the existing
`/v3/open-source-self-hosting` alias) to `/self-hosting/overview`;
repointed the two inbound links. The current `self-hosting/*` docs
already describe the v4 (single supervisor) setup.

## Deliberately out of scope

Despite the branch name, this PR does **not** touch MarQS or the
socket.io coordinator/provider namespaces. Investigation found MarQS is
entangled with **live v2** queue/metrics/concurrency/project-cleanup
code (`runQueue`, `queueSizeLimits`, `taskRunConcurrencyTracker`,
`EnvironmentQueuePresenter`, `registerProjectMetrics`, `deleteProject`),
so it needs a per-file reviewed pass, not a bulk delete. That remainder
stays on TRI-11883.

refs TRI-11883
2026-07-09 14:40:44 +01:00

98 lines
3.7 KiB
Plaintext

---
title: "Quick start: add Trigger.dev to your project"
sidebarTitle: "Quick start"
description: "Set up Trigger.dev in your existing project in under 3 minutes. Install the SDK, create your first background task, and trigger it from your code."
---
import CliInitStep from "/snippets/step-cli-init.mdx";
import CliDevStep from "/snippets/step-cli-dev.mdx";
import CliRunTestStep from "/snippets/step-run-test.mdx";
import CliViewRunStep from "/snippets/step-view-run.mdx";
## Set up with AI
Using an AI coding assistant? Copy this prompt and paste it into Claude Code, Cursor, Copilot, Windsurf, or any AI tool. It'll handle the setup for you.
<Accordion title="Copy the setup prompt">
```text
Help me add Trigger.dev to this project.
## What to do
1. I need a Trigger.dev account. If I don't have one, point me to https://cloud.trigger.dev to sign up. Wait for me to confirm.
2. Run `npx trigger.dev@latest init` in the project root.
- When it asks about the MCP server, recommend I install it (best DX: gives you direct access to Trigger.dev docs, deploys, and run monitoring).
- Install the "Hello World" example task when prompted.
3. Run `npx trigger.dev@latest dev` to start the dev server.
4. Once the dev server is running, test the example task from the Trigger.dev dashboard.
5. Set TRIGGER_SECRET_KEY in my .env file (or .env.local for Next.js). I can find it on the API Keys page in the dashboard.
6. Ask me what framework I'm using and show me how to trigger the task from my backend code.
If I've already run init and want the MCP server, run: npx trigger.dev@latest install-mcp
## Critical rules
- ALWAYS import from `@trigger.dev/sdk`. NEVER import from `@trigger.dev/sdk/v3`.
- NEVER use `client.defineJob()` — that's the deprecated v2 API.
- Use type-only imports when triggering from backend code to avoid bundling task code:
import type { myTask } from "./trigger/example";
import { tasks } from "@trigger.dev/sdk";
const handle = await tasks.trigger<typeof myTask>("hello-world", { message: "Hello from my app!" });
## When done, point me to
- Writing tasks: https://trigger.dev/docs/tasks/overview
- Real-time updates: https://trigger.dev/docs/realtime/overview
- AI tooling: https://trigger.dev/docs/building-with-ai
```
</Accordion>
## Manual setup
<Steps titleSize="h3">
<Step title="Create a Trigger.dev account">
Sign up at [Trigger.dev Cloud](https://cloud.trigger.dev) (or [self-host](/self-hosting/overview)). The onboarding flow will guide you through creating your first organization and project.
</Step>
<CliInitStep />
<CliDevStep />
<CliRunTestStep />
<CliViewRunStep />
</Steps>
## Triggering tasks from your app
The test page in the dashboard is great for verifying your task works. To trigger tasks from your own code, you'll need to set the `TRIGGER_SECRET_KEY` environment variable. Grab it from the API Keys page in the dashboard and add it to your `.env` file.
```bash .env
TRIGGER_SECRET_KEY=tr_dev_...
```
See [Triggering](/triggering) for the full guide, or jump straight to framework-specific setup for [Next.js](/guides/frameworks/nextjs), [Remix](/guides/frameworks/remix), or [Node.js](/guides/frameworks/nodejs).
## Next steps
<CardGroup cols={2}>
<Card title="Building with AI" icon="brain" href="/building-with-ai">
Build Trigger.dev projects using AI coding assistants
</Card>
<Card title="How to trigger your tasks" icon="bolt" href="/triggering">
Trigger tasks from your backend code
</Card>
<Card title="Writing tasks" icon="wand-magic-sparkles" href="/tasks/overview">
Task options, lifecycle hooks, retries, and queues
</Card>
<Card title="Guides and example projects" icon="books" href="/guides/introduction">
Framework guides and working example repos
</Card>
</CardGroup>