Skip to content

AndriyKalashnykov/dapr-nodejs-workflow

Repository files navigation

dapr-nodejs-workflow

Prerequisites

Clone the repository

mkdir ~/projects && cd ~/projects
git clone git@github.com:AndriyKalashnykov/dapr-nodejs-workflow.git && cd ~/projects/dapr-nodejs-workflow

Install and Initialize Dapr in your local environment

Start PostgreSQL

./run-postgres.sh

Running the example

# Install
pnpm install
pnpm build && pnpm run start:dapr:api-server

Once the server is running, you can trigger a new activity sequence workflow by making a POST request to the /process-payload endpoint:

curl -X POST http://localhost:3000/process-payload \
  -H "Content-Type: application/json" \
  -d '{"name": "John Doe", "data": {"key1": "value1", "key2": "value2"}}'

This will return a JSON response with the workflow ID, which you can then use to check the status when delayActivity called and pending:

curl http://localhost:3000/workflow/{workflow-id}/status | jq .

response would not have the output property

{
  "id": "82236756-4f38-4b5f-9796-a1268184561e",
  "status": "0",
  "createdAt": "2025-09-16T16:34:44.118Z",
  "lastUpdatedAt": "2025-09-16T16:34:47.139Z"
}

and then you can check deleyActivity is done:

curl http://localhost:3000/workflow/{workflow-id}/status | jq .

response would have the output property

{
  "id": "82236756-4f38-4b5f-9796-a1268184561e",
  "status": "1",
  "output": "{\"name\":\"John Doe\",\"data\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"processed\":true,\"processedAt\":\"2025-09-16T16:35:21.171Z\",\"modified\":true,\"dbData\":[[1,\"2025-09-15T22:57:13.170558-04:00\",\"2025-09-15T22:57:13.170558-04:00\",null,\"john.doe@example.com\",\"hashed_password_1\",\"John\",\"Doe\",\"1980-01-01T00:00:00-05:00\",null,\"USA\",\"American\",null,false,null],[2,\"2025-09-15T22:57:13.170558-04:00\",\"2025-09-15T22:57:13.170558-04:00\",null,\"jane.smith@example.com\",\"hashed_password_2\",\"Jane\",\"Smith\",\"1985-05-15T00:00:00-04:00\",null,\"Canada\",\"Canadian\",null,true,null]]}",
  "createdAt": "2025-09-16T16:34:44.118Z",
  "lastUpdatedAt": "2025-09-16T16:35:21.199Z"
}

check DB status

curl http://localhost:3000/db-health

References

About

DAPR Workflow demo with NodeJS JS-SDK

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published