LibraryDocsBlogPricing
Log inSign up for free →

Workflows overview

On this page
  1. 1. What is a workflow?
  2. 2. How workflows are defined
  3. 3. How workflows are managed
  4. 4. For developers: workflow configuration details

Workflows are a core part of Inngest. They represent any logic that needs to happen either automatically when events are received, on a schedule, or manually by people in your team. They're the programmable part of the platform that allow you to build automated systems with zero infra.

For example, let's say a user returns an ecommerce order. A workflow will need to create a return label, send the label to the user, monitor to see the status of the return, update internal systems, and remind the user to return the product if they don't do so in a timely manner. It might need to do some of these steps in parallel. And some parts of the flow are depentent on future events.

This overview guides you through how to configure and manage workflows for requirements across all situations.

What is a workflow?

A workflow is configuration that defines two things:

  1. How a workflow should be triggered. Is this automatically every time we receive an event? On a schedule? Manually?
  2. The actions that a workflow should take. Actions can be anything: calling an API, refunding a customer, adding a task to Jira, or running your own code. The workflow defines the order for each action, including things that can happen at the same time (in parallel)

There's more to workflows under the hood (such as what happens if things fail, or saying that things should only run at most once per hour, even with thousands of events). The key items, though, are are the triggers and the actions.

Let's take the example above, in which a user wants to return an ecommerce order. We want to automatically run a workflow to generate a return label whenever a return is "initiated". We can create a workflow that's *triggered** from the return.initiated event. The workflow's actions can update your internal systems to show the order as in return. At the same time, it can create a new return label, then send the label to the customer via an email. It can also wait for the shipment.sent event for the return label (for up to 7 days) to track the return progress. And, if we don't see this event, the workflow can automatically reach out to the customer to remind them to send back the return.

How workflows are defined

Workflows are defined as code. It uses a statically typed configuration language called cue.

The Inngest platform has a visual editor for workflows when you edit a workflow visually, our platform automatically writes and formats the code for you. This allows you or your team members to easily understand workflows without technical skills and, if required, edit workflows without having to write code.

How workflows are managed

You can manage workflows via our platform's UI or via a command line tool. If you're editing workflow configuration code directly, you can save the code via the UI or use the CLI to push up local changes. This is great for CI/CD, ensuring that you automatically deploy versions when there are changes. You can see every workflow and all of its versions in our UI or by the CLI. Your workflow config can also be stored in your own version control system (eg. Git).

Drafts and pushing live

Workflows are saved to our platform as drafts, and 'pushed live' to enable them to run (by pressing a button to "publish"). If you need to make changes, you can edit a workflow and save it as a draft while keeping the old version running. The drafts can be edited and debugged without impacting your product.

You can also schedule new versions to go live at a specific time &mdash especially important for controlled rollouts or ensuring that new flows go into place for regulatory requirements.

Version management

Each workflow is fully versioned: if you make edits, you'll see a history of each change. You'l Workflows can be saved directly within our UI, whether you're using a visual editor or code.

Testing

When you're building workflows, you're going to want to test them. We have tooling built out specifically to make testing easy:

  • Test environments. Each workspace comes with a test mode, which stores entirely separate versions of workflows and events for your own test environment
  • Backtesting. You can select events that have been previously saved, then run workflows using these events.
  • Step-over debugger. When running a workflow you can also switch to a debug mode, which pauses workflows in between each step for you to fully inspect workflow state, action inputs, and action results.

For developers: workflow configuration details

Cue gives us a few advantages when defining workflows:

  • It's fully typed, so we can validate workflows locally and ensure the config is correct
  • It allows us to fully visualize the workflows as a graph. One of the core features of Inngest is easily understanding complex systems. Using the graph UI, you can hand off flows for maintenance to non-technical folk, or explain how your systems work to PMs within minutes.
  • It's easy to parse into concrete types, and to use these types to run our executor
  • It's better than YAML. If you love YAML we didn't mean to offend you! In our experience, it's never been fun or easy to parse.
  • It's better than JSON. With no types, no multiline strings, no trailing commas, JSON can be a pain to edit. Cue is strictly a superset of JSON, too, so it's familiar.

You might ask why we didn't use a programming language. Say, JS using async/await. While we're actively exploring this, it makes our system much more complex. Though you can parse the AST, using JS makes it much harder to represent the workflow as a graph than using Cue. It's also harder to build the executor; naively you might want to run the workflow using Node or Deno, but this doesn't let us fully parallelize branches, schedule actions in any language, and so on.

That said, it is on the roadmap to use an async/await JS SDK to define workflows which are converted into a serialized graph format - the best of both! If you're interested in this feel free to reach out, either in our discord community or by email (hello@inngest.com).

    On this page
  1. 1. What is a workflow?
  2. 2. How workflows are defined
  3. 3. How workflows are managed
  4. 4. For developers: workflow configuration details