Skip to main content

Quickstart

This guide takes you through your first steps with Restate.

Prerequisites
1
Install Restate Server & CLI

Restate is a single self-contained binary. No external dependencies needed.

Install Restate Server and CLI via:

brew install restatedev/tap/restate-server &&
brew install restatedev/tap/restate

Then run the Restate Server with:

restate-server

2
Get the Greeter service template

Select your favorite runtime:

restate example typescript-hello-world &&
cd typescript-hello-world &&
npm install

3
Run the Greeter service

Now, start developing your service in src/app.ts. Run it with ts-node-dev, and let it listen on port 9080 for requests:

npm run app-dev

4
Register the service

Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:

restate deployments register http://localhost:9080
Output
โฏ SERVICES THAT WILL BE ADDED:
- Greeter
Type: Service
HANDLER INPUT OUTPUT
greet value of content-type 'application/json' value of content-type 'application/json'
โœ” Are you sure you want to apply those changes? ยท yes
โœ… DEPLOYMENT:
SERVICE REV
Greeter 1

If you run Restate with Docker, use http://host.docker.internal:9080 instead of http://localhost:9080.

5
Send a request to the Greeter service

curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Hi"'

You should now see printed as response: Hi!

๐ŸŽ‰
Congratulations, you managed to run your first Restate service!

Next: Build and run the app

Once you have implemented your service, build the app and run it with:

npm run build
npm run app

Next steps