Skip to main content

Microservice Orchestration

The simplest way to build resilient applications.

Restate serves as the resilience and durability layer for applications. Write regular functions and services, and let Restate make them resilient, consistent, and scalable.

Microservice Orchestration

Resiliency baked into familiar programming constructs
The Restate SDKs provide programming constructs with built-in retries and recovery. Restate ensures code runs to completion: failures are automatically retried and previous progress is recovered.
Consistent application state
Restate persists code execution, including state updates. State remains consistent with execution progress. Restate enforces a single writer per key to prevent lost updates and concurrency issues.
Resilient communication and scheduling
Restate makes all communication resilient: request-response calls, async messages, webhooks, and scheduled tasks. No need for message queues, custom retry logic, deduplication, or separate schedulers.

Resilient Code Execution and Communication

Familiar programming constructs, but now resilient

Restate transforms the programming building blocks you already know into resilient constructs. Work with objects, functions, and promises as if failures don't exist. Restate can recover them anytime, anywhere.

Learn more

Familiar programming constructs, but now resilient

Restate transforms the programming building blocks you already know into resilient constructs. Work with objects, functions, and promises as if failures don't exist. Restate can recover them anytime, anywhere.

Learn more

Persist progress

Execute calls to other systems and APIs and persist their results. On retries, actions aren't re-executed —- previous results are recovered. Chain interactions with multiple systems, and Restate ensures all interactions complete successfully.

Learn more

Persist progress

Execute calls to other systems and APIs and persist their results. On retries, actions aren't re-executed —- previous results are recovered. Chain interactions with multiple systems, and Restate ensures all interactions complete successfully.

Learn more

Resilient RPC and messaging

Restate sits like a reverse-proxy or message broker in front of your services, proxying calls and ensuring they're delivered and processed. Make any type of call resilient:

  • Request-response calls
  • One-way message
  • Scheduled tasks

Learn more

Resilient RPC and messaging

Restate sits like a reverse-proxy or message broker in front of your services, proxying calls and ensuring they're delivered and processed. Make any type of call resilient:

  • Request-response calls
  • One-way message
  • Scheduled tasks

Learn more

Idempotency for free

Add an idempotency token to your requests and let Restate handle deduplication. Each request runs to completion exactly once.

Learn more

Idempotency for free

Add an idempotency token to your requests and let Restate handle deduplication. Each request runs to completion exactly once.

Learn more

const subscriptionService = restate.service({
name: "SubscriptionService",
handlers: {
add: async (ctx: restate.Context, req: SubscriptionRequest) => {
const paymentId = ctx.rand.uuidv4();
const payRef = await ctx.run(() =>
createRecurringPayment(req.creditCard, paymentId)
);
for (const subscription of req.subscriptions) {
await ctx.run(() =>
createSubscription(req.userId, subscription, payRef)
);
}
},
},
})
export type SubscriptionService = typeof subscriptionService;
restate
.endpoint()
.bind(subscriptionService)
.listen(9080);
const restateClient = restate.connect({ url: RESTATE_URL });
const reservation = await restateClient
.serviceClient<SubscriptionService>({ name: "SubscriptionService" })
.add( // target handler
subscriptionRequest,
Opts.from({ idempotencyKey: requestId })
);

Regular functions and services, in your existing infrastructure

Your code runs just like before: as Java/NodeJS/... applications on FaaS, Kubernetes, servers, containers.
On-premises or in the cloud. Restate is a single binary that is easy to deploy and operate. Restate meets you where you are.

Regular functions and services, in your existing infrastructure

Sagas and Distributed Transactions

Restate guarantees code runs to completion, enabling you to implement resilient sagas in a try-catch block. Restate handles retries and recovery.

Track compensations

With durable code execution, sagas can be expressed purely in code. As functions execute, undo operations are tracked in a list.

Track compensations

With durable code execution, sagas can be expressed purely in code. As functions execute, undo operations are tracked in a list.

Guaranteed roll back

When an unrecoverable error occurs, previously completed changes are rolled back. Restate ensures all compensation actions run to completion.

Learn more

Guaranteed roll back

When an unrecoverable error occurs, previously completed changes are rolled back. Restate ensures all compensation actions run to completion.

Learn more

const subscriptionService = restate.service({
name: "SubscriptionService",
handlers: {
add: async (ctx: restate.Context, req: SubscriptionRequest) => {
const compensations = [];
try {
const paymentId = ctx.rand.uuidv4();
compensations.push(() => removeRecurringPayment(paymentId))
await ctx.run(() => createRecurringPayment(req.creditCard, paymentId));
for (const subscription of req.subscriptions) {
compensations.push(() => removeSubscription(req.userId, subscription))
await ctx.run(() => createSubscription(req.userId, subscription));
}
} catch (e) {
if (e instanceof restate.TerminalError) {
for (const compensation of compensations.reverse()) {
await ctx.run(() => compensation());
}
}
throw e;
}
},
},
})

Stateful Entities and State Machines

Restate lets you implement stateful services by storing state directly in Restate.

Consistent state

Implement state machines where state transitions are always consistent with your code.

Consistent state

Implement state machines where state transitions are always consistent with your code.

Scalability, concurrency, consistency

Restate guards consistency by ensuring only one handler writes to a single state value at a time. Scale out without worrying about multiple writers, lost updates, race conditions, or inconsistencies.

Learn more

Scalability, concurrency, consistency

Restate guards consistency by ensuring only one handler writes to a single state value at a time. Scale out without worrying about multiple writers, lost updates, race conditions, or inconsistencies.

Learn more

Stateful serverless

Run stateful services on serverless infrastructure. Restate attaches the service's K/V state to each request, allowing your handlers to work with local state.

Learn more

Stateful serverless

Run stateful services on serverless infrastructure. Restate attaches the service's K/V state to each request, allowing your handlers to work with local state.

Learn more

const subscriptionObject = restate.object({
name: "SubscriptionObject",
handlers: {
add: async (ctx: restate.ObjectContext, req: SubscriptionRequest) => {
const paymentId = ctx.rand.uuidv4();
ctx.set("subscription", "awaiting_payment")
const success = await tryPaymentFiveTimes(ctx, req, paymentId);
if(!success) {
ctx.set("subscription", "payment_failed")
return
}
ctx.set("subscription", "creating_subscription")
await ctx.run(() => createSubscription(req.userId, req.subscription));
ctx.set("subscription", "created")
},
},
})
export const awsLambdaHandler = restate
.endpoint()
.bind(subscriptionObject)
.handler();

Detailed Observability

Restate tracks communication and execution, giving it a unique position for observability.
Understand what is happening in your distributed applications, by using the UI, the CLI, and the built-in tracing.

Detailed Observability
What can you do with UI?What can you do with CLI?

What you can build with Microservice Orchestration and Restate

Idempotent async payments

Issue idempotent payments to providers and process responses, whether immediate or via webhooks.

Sagas

Keep multiple systems in sync. For example, reserve a flight and car, then handle payment. If payment fails, automatically roll back reservations.

Human-in-the-loop workflows

Food ordering example: handle payment, wait until desired delivery time, notify restaurant to start preparation, confirm with restaurant, and deliver.

Durable state machines

Tracking the state of a machine in our factory with a Virtual Object. Define state transitions in your handlers and store current state in Restate.

Database interaction

Use Restate to solve common access problems, race conditions, and inconsistencies caused by retries, concurrent requests, or zombie processes.

Wondering about a specific use case?

Let’s brainstorm together on Discord or Slack.

Developer Resources

Blog post

Why we built Restate

Learn

Follow the Tour of Restate to learn more.

Need help?

Join the Restate Discord or Slack communities