Checkout the Product Requirements Document here
- Configure
.env
- This project uses dotenv-extended to load environment variables.
- See .env.schema and .env.defaults for variables required to run this project.
- Install dependencies with
npm install
In separate terminals:
- Temporal Server:
temporal server start-dev
- Starter API:
npm run api
- Worker:
- LOCAL environment:
npm run domain:local
- NON-LOCAL environments or for local validation of builds:
npm run domain
- LOCAL environment:
There are a few preparatory tasks required to run a Temporal TypeScript SDK Application in a production, staging, etc environment.
- Implement appropriate DataConverter interfaces
- Expose these implementations to the respective Temporal SDK Clients (Worker and Starter).
- Bundle Workflow code for reference in the
Worker
options.- See the script included in this project for an example.
You might need to run your API with SSL. The excellent mkcert project can simplify creation and management of certificates to get started with secure connections everywhere.
- Install mkcert.
mkcert -install
(this just installs the CA to your system)mkcert -client localhost
(this makes all ourlocalhost
servers ok for HTTPS)- Note that it creates
localhost-client.pem
andlocalhost-client-key.pem
files in our root dir. - Update your
.env
file paths for bothAPI_CONNECTION_MTLS_KEY_FILE
andAPI_CONNECTION_MTLS_CERT_CHAIN_FILE
variables. - We will use these from our different servers to serve over https where needed
- Note that it creates
Run tests with npm test
.
This runs a series of tests across the API, Workflows, and Activities.
Now try out the provided OnboardEntity to verify the stack.
It supports a PUT
and GET
to verify Executing and Querying a Workflow.
With all three servers running you should be able to issue the following requests to confirm your setup.
export PUBLIC_API_URL="http{s}://localhost:3000/api"
curl -X PUT "$PUBLIC_API_URL/v1/onboardings/customer_123" \
-H "Content-Type: application/json" \
-d '{"id": "customer_123", "value": "Bob Smith"}'
should respond with
202 Accepted
export PUBLIC_API_URL="http{s}://localhost:3000/api"
curl -X GET "$PUBLIC_API_URL/v1/onboardings/customer_123"
should respond with something like
{
"id":"customer_123",
"status":"1",
"sentRequest":{
"id":"customer_123",
"value":"Bob Smith",
"deputyOwnerEmail":"",
"completionTimeoutSeconds":60,
"skipApproval":false
},
"approval":{"status":"PENDING","comment":""}
}