Skip to content

Latest commit

 

History

History
 
 

typescript

TypeScript Example Catalog

Basics

Learn the key concepts of Restate:

  • Services - Durable Execution: Making code resilient to failures via automatic retries and recovery of previously finished actions.
  • Durable Building Blocks: Restate turns familiar programming constructs into recoverable, distributed building blocks. Discover what you can do with the SDK.
  • Virtual Objects: Stateful services with access to long-lasting, consistent K/V state.
  • Workflows: Durable sequences of steps that can be queried, signaled and awaited.

Use Cases and Patterns

Common tasks and patterns implemented with Restate:

Communication

Orchestration patterns

  • Sagas: Preserve consistency by tracking undo actions and running them when code fails halfway through.
  • Stateful Actors and State Machines: Stateful Actor representing a machine in our factory. Track state transitions with automatic state persistence.
  • Payment State Machines (Advanced): State machine example that tracks a payment process, ensuring consistent processing and cancellations.

Scheduling

  • Scheduling Tasks: Restate as scheduler: Schedule tasks for later and ensure the task is triggered and executed.
  • Parallelizing Work: Execute a list of tasks in parallel and then gather their result.

Event processing

Building coordination constructs (Advanced)

  • Durable Promises as a Service: Building Promises/Futures as a service, that can be exposed to external clients and are durable across processes and failures.
  • Priority Queue: Example of implementing a priority queue to manage task execution order.

Integrations

Examples integrating Restate with other tools and frameworks:

  • AWS Lambda + CDK: Sample project deploying a TypeScript-based Restate service to AWS Lambda using the AWS Cloud Development Kit (CDK).
  • XState: Resilient, distributed durable state machines with Restate and XState.

End-to-End Applications

Complete applications built with Restate:

  • Food Ordering App: A food delivery service (like DoorDash) that manages orders, restaurants, payments, and delivery drivers. The example mixes workflows (ordering) and stateful microservices (driver management), and uses Kafka as an event source for updates from delivery drivers.
  • AI Image Processing Workflow: A dynamic workflow interpreter that interprets a list of image processing steps and runs them through image processing libraries and stable diffusion.
  • LLM-powered Chat Bot / Task Agent: An LLM-powered chat bot with Slack integration that can be asked to handle tasks, like watching flight prices, or sending reminders.

Templates

Starter templates for new projects:

Tutorials

Step-by-step guides to learn Restate: