GithubHelp home page GithubHelp logo

geekwolverine / trigger.dev Goto Github PK

View Code? Open in Web Editor NEW

This project forked from triggerdotdev/trigger.dev

0.0 1.0 0.0 8.19 MB

The developer-first, open source Zapier Alternative. Coming soon.

Home Page: https://trigger.dev

License: Apache License 2.0

Shell 0.82% JavaScript 0.71% TypeScript 97.31% CSS 0.44% PLpgSQL 0.19% Dockerfile 0.53%

trigger.dev's Introduction


 

Logo

Twitter Follow

⚙️ Automate complex workflows with code

Trigger workflows from APIs, on a schedule, or on demand. API calls are easy with authentication handled for you. Add durable delays that survive server restarts.

Hero

💻 Developer-first features

In your codebase

Trigger.dev is code-first so you can create workflows where they belong: in your codebase. Version control, localhost, test, review, and deploy like you're used to.

Secure by design

Your workflows run on your servers, not ours. We only receive the data you choose to send to us.

 

Hundreds of Integrations

Subscribe to API changes and make requests, we’ll handle authentication for you.

 

🚀 Workflow examples

🔄 Sync GitHub issues to Linear

GitHub Linear

Triggered when a GitHub issue is created or updated. Query your database to map GitHub user ids to Linear user ids. Then create or update Linear issues.",

import { Trigger, github, linear } from "@trigger.dev/sdk";

new Trigger({
name: "Sync Github issues to Linear",
on: github.issueEvent({
    repo: "acme/website",
}),
run: async (event, ctx) => {
    const { issue, action } = event;

    // Find the user in our local database
    const assignee = await findUserByGithubId(issue.assignee?.id);

    if (action === "opened") {
    await linear.issueCreate({
        id: issue.id,
        title: issue.title,
        description: issue.body,
        assigneeId: assignee?.linearId,
        teamId: ctx.env.LINEAR_TEAM_ID,
    });
    } else {
    await linear.issueUpdate(issue.id, {
        assigneeId: assignee?.linearId,
        stateId:
        action === "closed"
            ? ctx.env.LINEAR_CLOSED_STATE_ID
            : ctx.env.LINEAR_OPEN_STATE_ID,
    });
    }
},
}).listen();

 

✉️ Send emails to new users

User Email Slack

Triggered on demand by your other code when a user is created. We wait for 3 hours then send a follow-up email if the user hasn’t completed onboarding yet.

import { Trigger, customEvent, slack, mailgun } from "@trigger.dev/sdk";

new Trigger({
  name: "Send Email to New Users",
  on: customEvent<UserEvent>({ name: "user.created" }),
  run: async (event, ctx) => {
    // Wait for 3 hours before continuing
    await ctx.waitFor({ hours: 3 });

    // Lookup user in the database
    const user = await findUserById(event.id);

    // only send email if user has not onboarded
    if (!user.hasOnboarded) {
      await mailgun.send({
        to: user.email,
        subject: "Welcome to our app!",
        body: `Welcome to our app ${user.name}!}`,
      });

      await slack.sendMessage({
        text: `Welcome email sent to ${user.email}`,
      });
    } else {
      await slack.sendMessage({
        text: `User ${user.email} has already onboarded`,
      });
    }
  },
}).listen();

 

🚨 Escalate critical incidents

Intercom Linear Slack PagerDuty

Triggered when an Intercom incident happens. We create a Linear issue, send a Slack message and, if it’s an urgent incident, we alert whoever is on call.

import { Trigger, intercom, linear, slack, pagerduty } from "@trigger.dev/sdk";

new Trigger({
  name: "Intercom Incident",
  on: intercom.newIncident(),
  run: async (event, ctx) => {
    // Find the customer in the database
    const customer = await db.query("SELECT * FROM users WHERE email = $1", [
      event.email,
    ]);

    // Create linear ticket
    const ticket = await linear.issueCreate({
      title: event.title,
      description: event.description,
      assigneeId: ctx.env.LINEAR_ASSIGNEE_ID,
      teamId: ctx.env.LINEAR_TEAM_ID,
    });

    // notify account manager
    await slack.sendMessage({
      text: `New incident for ${customer.name} in Linear: ${ticket.url}`,
    });

    if (event.severity === "urgent") {
      // Create a pagerduty incident
      await pagerduty.createIncident({
        title: event.title,
        description: event.description,
        severity: "critical",
        serviceId: ctx.env.PAGERDUTY_SERVICE_ID,
      });
    }
  },
}).listen();

 

⚡️ Trigger happy

Install our SDK and get instant access to an arsenal of triggers you can use in your code:

Webhooks

Subscribe to webhooks without creating API endpoints. Plus they work locally without tunneling.

github.issueEvent({ repo: "acme/website" })

Scheduled (CRON)

Easily subscribe to a recurring schedule using human readable code or CRON syntax.

scheduleEvent({ every: { minutes: 30 } })

Custom Events

Trigger workflows from any event in your app. Send us your events, and we'll do the rest.

customEvent<YourType>({ name: "your.event" })

HTTP Endpoint

Expose a HTTP endpoint to trigger your workflows with the method and path of your choice.

httpEvent<User>({ method: "POST", path: "/users/:id" })

Receive Emails

Receive emails from your custom domain and trigger a workflow with the email metadata and content.

emailEvent({ address: "[email protected]" })

AWS Event Bridge

Integrate with AWS Event Bridge to trigger workflows on your own Event Bridge events.

eventBridge<SupportRequest>({ bus: "customer-support" })

 

🔋 Batteries included

Debugging and visibility

We provide a full history of all runs, so you can see exactly what happened.

 

Runs

 


 

Survives downtime

Workflows pick up where they left off when your server or external APIs go down.

 

Retries

 

Go from idea to production in minutes

1. Code

Write workflows by creating triggers directly in your code. These can be 3rd-party integrations, custom events or on a schedule.

2. Connect

When your server runs, your workflow will be registered and you can authenticate with any APIs you’re using.

3. Test

When your server runs, your workflow will be registered and you can authenticate with any APIs you’re using.

3. Deploy

Deploy your new workflow as you would any other code commit and inspect each workflow run in real time.

 

✅ We ❤️ Open Source!

You’ll always be able to host and run Trigger.dev yourself.

We've also created JSON Hero, an open source JSON viewer used by around 55,000 developers per month.

 

🙋 FAQs

Does my data get sent to your servers?

Only what you choose to send. The main body of your workflow code runs on your infrastructure. For example when you do a database query, that never touches us.

Data we will receive (and store to display on the Runs page in your dashboard):

  • Any data that triggers the start of a workflow
  • Any data you pass to one of our API integrations • Any data you choose to log using our logging function
How is this different to Zapier, Pipedream etc?

Trigger.dev is a code-first workflow tool that lets you create workflows directly in your code, rather than using a UI builder like Zapier. This means you can stay in your own IDE and keep your internal data secure.

How long does this take to set up?

Setting up Trigger.dev is simple and takes 2 minutes. Install our SDK to get started and check out the Getting Started documentation to start creating your first workflow.

Can I use version control or roll-backs?

Yes. You create workflows directly in your own code so it’s version controlled with everything else.

How long does it take to code up a workflow?

A simple workflow triggering two events from different services will take about 5 minutes to create.

Do you have all the integrations I need?

Probably. Trigger.dev includes over 100 integrations including the most popular services. If you need a specific service that’s not available, you can request it, or create it yourself. We’re open source, so create an issue or Pull Request.

Can I build complex workflows?

Yes. There’s no limit to the complexity on workflows you can create. Workflows are created in code so you can write conditional, looping, branching or time delayed logic.

Can I run Trigger.dev locally?

Yes. Workflows are created in your code locally and, unlike webhooks, you don’t need to use tunneling to receive triggers.

How does the pricing model work?

Our hosted product gives you free runs each month, after that you will need to select a paid tier. You can also self-host, view the open source repository for instructions.

Is Trigger.dev open source?

Yes, Trigger.dev is open source. We are strong supporters of open source software, and our first product, jsonhero.io, has a thriving open source community. Trigger.dev follows in that tradition.

Is Trigger.dev a no/low-code tool?

No. Trigger.dev is designed for developers who want to create workflows directly in code, without using a UI builder like Zapier. This allows developers to stay in their familiar development environment and customise their workflows with code.

What languages / frameworks do you support?

Currently there is support for Node.js. More frameworks will be added soon.

Can I use an API which doesn’t have webhooks?

Yes. You can use a polling trigger to subscribe is no webhook exists.

Can non-coders use this product?

Developers will need to create workflows. Anyone on the team can monitor running workflows in the Trigger dashboard.

 

 

If you have any other questions about Trigger.dev, drop us an email, and one of the founders will get back to you.

trigger.dev's People

Contributors

d-k-p avatar ericallam avatar handotdev avatar matt-aitken avatar samejr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.