Skip to content

temporalio/reference-app-orders-go

Repository files navigation

Temporal Reference Application: Order Management System (Go)

OMS logo

The Order Management System (OMS) is a reference application that demonstrates how to design and implement an order processing system with Temporal. You can run this application locally (directly on a laptop) or in a Kubernetes cluster. In either case, the Temporal Service can be local, a remote self-hosted deployment, or Temporal Cloud.

NOTE: This application is under development and we're working to expand the documentation before we officially announce it.

Quickstart

We recommend that you begin by reading the documentation, which will explain the features of the application and aspects of its design. It also provides instructions for deploying and running the application in various environments, including in Kubernetes and with Temporal Cloud.

If you'd prefer to jump right in and run it locally, follow these steps. Unless otherwise noted, you should execute the commands from the root directory of the project.

Start the Temporal Service

Run the following command in your terminal:

temporal server start-dev --ui-port 8080 --db-filename temporal-persistence.db

This command uses the --db-filename option so that the development server will persist its data to a file instead of memory, thus making it available during later sessions. The file will be created if it does not already exist.

Start the Worker

Run the following command in another terminal:

go run ./cmd/oms worker

Although one Worker is sufficient for local development, Temporal recommends running multiple Workers in production since this can improve both the scalability and availability of an application. You can repeat this step to launch as many additional Workers as you like.

Start the API Servers

Run the following command in another terminal:

go run ./cmd/oms api

The API Servers provide REST APIs that the web application uses to interact with the OMS.

Run the Web Application

You will need to clone the code for the web application, which is maintained in the reference-app-orders-web repository:

cd ..
git clone https://github.com/temporalio/reference-app-orders-web.git

You will then need to run the following commands to start it:

cd reference-app-orders-web
pnpm install
pnpm dev

You will then be able to access the OMS web application at http://localhost:5173/ and the Temporal Web UI at http://localhost:8080/. In the OMS web application, select the User role, and then submit an order (we recommend choosing order #1 to start). Next, return to the main page of
the web application, select the Courier role, locate the shipments corresponding to your order, and then click the Dispatch and Deliver buttons to complete the process. As you proceed with each of these steps, be sure to refresh the Temporal Web UI so that you can see the Workflows created and updated as a result.

Find Your Way Around

This repository provides four subdirectories of interest:

Directory Description
app/ Application code
cmd/ Command-line tools provided by the application
deployments/ Tools and configuration files used to deploy the application
docs/ Documentation

See the documentation for more information.