Skip to content

Order Processing with Temporal and Encore #117

@ivancernja

Description

@ivancernja

Project link

https://encore.dev/blog/temporal-tutorial

Language

TypeScript

Short description (max 256 chars)

An order processing backend that combines Temporal’s durable workflows with Encore’s automatic API and infrastructure provisioning. It walks you through a multi-step workflow with payment and shipping, plus a saga-style refund path when something fails downstream.

Long Description

A tutorial showing how to combine Temporal and Encore to build a real backend with durable workflows on top of auto-provisioned infrastructure. The example is an order processing flow that creates an order, checks inventory, processes payment, ships it, and sends a confirmation email, with a saga-style refund triggered automatically if shipping fails after payment has already succeeded.

On the Temporal side, the workflow handles all the orchestration logic with automatic retries and crash recovery, while activities run as regular async functions that call into Encore services via type-safe clients. The workflow itself executes inside Temporal’s deterministic V8 isolate, and any side effect that touches the outside world is delegated to an activity so the workflow can be safely replayed after a failure.

On the Encore side, the API layer is generated from the function signatures and the Postgres database is provisioned automatically (Docker locally, RDS or Cloud SQL in production). Service-to-service calls and distributed tracing come out of the box, and deployment is a single git push without any Terraform or Dockerfile to maintain.

The full source is on GitHub and includes a one-click deploy to Encore Cloud, so Temporal users who want to put a workflow behind a real API and database can get a running setup in minutes instead of spending the first day on plumbing.

Author(s)

Encore (Ivan Cernja)

Metadata

Metadata

Assignees

Labels

code exchange submissionCode and/or content about Temporal!triageIssues that Temporal folk need to look at

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions