Skip to content

triggerdotdev/jobs-showcase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trigger.dev logo

Trigger.dev Jobs Showcase

This repository contains a collection of code-only Jobs that can be run using Trigger.dev. It is a great place to start if you want to see how to use Trigger.dev and our integrations in your own projects.

For full project examples using Trigger.dev, check out our Examples repo.

About Trigger.dev

Trigger.dev is a framework for creating long-running Jobs directly in your Next.js app with API integrations, webhooks, scheduling and delays. You can reliably run Jobs that wouldn’t normally work in serverless environments (like Vercel) because of timeouts.

Jobs in this repo:

The Jobs can be run locally using the @trigger.dev/cli and @trigger.dev/express packages.

Title Description Integrations Contributor
Cron scheduled basic A scheduled Job which runs at 2:30pm every Monday. None Trigger.dev
Delay example joke Logs a message to the console, waits for 5 minutes, and then logs another message. None Trigger.dev
GitHub: issue reminder Sends a Slack message to a channel if a GitHub issue is left open for 24 hours. GitHub, Slack Trigger.dev
GitHub: new issue opened Runs when a new issue is opened on a repo. Once created, it will add a 'Bug' label to the issue. GitHub Trigger.dev
Linear: create issue on new PR Creates a new Linear issue when a pull request is opened on a GitHub repo. Linear, GitHub Trigger.dev
Linear: daily summary of issues on Slack Post 'In Progress' Linear issues to a Slack channel every weekday at 9am. Linear, Slack Trigger.dev
Linear: automatically reply to new issues Automatically comments and likes any new Linear issue. Linear nicktrn
OpenAI: generate image Generate an image from a prompt, using OpenAI. OpenAI Trigger.dev
OpenAI: tell me a joke Generate a joke from a prompt, using OpenAI. OpenAI Trigger.dev
Plain: update custom Updates a customer's details. Plain Trigger.dev
Resend: send React email Sends a basic email with Resend, built using React & Typescript. Resend Trigger.dev
Resend: drip campaign Sends an email drip campaign over 30 days with Resend, emails built using React & Typescript. Resend Trigger.dev
Resend: send basic email Sends a basic email using Resend. Resend Trigger.dev
Replicate cinematic prompt Create a cinematic image using Replicate. Replicate Trigger.dev
Scheduled interval basic Runs every 60 seconds, starting 60 seconds after this Job is first indexed. None Trigger.dev
SendGrid: send basic email Sends a basic email using SendGrid. SendGrid OshriAsulin
Slack: post message Posts a message to a Slack channel. Slack Trigger.dev
Stripe: on subscription created Runs when a new subscription is created in Stripe. Stripe Trigger.dev
Stripe: on new subscription update Airtable When a new customer creates a Stripe subscription, an Airtable table is populated with their details. Stripe Airtable Trigger.dev
Supabase: update database when a Stripe account is updated Update a Supabase table when a Stripe account is updated. Supabase, Stripe gjohnsx
Supabase: Generate blog title Generate blog title using OpenAi. Supabase, OpenAI Trigger.dev
Supabase: AI image uploads Do something with AI to image uploads. Supabase, OpenAI Trigger.dev
Supabase auth & onboarding emails When a user confirms their email using Supabase Auth, send a drip campaign using Resend Supabase, Resend gjohnsx
Summarize yesterdays GitHub commits on Slack Summarize yesterdays GitHub commits using OpenAI, and then post them to a Slack channel. GitHub, OpenAI, Slack gjohnsx
Sync Stripe with Airtable Update an Airtable table every time a sale is made in Stripe. Airtable, Stripe gjohnsx
Update Airtable on Typeform submission Add a new record to an Airtable table when a new Typeform response is submitted. Airtable, Typeform meetwithyash
Weekly user activity summary Sends a weekly summary email to users and then posts the total numbers to Slack. SendGrid, Slack Trigger.dev

Setup: how to use this repo

You will need to create a .env file. You can duplicate the contents of .env.example file and set your local (Dev 'server') TRIGGER_API_KEY value. You can find your API key in your project's integrations page in the app. Add other API keys as needed.

Install packages

First, install the packages:

npm i

Running a job

Each file in src is either a Job or a separate set of jobs that can be run separately. For example, the src/cronScheduledBasic.ts file can be run with:

npm run cron-scheduled-basic

This will open up a local server using express on port 8080. Then in a separate terminal window you can run the @trigger.dev/cli dev command:

npm run dev:trigger

Contributors guide

You can add a new file to src with it's own TriggerClient and set of jobs (e.g. src/events.ts)

import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
import { createExpressServer } from "@trigger.dev/express";
import { z } from "zod";

export const client = new TriggerClient({ id: "jobs-showcase" });

client.defineJob({
  id: "example-job-1",
  name: "Example Job 1",
  version: "0.1.0",
  trigger: eventTrigger({
    name: "example.one",
  }),
  run: async (payload, io, ctx) => {},
});

createExpressServer(client);

Then add a new script in package.json:

{
  "scripts": {
    "events": "nodemon --watch src/events.ts -r tsconfig-paths/register -r dotenv/config src/events.ts"
  }
}

About

⚡️ An ever-growing library of Trigger.dev jobs for anyone to use and contribute to.

Topics

Resources

Code of conduct

Stars

Watchers

Forks