Restate services can run in a few ways: as a Node.js HTTP handler, as an AWS Lambda handler, or on other Javascript runtimes like Bun, Deno and Cloudflare Workers.Documentation Index
Fetch the complete documentation index at: https://docs.restate.dev/llms.txt
Use this file to discover all available pages before exploring further.
Creating a Node.js HTTP handler
Userestate.serve to serve the provided services, starting an HTTP/2 server on port 9080.
Customizing the HTTP2 server
Customizing the HTTP2 server
If you need to manually control or customize the HTTP2 server, use
restate.createEndpointHandler to create a Node HTTP/2 handler, and then use it to manually instantiate the HTTP server:HTTP/1.1 support
HTTP/1.1 support
restate.createEndpointHandler works with both HTTP/1.1 and HTTP/2. It auto-detects the HTTP version per request, so you can use it with Node.js’s standard http module:Creating a Lambda handler
To register your service as a Lambda function, use the/lambda import
component and use restate.createEndpointHandler:
Creating a Deno/Cloudflare Workers handler
Other Javascript runtimes like Deno and Cloudflare Workers have built on top of the Fetch Standard for defining HTTP server handlers. To register your service as a fetch handler, use the/fetch import component.
bidirectional: true to change this on supported platforms,
which will improve latencies once the service is re-registered with the runtime.
- Deno (including Deno Deploy) supports HTTP2 and therefore bidirectional mode can be enabled.
- Cloudflare Workers do not support end-to-end HTTP2 or bidirectional HTTP1.1,
and enabling bidirectional mode will cause invocations to stall and time out.
Services running on Workers must be discovered with the
--use-http1.1CLI flag.
Cloudflare Workers and minification
Cloudflare Workers and minification
Cloudflare Workers minification is not working correctly with the Restate SDK. If you see an issue similar to:Then most likely you have enabled minification when deploying. Disable it with
minify = false in your workers.toml file.