Skip to main content
The trigger.config.ts file lives at the root of your project and is the single source of truth for how your Trigger.dev project is configured and built. It exports a default configuration object created with defineConfig.
trigger.config.ts
The config file handles:
  • Specifying where your trigger tasks are located via the dirs option
  • Setting default retry policies
  • Configuring OpenTelemetry instrumentations and exporters
  • Customizing the build process and bundle
  • Adding global task lifecycle hooks
The config file is bundled with your project, so anything imported at the top level also ends up in the bundle — which can affect build times and cold start duration. Anything defined inside the build config is automatically stripped from the final bundle, and imports only used there are tree-shaken out.

project

Required. Your project reference, which you can find on the Project settings page in the Trigger.dev dashboard.
trigger.config.ts

dirs

An array of directory paths where your task files are located. Trigger.dev scans these directories for TypeScript and JavaScript files and includes them in the build.
trigger.config.ts
If you omit dirs, Trigger.dev will automatically detect directories named trigger in your project, but explicitly specifying them is recommended. You can pass multiple directories:
trigger.config.ts
Files with .test or .spec in their name are excluded automatically. Use ignorePatterns to add your own exclusion rules:
trigger.config.ts

tsconfig

A custom path to a tsconfig.json file. Useful when your project uses a non-standard tsconfig location.
trigger.config.ts

retries

Configures the default retry behavior for all tasks in the project. Individual tasks can override these settings.
trigger.config.ts

maxDuration

Sets the default maximum duration (in seconds) for all tasks. Tasks that exceed this duration will be killed. Individual tasks can override this value.
trigger.config.ts
Configure maxDuration per task or globally to control how long a task can run before it times out.

defaultMachine

The default machine preset to use for all tasks. Individual tasks can override this.
trigger.config.ts
See the machines documentation for available presets.

runtime

The runtime to use when executing tasks. Defaults to node. An experimental bun runtime is also available.
trigger.config.ts
The bun runtime uses Bun instead of Node.js to execute your tasks. See the Bun documentation for more about Bun compatibility.

logLevel

Controls which log levels are forwarded to Trigger.dev when using the logger API. All console.* calls are always forwarded regardless of this setting.
trigger.config.ts

enableConsoleLogging / disableConsoleInterceptor

Control console logging behavior in development:
trigger.config.ts

processKeepAlive

Keeps the worker process alive between task executions so subsequent tasks skip process startup time. The process may still be killed at any time — no guarantees are made about process lifetime.
trigger.config.ts
Or pass an object for granular control:
trigger.config.ts

extraCACerts

Path to a CA certificate file that will be added to NODE_EXTRA_CA_CERTS. Useful when running against a self-hosted Trigger.dev instance with a self-signed certificate. The path must start with ./ and be relative to the project root.
trigger.config.ts

legacyDevProcessCwdBehaviour

Controls how the working directory is set in development. When false, the working directory is set to the build directory, matching production behavior more closely.
trigger.config.ts

Lifecycle functions

Global lifecycle hooks that run for every task in the project. Use these for cross-cutting concerns like notifications, observability, or shared setup.
trigger.config.ts
See the tasks overview for more on lifecycle hooks.

telemetry

Trigger.dev uses OpenTelemetry (OTEL) for run logs. You can add instrumentations to automatically trace calls to libraries like Prisma, OpenAI, and more.

Instrumentations

trigger.config.ts
Recommended instrumentations:
@opentelemetry/instrumentation-fs which logs all file system calls is currently not supported.

Telemetry exporters

You can export traces, logs, and metrics to external observability services. Do not use OTEL_* environment variables — configure exporters directly in the constructor to avoid conflicts with Trigger.dev’s internal telemetry.
Axiom’s /v1/metrics endpoint only supports protobuf. Use @opentelemetry/exporter-metrics-otlp-proto instead of @opentelemetry/exporter-metrics-otlp-http for metrics when using Axiom. Axiom also requires a separate, dedicated dataset for metrics.

build

Customizes the esbuild-based build pipeline that packages your tasks for deployment.
trigger.config.ts
The build configuration is stripped from the final bundle. Imports only used inside the build config are also tree-shaken out, so they do not affect bundle size or cold start time.

build.external

All code is bundled by default. Use external to exclude packages — they will instead be listed in a dynamically generated package.json and installed at runtime. Specify package names, not import paths. For example, to exclude ai/rsc use "ai" not "ai/rsc":
trigger.config.ts
Packages that include native binaries (.node files) or use WebAssembly (WASM) must be added to external. Examples include re2, sharp, sqlite3, and any WASM packages. Attempting to bundle them will result in a build error.

build.jsx

Customize the JSX transform options passed to esbuild. By default, esbuild’s automatic JSX runtime is enabled, so you do not need to import React in JSX files.
trigger.config.ts

build.conditions

Add custom import conditions that affect how imports are resolved during the build. These conditions are also passed to the Node.js runtime.
trigger.config.ts

build.extensions

Build extensions hook into the build pipeline to customize how your project is built or what gets included in the container image. You can use the built-in extensions from @trigger.dev/build or write your own.
trigger.config.ts
See Build extensions overview for the full list of available extensions.