Reusable Temporal Workflows With NestJS Modules

By Dan Goslen

Elevator Pitch

Adding Temporal to any app is a game-changer. But running your first Workflow requires a lot of boilerplate and context. We wondered: could we make this easier? In short, yes!

Learn how Vouch uses NestJS modules to simplify development by building reusable Temporal components and workflows!

Description

Adding Temporal to your app is a game-changer. Thankfully, it can be relatively straightforward for one application. But what if you plan to use Temporal across many applications? Copying configs and code from app to app is tedious and error-prone.

At Vouch we wondered: is there a better way to set up all of our applications with Temporal? Turns out there is!

This talk will walk participants through how we’ve used NestJS modules to build common Temporal components such as Workers, configuration, and shared Workflows. Concretely, we’ll cover:

  • The event-driven use cases Vouch utilizes Temporal to help solve
  • Why we wanted to build a reusable Workflow to encapsulate those use cases
  • The common challenges and boilerplate when adding Temporal to new apps
  • How using NestJS modules helped us solve those challenges

Participants will walk away with a cursory understanding of NestJS and ideas for how to build common Temporal components within their applications. We’ll also introduce patterns like the Inbox and Outbox patterns used in event-drive architecture and how a reusable Temporal Workflow can abstract and encapsulate the details of such patterns.

Notes

This talk centers around NestJS, an up-and-coming Node framework for building backend web applications quickly. We’ve made significant investments at Vouch into NestJS, building common components and relying heavily on the NestJS module concept.

We have relatively simple Temporal use cases, but those use cases are often shared across several applications for the same purpose. We’ve found that using these patterns has improved our general service stability/reliability and created a better developer experience for teams wishing to adopt Temporal. This has been a critical leverage point for allowing our teams to use Temporal easily and quickly, which is really important in a small team like ours.

Many smaller software shops likely have similar use cases to ours, and I believe our experience at Vouch could help showcase Temporal’s flexibility and reusability for such teams.