Skip to main content

Quickstart

This guide takes you through your first steps with Restate.

Prerequisites
1
Get the Greeter service template

Download the Node template with a skeleton of a Restate service. And install its dependencies:


npx -y @restatedev/create-app@latest && cd restate-node-template && \
npm install

2
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

3
Launch Restate

Restate is a single self-contained binary. No external dependencies needed. Run it locally via (or download the binaries):

npx
Homebrew
Docker

npx @restatedev/restate-server

4
Register the service

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

CLI
npx
curl

restate deployments register http://localhost:9080

If you run Restate with Docker, use http://host.docker.internal:9080 instead of 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

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โ€‹