Temporal: Workflows That Survive Anything
Temporal is a durable execution platform. Write workflow code in Go, Java, Python, or TypeScript — Temporal guarantees it completes even through server crashes, network failures, and deployments.
The Problem
Distributed systems fail. Network timeouts, service crashes, deploys mid-transaction. Without Temporal, you build retry logic, state machines, dead letter queues, compensation handlers. With Temporal, you write normal code.
The Free API
TypeScript Workflow
import { proxyActivities, sleep } from "@temporalio/workflow";
const { sendEmail, chargeCard, shipOrder } = proxyActivities({
startToCloseTimeout: "30s",
retry: { maximumAttempts: 5 }
});
export async function orderWorkflow(order: Order): Promise<string> {
// Each step is durable — survives crashes
await chargeCard(order.payment);
await sendEmail(order.email, "Payment received!");
// Wait 24 hours (Temporal handles this, not a cron)
await sleep("24h");
await shipOrder(order.items);
await sendEmail(order.email, "Order shipped!");
return "completed";
}
Start a Workflow
import { Client } from "@temporalio/client";
const client = new Client();
const handle = await client.workflow.start(orderWorkflow, {
taskQueue: "orders",
workflowId: `order-${orderId}`,
args: [{ payment, email, items }]
});
// Query workflow state
const status = await handle.query("getStatus");
// Signal workflow
await handle.signal("cancelOrder");
REST API
# Start workflow via HTTP
curl -X POST http://localhost:8233/api/v1/namespaces/default/workflows \
-H "Content-Type: application/json" \
-d "{\"workflowId\": \"order-123\", \"workflowType\": {\"name\": \"orderWorkflow\"}}"
# Query workflow
curl http://localhost:8233/api/v1/namespaces/default/workflows/order-123
# List workflows
curl http://localhost:8233/api/v1/namespaces/default/workflows
Key Features
- Durable execution — code resumes from exact point after crash
- Long-running — workflows can run for months/years
- Versioning — update workflow code without breaking running instances
- Visibility — query any workflow state at any time
- Timers — sleep for days/months without cron
Real-World Use Case
A payment processor had a 3-step flow: charge -> fulfill -> notify. With microservices, partial failures left orders in inconsistent states. Temporal workflow: if any step fails, it retries automatically. If charge succeeds but fulfillment fails, compensation runs. Zero inconsistent orders.
Quick Start
brew install temporal
temporal server start-dev
# Server at localhost:7233, UI at localhost:8233
Resources
Need durable data pipelines? Check out my tools on Apify or email spinov001@gmail.com for custom workflow solutions.
Top comments (0)