{"id":22489007,"url":"https://github.com/dbos-inc/dbos-transact-ts","last_synced_at":"2026-03-17T21:34:51.502Z","repository":{"id":199986259,"uuid":"665638731","full_name":"dbos-inc/dbos-transact-ts","owner":"dbos-inc","description":"Lightweight Durable TypeScript Workflows","archived":false,"fork":false,"pushed_at":"2026-01-12T22:19:02.000Z","size":5127,"stargazers_count":1058,"open_issues_count":16,"forks_count":67,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-01-12T23:08:28.507Z","etag":null,"topics":["agentic-workflow","cronjob-scheduler","dbos","durable-execution","durable-workflows","microservices-orchestration","orchestration","postgresql","typescript","workflow-engine","workflows"],"latest_commit_sha":null,"homepage":"https://docs.dbos.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbos-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-12T16:43:49.000Z","updated_at":"2026-01-12T22:49:11.000Z","dependencies_parsed_at":"2023-11-20T16:29:14.459Z","dependency_job_id":"816e2885-1160-4d13-aade-c3d9824438e0","html_url":"https://github.com/dbos-inc/dbos-transact-ts","commit_stats":{"total_commits":578,"total_committers":16,"mean_commits":36.125,"dds":0.7145328719723183,"last_synced_commit":"1c9178b65ba1e5bef91cd443680b6e280104b351"},"previous_names":["dbos-inc/operon","dbos-inc/dbos-ts","dbos-inc/dbos-transact","dbos-inc/dbos-transact-ts"],"tags_count":62,"template":false,"template_full_name":null,"purl":"pkg:github/dbos-inc/dbos-transact-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbos-inc%2Fdbos-transact-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbos-inc%2Fdbos-transact-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbos-inc%2Fdbos-transact-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbos-inc%2Fdbos-transact-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbos-inc","download_url":"https://codeload.github.com/dbos-inc/dbos-transact-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbos-inc%2Fdbos-transact-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28494122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-workflow","cronjob-scheduler","dbos","durable-execution","durable-workflows","microservices-orchestration","orchestration","postgresql","typescript","workflow-engine","workflows"],"created_at":"2024-12-06T17:19:04.993Z","updated_at":"2026-01-19T19:05:25.158Z","avatar_url":"https://github.com/dbos-inc.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/dbos-inc/dbos-transact-ts/on_push.yml?query=branch%3Amain)](https://github.com/dbos-inc/dbos-transact-ts/actions/workflows/on_push.yml)\n[![NPM Version](https://img.shields.io/npm/v/%40dbos-inc%2Fdbos-sdk)](https://www.npmjs.com/package/@dbos-inc/dbos-sdk)\n[![Node Current](https://img.shields.io/node/v/%40dbos-inc%2Fdbos-sdk)](https://www.npmjs.com/package/@dbos-inc/dbos-sdk)\n[![License (MIT)](https://img.shields.io/github/license/dbos-inc/dbos-transact-ts.svg?v)](LICENSE)\n[![Join Discord](https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord\u0026logoColor=white)](https://discord.com/invite/jsmC6pXGgX)\n\n# DBOS Transact: Lightweight Durable Workflows\n\n#### [Documentation](https://docs.dbos.dev/) \u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp; [Examples](https://docs.dbos.dev/examples) \u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp; [Github](https://github.com/dbos-inc) \u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp; [Discord](https://discord.com/invite/jsmC6pXGgX)\n\n\u003c/div\u003e\n\n---\n\n## What is DBOS?\n\nDBOS provides lightweight durable workflows built on top of Postgres.\nInstead of managing your own workflow orchestrator or task queue system, you can use DBOS to add durable workflows and queues to your program in just a few lines of code.\n\nTo get started, follow the [quickstart](https://docs.dbos.dev/quickstart) to install this open-source library and connect it to a Postgres database.\nThen, annotate workflows and steps in your program to make it durable!\nThat's all you need to do\u0026mdash;DBOS is entirely contained in this open-source library, there's no additional infrastructure for you to configure or manage.\n\n## When Should I Use DBOS?\n\nYou should consider using DBOS if your application needs to **reliably handle failures**.\nFor example, you might be building a payments service that must reliably process transactions even if servers crash mid-operation, or a long-running data pipeline that needs to resume seamlessly from checkpoints rather than restart from the beginning when interrupted.\n\nHandling failures is costly and complicated, requiring complex state management and recovery logic as well as heavyweight tools like external orchestration services.\nDBOS makes it simpler: annotate your code to checkpoint it in Postgres and automatically recover from any failure.\nDBOS also provides powerful Postgres-backed primitives that makes it easier to write and operate reliable code, including durable queues, notifications, scheduling, event processing, and programmatic workflow management.\n\n## Features\n\n\u003cdetails open\u003e\u003csummary\u003e\u003cstrong\u003e💾 Durable Workflows\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nDBOS workflows make your program **durable** by checkpointing its state in Postgres.\nIf your program ever fails, when it restarts all your workflows will automatically resume from the last completed step.\n\nYou add durable workflows to your existing TypeScript program by registering ordinary functions as workflows and steps:\n\n```ts\nasync function stepOne() {\n  DBOS.logger.info('Step one completed!');\n}\n\nasync function stepTwo() {\n  DBOS.logger.info('Step two completed!');\n}\n\nasync function workflowFunction() {\n  await DBOS.runStep(stepOne);\n  await DBOS.runStep(stepTwo);\n}\nconst workflow = DBOS.registerWorkflow(workflowFunction);\n```\n\nWorkflows are particularly useful for\n\n- Orchestrating business processes so they seamlessly recover from any failure.\n- Building observable and fault-tolerant data pipelines.\n- Operating an AI agent, or any application that relies on unreliable or non-deterministic APIs.\n\n[Read more ↗️](https://docs.dbos.dev/typescript/tutorials/workflow-tutorial)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e📒 Durable Queues\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nDBOS queues help you **durably** run tasks in the background.\nYou can enqueue a task (which can be a single step or an entire workflow) from a durable workflow and one of your processes will pick it up for execution.\nDBOS manages the execution of your tasks: it guarantees that tasks complete, and that their callers get their results without needing to resubmit them, even if your application is interrupted.\n\nQueues also provide flow control, so you can limit the concurrency of your tasks on a per-queue or per-process basis.\nYou can also set timeouts for tasks, rate limit how often queued tasks are executed, deduplicate tasks, or prioritize tasks.\n\nYou can add queues to your workflows in just a couple lines of code.\nThey don't require a separate queueing service or message broker\u0026mdash;just Postgres.\n\n```ts\nimport { DBOS, WorkflowQueue } from '@dbos-inc/dbos-sdk';\n\nconst queue = new WorkflowQueue('example_queue');\n\nasync function taskFunction(task) {\n  // ...\n}\nconst taskWorkflow = DBOS.registerWorkflow(taskFunction, { name: 'taskWorkflow' });\n\nasync function queueFunction(tasks) {\n  const handles = [];\n\n  // Enqueue each task so all tasks are processed concurrently.\n  for (const task of tasks) {\n    handles.push(await DBOS.startWorkflow(taskWorkflow, { queueName: queue.name })(task));\n  }\n\n  // Wait for each task to complete and retrieve its result.\n  // Return the results of all tasks.\n  const results = [];\n  for (const h of handles) {\n    results.push(await h.getResult());\n  }\n  return results;\n}\nconst queueWorkflow = DBOS.registerWorkflow(queueFunction, { name: 'queueWorkflow' });\n```\n\n[Read more ↗️](https://docs.dbos.dev/typescript/tutorials/queue-tutorial)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e⚙️ Programmatic Workflow Management\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nYour workflows are stored as rows in a Postgres table, so you have full programmatic control over them.\nWrite scripts to query workflow executions, batch pause or resume workflows, or even restart failed workflows from a specific step.\nHandle bugs or failures that affect thousands of workflows with power and flexibility.\n\n```ts\n// Create a DBOS client connected to your Postgres database\nconst client = await DBOSClient.create({ systemDatabaseUrl: process.env.DBOS_SYSTEM_DATABASE_URL! });\n\n// Find all workflows that errored between 3:00 and 5:00 AM UTC on 2025-04-22\nconst workflows = await DBOS.listWorkflows({\n  status: 'ERROR',\n  startTime: '2025-04-22T03:00:00Z',\n  endTime: '2025-04-22T05:00:00Z',\n});\n\nfor (const workflow of workflows) {\n  // Check which workflows failed due to an outage in a service called from Step 2\n  const steps = await DBOS.listWorkflowSteps(workflow.workflowID);\n  if (steps.length \u003e= 3 \u0026\u0026 steps[2].error instanceof ServiceOutage) {\n    // To recover from the outage, restart those workflows from Step 2\n    await DBOS.forkWorkflow(workflow.workflowID, 2);\n  }\n}\n```\n\n[Read more ↗️](https://docs.dbos.dev/typescript/reference/client)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e🎫 Exactly-Once Event Processing\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nUse DBOS to build reliable webhooks, event listeners, or Kafka consumers by starting a workflow exactly-once in response to an event.\nAcknowledge the event immediately while reliably processing it in the background.\n\nFor example:\n\n```ts\nasync function handleMessage(request: Request): void {\n  const eventId = request.body['event_id'];\n  // Use the event ID as an idempotency key to start the workflow exactly-once\n  await DBOS.startWorkflow(messageWorkflow, { workflowID: eventId })(request.body['event']);\n}\n```\n\n[Read more ↗️](https://docs.dbos.dev/typescript/tutorials/workflow-tutorial)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e📅 Durable Scheduling\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nSchedule workflows using cron syntax, or use durable sleep to pause workflows for as long as you like (even days or weeks) before executing.\n\nYou can schedule a workflow ina single line of code:\n\n```ts\nasync function scheduledFunction(schedTime: Date, startTime: Date) {\n  DBOS.logger.info(`I am a workflow scheduled to run every 30 seconds`);\n}\n\nconst scheduledWorkflow = DBOS.registerWorkflow(scheduledFunction);\nDBOS.registerScheduled(scheduledWorkflow, { crontab: '*/30 * * * * *' });\n```\n\nYou can add a durable sleep to any workflow with a single line of code.\nIt stores its wakeup time in Postgres so the workflow sleeps through any interruption or restart, then always resumes on schedule.\n\n```ts\nasync function reminderWorkflowFunction(email: string, timeToSleep: number): Promise\u003cvoid\u003e {\n  await DBOS.runStep(() =\u003e sendConfirmationEmail(email));\n  await DBOS.sleep(timeToSleep);\n  await DBOS.runStep(() =\u003e sendReminderEmail(email));\n}\nconst reminderWorkflow = DBOS.registerWorkflow(reminderWorkflowFunction);\n```\n\n[Read more ↗️](https://docs.dbos.dev/typescript/tutorials/scheduled-workflows)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e📫 Durable Notifications\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nPause your workflow executions until a notification is received, or emit events from your workflow to send progress updates to external clients.\nAll notifications are stored in Postgres, so they can be sent and received with exactly-once semantics.\nSet durable timeouts when waiting for events, so you can wait for as long as you like (even days or weeks) through interruptions or restarts, then resume once a notification arrives or the timeout is reached.\n\nFor example, build a reliable billing workflow that durably waits for a notification from a payments service, processing it exactly-once:\n\n```ts\nasync function billingWorkflowFunction(): Promise\u003cvoid\u003e {\n  // ... Calculate the charge, then submit the bill to a payments service\n  const paymentStatus = await DBOS.recv\u003cstring\u003e(PAYMENT_STATUS, paymentServiceTimeout);\n  if (paymentStatus !== null \u0026\u0026 paymentStatus === 'paid') {\n    // ... Handle a successful payment.\n  } else {\n    // ... Handle a failed payment or timeout.\n  }\n}\nconst billingWorkflow = DBOS.registerWorkflow(billingWorkflowFunction);\n```\n\n\u003c/details\u003e\n\n## Getting Started\n\nTo get started, follow the [quickstart](https://docs.dbos.dev/quickstart) to install this open-source library and connect it to a Postgres database.\nThen, check out the [programming guide](https://docs.dbos.dev/typescript/programming-guide) to learn how to build with durable workflows and queues.\n\n## Documentation\n\n[https://docs.dbos.dev](https://docs.dbos.dev)\n\n## Examples\n\n[https://docs.dbos.dev/examples](https://docs.dbos.dev/examples)\n\n## DBOS vs. Other Systems\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eDBOS vs. Temporal\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nBoth DBOS and Temporal provide durable execution, but DBOS is implemented in a lightweight Postgres-backed library whereas Temporal is implemented in an externally orchestrated server.\n\nYou can add DBOS to your program by installing this open-source library, connecting it to Postgres, and annotating workflows and steps.\nBy contrast, to add Temporal to your program, you must rearchitect your program to move your workflows and steps (activities) to a Temporal worker, configure a Temporal server to orchestrate those workflows, and access your workflows only through a Temporal client.\n[This blog post](https://www.dbos.dev/blog/durable-execution-coding-comparison) makes the comparison in more detail.\n\n**When to use DBOS:** You need to add durable workflows to your applications with minimal rearchitecting, or you are using Postgres.\n\n**When to use Temporal:** You don't want to add Postgres to your stack, or you need a language DBOS doesn't support yet.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eDBOS vs. Airflow\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nDBOS and Airflow both provide workflow abstractions.\nAirflow is targeted at data science use cases, providing many out-of-the-box connectors but requiring workflows be written as explicit DAGs and externally orchestrating them from an Airflow cluster.\nAirflow is designed for batch operations and does not provide good performance for streaming or real-time use cases.\nDBOS is general-purpose, but is often used for data pipelines, allowing developers to write workflows as code and requiring no infrastructure except Postgres.\n\n**When to use DBOS:** You need the flexibility of writing workflows as code, or you need higher performance than Airflow is capable of (particularly for streaming or real-time use cases).\n\n**When to use Airflow:** You need Airflow's ecosystem of connectors.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eDBOS vs. BullMQ\u003c/strong\u003e\u003c/summary\u003e\n\n####\n\nDBOS provides a similar queue abstraction to dedicated queueing systems like BullMQ: you can declare queues, submit tasks to them, and control their flow with concurrency limits, rate limits, timeouts, prioritization, etc.\nHowever, DBOS queues are **durable and Postgres-backed** and integrate with durable workflows.\nFor example, in DBOS you can write a durable workflow that enqueues a thousand tasks and waits for their results.\nDBOS checkpoints the workflow and each of its tasks in Postgres, guaranteeing that even if failures or interruptions occur, the tasks will complete and the workflow will collect their results.\nBy contrast, BullMQ is Redis-backed and don't provide workflows, so they provide fewer guarantees but better performance.\n\n**When to use DBOS:** You need the reliability of enqueueing tasks from durable workflows.\n\n**When to use BullMQ**: You don't need durability, you need very high throughput beyond what your Postgres server can support, or you need to manually fetch jobs (DBOS queues are push-based).\n\n\u003c/details\u003e\n\n## Community\n\nIf you want to ask questions or hang out with the community, join us on [Discord](https://discord.gg/fMwQjeW5zg)!\nIf you see a bug or have a feature request, don't hesitate to open an issue here on GitHub.\nIf you're interested in contributing, check out our [contributions guide](./CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbos-inc%2Fdbos-transact-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbos-inc%2Fdbos-transact-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbos-inc%2Fdbos-transact-ts/lists"}