restate
БесплатноБез исполняемых скриптовНе проверенRestate is a durable execution engine that makes distributed application code resilient to crashes, with SDKs for TypeScript, Java, Go and more. Use when…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Restate
Overview
Restate is a durable execution engine — your code runs reliably even when things crash. Write normal async functions, and Restate ensures they complete: if a service crashes mid-execution, it resumes exactly where it left off. No lost state, no duplicate side effects. Like Temporal but with a simpler programming model — just annotate your functions, no state machines or DSLs.
Two processes are involved: the Restate Server (a single binary that stores the execution journal, exposes the ingress on port 8080 and the admin API and UI on port 9070) and your service (an HTTP endpoint on port 9080 by default). Callers always talk to the server, never to the service directly.
When to Use
- Distributed transactions (payment → inventory → shipping)
- Long-running workflows that must complete (onboarding, provisioning)
- Saga pattern with compensating actions (rollback on failure)
- Exactly-once processing of events
- Replacing complex retry/queue logic with durable execution
Instructions
Setup
# SDK for your service
npm install @restatedev/restate-sdk
# Server and CLI (also on Homebrew: restatedev/tap/restate-server, restatedev/tap/restate)
npm install --global @restatedev/restate-server@latest @restatedev/restate@latest
restate-server # ingress :8080, admin API + UI :9070, data in ./restate-data
# Or run the server in Docker
docker run --name restate_dev --rm -p 8080:8080 -p 9070:9070 \
--add-host=host.docker.internal:host-gateway \
docker.restate.dev/restatedev/restate:latest
After starting your service, register it with the server. Nothing can be invoked until this is done, and it must be repeated whenever handlers are added or renamed:
restate deployments register http://localhost:9080 --yes # --yes skips the confirmation prompt
# Server in Docker: restate deployments register http://host.docker.internal:9080 --yes
# Development, same URL with changed handlers: add --force to replace the earlier registration
restate services list
Durable Service
// services/payment.ts — Durable payment service
import * as restate from "@restatedev/restate-sdk";
type Order = { orderId: string; userId: string; amountCents: number };
export const paymentService = restate.service({
name: "payments",
handlers: {
// If the process crashes between steps, the handler is replayed and
// completed steps return their recorded result instead of running again
processPayment: async (ctx: restate.Context, order: Order) => {
// Stable across retries — unlike crypto.randomUUID()
const idempotencyKey = ctx.rand.uuidv4();
const charge = await ctx.run("charge-payment", async () => {
return await stripeApi.charge(order.userId, order.amountCents, idempotencyKey);
});
await ctx.run("confirm-order", async () => {
await orderDb.confirm(order.orderId, charge.id);
});
await ctx.run("notify", async () => {
await emailApi.send(order.userId, "Order confirmed!");
});
return { orderId: order.orderId, chargeId: charge.id, status: "completed" };
},
},
});
// Starts an HTTP/2 server; port defaults to 9080. List every service, object and workflow you define
restate.serve({ services: [paymentService], port: 9080 });
restate.endpoint().bind(...).listen() from older tutorials is deprecated; use restate.serve, or restate.createEndpointHandler (imported from @restatedev/restate-sdk/lambda or /fetch) for AWS Lambda, Deno and Cloudflare Workers.
A step that throws an ordinary Error is retried with exponential backoff; after 70 attempts (the server default) the invocation is paused, not failed. Throw restate.TerminalError to stop retrying and return the failure to the caller, or cap a step with a retry policy:
await ctx.run("charge-payment", () => stripeApi.charge(order.userId, order.amountCents), {
initialRetryInterval: { milliseconds: 500 },
maxRetryAttempts: 5, // afterwards a TerminalError is thrown
});
Virtual Objects (Stateful Entities)
// services/cart.ts — Stateful shopping cart (single-writer per key)
type CartItem = { sku: string; quantity: number; priceCents: number };
export const cartObject = restate.object({
name: "cart",
handlers: {
// Exclusive handler: only one runs per cart key at a time — no race conditions
addItem: async (ctx: restate.ObjectContext, item: CartItem) => {
const items = (await ctx.get<CartItem[]>("items")) ?? [];
items.push(item);
ctx.set("items", items);
return { items: items.length };
},
checkout: async (ctx: restate.ObjectContext, userId: string) => {
const items = (await ctx.get<CartItem[]>("items")) ?? [];
if (items.length === 0) {
throw new restate.TerminalError("Cart is empty", { errorCode: 400 });
}
const amountCents = items.reduce((sum, i) => sum + i.priceCents * i.quantity, 0);
Установить restate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл restate?
Restate is a durable execution engine that makes distributed application code resilient to crashes, with SDKs for TypeScript, Java, Go and more. Use when someone asks to "durable execution", "Restate", "resilient workflows", "distributed transactions", "saga pattern", "fault-tolerant services", or "replace Temporal with something lighter". Covers durable handlers, virtual objects, workflows, and sagas.
Как установить скилл restate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл restate запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic