Skip to main content

Quickstart

This guide takes you through your first steps with Restate.

Prerequisites
1
Get the project template

Use the Node template to get started. This template includes a skeleton of a TypeScript Restate service:


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

Get all the dependencies and build tools:


npm install

2
Build and run the service

Now, you are all set to start developing your service in src/app.ts. You can run the app with ts-node-dev while developing:


npm run app-dev

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


npm run build
npm run app

This starts the greeter service on port 9080.

3
Launch Restate

npx
Homebrew
Docker

npx @restatedev/restate-server

πŸ’‘Single binary

Restate is a single self-contained binary. No external dependencies needed. Check out our download page for other ways to run Restate.

4
Register the service

Now, we need to tell Restate where the service is running. You can use the Restate CLI via npx or via a global npm install. Alternatively, you can use curl:

CLI
curl

restate dp add http://localhost:9080

If you run Restate with Docker, you need to use http://host.docker.internal:9080 instead of http://localhost:9080 to reach the service deployment.

Restate then sends a request to the service deployment to ask which services and handlers are running behind this endpoint and will remember these. After executing this curl request, you should see the registered services and handlers printed to your terminal.

5
Send requests to the service

Invoke the function via:


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 steps​

Possible next steps: