Skip to main content

Creating and Managing Jobs

Jobs are the core building blocks of the Trigger.dev integration. This guide explains how to create, organize, and manage jobs in your zopio application.

Job Structure

In the zopio framework, jobs are organized in a dedicated directory structure:

Creating a Job

To create a new job, follow these steps:
  1. Create a new file in the app/trigger/jobs directory or add to an existing file
  2. Import the necessary dependencies
  3. Define your job using the Trigger.dev client
Here’s an example of a basic job:

Job Types

Trigger.dev supports various types of jobs:

Event-Triggered Jobs

Jobs that run in response to specific events:

Scheduled Jobs

Jobs that run on a schedule:

Webhook-Triggered Jobs

Jobs that run in response to external webhooks:

Job Versioning

When updating a job, it’s important to increment the version number to ensure proper handling of in-flight jobs:

Job Organization

For larger applications, it’s recommended to organize jobs by domain:
  • user-jobs.ts - Jobs related to user management
  • payment-jobs.ts - Jobs related to payments
  • notification-jobs.ts - Jobs related to notifications
Make sure to export all job files from the index.ts file:

Job Dependencies

Jobs can depend on external services or integrations:

Testing Jobs

To test a job, you can send an event that triggers it:

Job Monitoring

You can monitor your jobs in the Trigger.dev dashboard, which provides:
  • Real-time job execution status
  • Detailed logs for each run
  • Performance metrics
  • Error tracking
For more information, visit the Trigger.dev documentation.