Skip to content

pcholakov/restate-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation Discord Twitter

Restate examples

Browse this repository to see how easy distributed applications development becomes with Restate.

Starters

Language Name / Link
TypeScript Hello world on AWS Lambda
TypeScript Hello world on AWS Lambda + CDK
Java Hello World HTTP
Java Hello world on AWS Lambda
Kotlin Hello World HTTP
Kotlin Hello world on AWS Lambda
Kotlin Hello world on AWS Lambda + CDK

Patterns

Language Name / Link
TypeScript Payment API: Example API for payments, inspired by the Stripe API
TypeScript (gRPC API) End-to-end testing: Example of how to test Restate services end-to-end
TypeScript Common patterns Set of common patterns you encounter when developing distributed TS applications
Java Common patterns Set of common patterns you encounter when developing distributed Java applications

Applications

Language Name / Link
TypeScript Food ordering - TypeScript: Integrate Restate with external services
TypeScript Ticket reservation: Example showing Restate's keyed-sharding and concurrency guarantees
TypeScript (gRPC API) Ecommerce store: An ecommerce store completely built on top of Restate
TypeScript Dynamic workflow executor: A workflow executor that dynamically executes a list of steps as specified in the JSON input
Java Food ordering - Java: Java food order processing app and driver-to-delivery matching services

Joining the community

If you want to join the Restate community in order to stay up to date, then please join our Discord. The Discord server is also the perfect place for sharing your feedback with us, learning more about Restate and connect with others!

Running the examples

The readme for each example will explain how to get it running. Once the services of the example are running, the deployment needs to be registered in Restate.

Launching the Restate Server

NOTE: Some examples can be run with Docker Compose. For those, you can ignore this section.

For running Restate locally and downloading the binaries, have a look at the options on the Get Restate page.

  • To run Restate in a Docker container:
    docker run --name restate_dev --rm -p 8080:8080 -p 9070:9070 -p 9071:9071 --add-host=host.docker.internal:host-gateway docker.io/restatedev/restate:latest
  • To run Restate with npx:
    npx @restatedev/restate-server@latest
  • To run Restate with Homebrew:
    brew install restatedev/tap/restate-server
    restate-server 
    

Register the deployment in Restate

Once Restate is up, register the deployment in Restate by executing:

  • Via the CLI:
    restate dp register localhost:9080
  • Via curl:
    curl localhost:9070/deployments  -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}'

When running Restate with Docker, use host.docker.internal instead of localhost for the service deployment URI.

This should give you the following output in case of the ticket reservation example:

{
  "id": "bG9jYWxob3N0OjgwODAv",
  "services": [
    {
      "name": "UserSession",
      "revision": 1
    },
    {
      "name": "TicketDb",
      "revision": 1
    },
    {
      "name": "CheckoutProcess",
      "revision": 1
    }
  ]
}

Adding examples (for Restate developers)

When adding a new example:

Releasing (for Restate developers)

Before releasing, trigger the "pre-release" workflow to update sdk versions. This automatically creates a pull request, which must be manually merged.

Once the repo is ready for the release, push a tag of the form vX.Y.Z.

This triggers a workflow that creates a draft release on Github, which you need to approve to finalize it.

About

Restate examples

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 80.5%
  • Java 15.1%
  • Kotlin 1.7%
  • HTML 1.2%
  • JavaScript 0.5%
  • Dockerfile 0.5%
  • Shell 0.5%