Quickstart
This guide takes you through your first steps with Restate.
- Build tools for your programming language:
- Optional but recommended: Install the Restate CLI
- TypeScript
- Java
- Kotlin
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
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 buildnpm run app
This starts the greeter service on port 9080
.
Launch Restate
Restate is a single self-contained binary. No external dependencies needed. Check out our download page for other ways to run Restate.
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
:
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.
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!
Get the project template
Download Java Hello world example:
Build and run the service
You are all set to start developing your service.
./gradlew build
Open the project in an IDE and configure it to build with Gradle. Run your service via:
./gradlew run
Launch Restate
Restate is a single self-contained binary. No external dependencies needed. Check out our download page for other ways to run Restate.
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
:
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.
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!
Get the project template
Download Kotlin Hello world example:
Build and run the service
You are all set to start developing your service.
./gradlew build
Open the project in an IDE and configure it to build with Gradle. Run your service via:
./gradlew run
Launch Restate
Restate is a single self-contained binary. No external dependencies needed. Check out our download page for other ways to run Restate.
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
:
If 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.
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:
- Discover the key features of Restate in the Tour of Restate
- Run the examples