Skip to main content

Why DBOS?

DBOS is an open-source library for building reliable and fault-tolerant applications.

Let's look at a common situation where reliability is critical. Imagine you're running an e-commerce platform where an order goes through multiple steps:

Durable Workflow

This program looks simple, but making it reliable is deceptively difficult. Here are two out of many potential problems:

  • Your program crashes after step 1, "Validate Payment". The customer has been charged, but their order is never shipped.
  • You get to step 2, "Check Inventory", and you're out of stock. You need to wait 24 hours for the new inventory before you can ship your order. You need that step to sleep for a day.

These situations can cause hours (or even days!) of debugging and may require deep distributed systems expertise to solve. DBOS makes them easier to solve because you can add decorators like DBOS.workflow() and DBOS.step() to your program:

@DBOS.step()
def validate_payment():
...

@DBOS.workflow()
def checkout_workflow()
validate_payment()
check_inventory()
ship_order()
notify_customer()

These decorators durably execute your program, persisting its state to a Postgres database:

Durable Workflow

You can think of this stored state as a checkpoint for your program. If your program is ever interrupted or crashes, DBOS uses this saved state to recover it from the last completed step. For example, if your checkout workflow crashes right after validating payment, instead of the order being lost forever, DBOS recovers from a checkpoint and goes on to ship the order. Thus, DBOS makes your application resilient to any failure.

DBOS Is Lightweight

All you need to use DBOS is install the open-source DBOS Transact library (Python, TypeScript).

You can run these commands to quickly try out a DBOS demo yourself:

pip install dbos
dbos init
dbos start

To add DBOS to your application, simply annotate workflows and steps in your program like this:

@DBOS.step()
def step_one():
...

@DBOS.step()
def step_two():
...

@DBOS.workflow()
def workflow()
step_one()
step_two()

If your program is ever interrupted or crashed, all your workflows automatically resume from the last completed step.

Use Cases

DBOS helps you write complex programs in remarkably few lines of code. For example:

Write business logic in normal code, with branches, loops, subtasks, and retries. DBOS makes it resilient to any failure.

See an example ↗️

@DBOS.step()
def validate_payment():
...

@DBOS.workflow()
def checkout_workflow()
validate_payment()
check_inventory()
ship_order()
notify_customer()

DBOS Cloud

Any program you build with DBOS you can deploy for free to DBOS Cloud. You can deploy any program with a single command—no configuration required. Your program runs the same in the cloud as it does locally, but operating it is much simpler thanks to:

  • No servers to manage: We serverlessly deploy your applications for you.
  • Autoscaling: Your application automatically scales with load, potentially to millions of users.
  • Pay only for the CPU time you actually use: Pay only when you're using your app, and nothing at all for idle time.
  • Built-in observability: View your logs and traces and manage your application from the cloud console.
note

Thanks to Paul Copplestone from Supabase, whose blog post on DBOS inspired this page.