I want to make a flow chart with javascript from scratch. Something like below:

However, the flow chart is not only a ui. Each block in the flow chart is a task. Users can click the block to run the task sequentially according to the flow chart designed by users.
Also, I don't want to use any library. I want to make it from scratch. How can I do that? Or provide me some examples. Thanks.