Announcing V2.0 of DBOS Transact for TypeScript

Today we are excited to announce the release of v2.0 of the open source DBOS Transact durable execution library for TypeScript. For the past two months, we've been hard at work rearchitecting the DBOS Transact library for TypeScript. Originally launched in March of 2024, version 2.0 of the library is much lighter weight, making it easier than ever to enhance your TypeScript apps with durable execution. Plus, now you can effortlessly add durable execution to any TypeScript app, whether you're using Next.js, Express, or other popular frameworks.

What does durable execution mean to TypeScript developers?

Durable execution means persisting the execution state of your program while it runs, so if it is ever interrupted or crashes, it automatically resumes from where it left off. In other words, the DBOS Transact durable execution library makes your code crashproof without you having to code a lot of error-handling and failure recovery scenarios.

Durable execution is useful for a lot of things:

  • Orchestrating workflows (e.g., order processing, ETL pipelines, Cron jobs, AI automation, etc.) that seamlessly recover from any failure.
  • Processing incoming events (e.g. from Kafka) exactly once
  • Building anything that connects to an unreliable or non-deterministic API.

Durable execution via a lightweight library, not an external server

What’s unique about the DBOS approach to durable execution is that it’s implemented in a lightweight library that uses any Postgres-compatible database to store state as your program executes. The Postgres database can be your application database.

All you have to do to use DBOS is “npm install” it and then annotate your program with decorators. The decorators store your program’s execution state in Postgres as it runs, and recover it if it crashes. There are no other dependencies you have to manage, no separate workflow server–just your program and Postgres. 

What’s new in v2.0 of DBOS Transact for TypeScript

The new release contains these major enhancements:

  • Major API simplification
  • Support for instantiating DBOS in any Node environment, including inside apps built with popular web frameworks like Express or Next.js.
  • New templates that highlight durable execution, including dbos-node-starter (built with Express) and dbos-nextjs-starter (built with Next.js).
  • Full support for durable queues and parallelism
  • A "database wizard" that walks users through the steps in connecting to Postgres

Plus lots of other enhancements and fixes. You can see them all in the release notes

Major API Simplification

Using DBOS Transact to make your application durable is much easier now - simply annotate ANY TypeScript application with lightweight "workflow" and "step" decorators: 

class Example {
    @DBOS.step()
    static async step_one() { ... }


    @DBOS.step()
    static async step_two() { ... }


    @DBOS.workflow()
    static async workflow() {
        await Example.step_one();
        await Example.step_two();
    }
}

Under the hood, this works by storing your program's execution state (which workflows are currently executing and which steps they've completed) in Postgres. If your program ever crashes, the state is retrieved on restart, and workflows automatically resume from the last completed step.

Improved Node Support

We’ve ensured that the DBOS Transact library is compatible with Node applications written with frameworks like Express and Next.js. We’ve also provided application templates to help you get started using DBOS with the frameworks:

You can initialize the starter apps with the templates, as follows:

npx @dbos-inc/create -t dbos-node-starter

Or, if you want to use the integration with Next.js:

npx @dbos-inc/create -t dbos-nextjs-starter

CLI Database Connection Wizard

The DBOS Transact library requires access to a Postgres-compatible database in which to store state information. If you start DBOS from the CLI, and no database connection is detected, DBOS will prompt you for DBMS connection settings.

Queuing and Parallelism Control

New support for queueing allows you to ensure that functions will be run, without starting them immediately. Queues are useful for controlling the number of functions run in parallel, or the rate at which functions are started.

Backwards compatibility with DBOS Transact V1.x for TypeScript

To make migration easier, if you’ve written a TypeScript application using an earlier version of DBOS Transact, you can run it with V2.0 of the library and on DBOS Cloud. 

Check it out!

TypeScript applications developed with DBOS Transact can run anywhere (as long as they have access to a Postgres-compatible database). You can also deploy them to AWS-based DBOS Cloud for free serverless app hosting and execution with auto-scaling, and a bunch of other goodies. 


Happy coding!