https://github.com/peterhellberg/pizza-delivery-simulator
Small example project of using Temporal via their Go SDK
https://github.com/peterhellberg/pizza-delivery-simulator
example go temporal
Last synced: 22 days ago
JSON representation
Small example project of using Temporal via their Go SDK
- Host: GitHub
- URL: https://github.com/peterhellberg/pizza-delivery-simulator
- Owner: peterhellberg
- License: mit
- Created: 2025-08-28T15:18:19.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-10-16T23:30:43.000Z (8 months ago)
- Last Synced: 2025-10-18T02:51:24.239Z (8 months ago)
- Topics: example, go, temporal
- Language: Go
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pizza Delivery Simulator 🍕
> [!Tip]
> This is a notebook that can be used with the [Runme CLI](https://docs.runme.dev/installation/cli) 📚
>
> _Installation of the Runme CLI:_
> - **On macOS:** `brew install runme`
> - **Using Go:** `go install github.com/stateful/runme@latest`
> - **Binaries:**
## Plan _(not all implemented yet)_
- Workflow: Customer places an order.
- Activities:
- [x] Place order (for a known customer)
- [x] Assign delivery driver (via frontend `pizza-delivery-dashboard`)
- [ ] Driver reports progress via Temporal signals _(e.g., “Stuck in traffic”, “Almost there”)_.
## Dependencies
- https://go.dev/
- https://github.com/golang/go
- https://temporal.io/
- https://temporal.io/setup/install-temporal-cli
- https://github.com/temporalio/temporal
- https://github.com/temporalio/sdk-go
- https://jqlang.org/
## Frontends
### [pizza-delivery-dashboard](/frontends/pizza-delivery-dashboard)

## Commands
### Execute
#### GetMenu
```sh { name=get-menu excludeFromRunAll=true }
temporal workflow execute -t pizza --name GetMenu
```
#### PlaceOrder
```sh { name=place-order }
export PIZZA="5"
export NAME="Peter"
temporal workflow execute -t pizza --name PlaceOrder \
-i "$(jq -c -n '{name:env.NAME,pizza:env.PIZZA|tonumber}')"
```
### Server
```sh { name=temporal-dev-server }
temporal server start-dev --ip=0.0.0.0 -f=pds.db
```
#### Search attributes
```sh { name=temporal-create-search-attributes }
temporal operator search-attribute create --name DriverAssigned --type Bool
temporal operator search-attribute create --name DriverID --type Keyword
temporal operator search-attribute create --name OrderID --type Keyword
```
### Worker
```sh { name=worker }
go run ./worker | jq
```
### Dashboard
```sh { name=dashboard }
go run ./frontends/pizza-delivery-dashboard
```
### Install `temporal` and `jq` using [Homebrew](https://brew.sh/) 🍏
```sh { name=brew-install excludeFromRunAll=true }
# Install temporal and jq using brew
if ! [ -x "$(command -v brew)" ]; then
echo 'Error: brew is not installed.' >&2
exit 1
fi
brew install temporal jq
```