What does HackerNews think of raft?
Golang implementation of the Raft consensus protocol
[0] https://pkg.go.dev/go.etcd.io/etcd/raft/v3
[1] https://github.com/hashicorp/raft
[2] https://notes.eatonphil.com/distributed-postgres.html
[3] https://notes.eatonphil.com/minimal-key-value-store-with-has...
you could inspire yourself by hashicorps raft implementation written in go and build one for typescript. Code is quite good to read and Go ins't that far away from typescript.
https://github.com/hashicorp/raft
Example application: https://github.com/Jille/raft-grpc-example
For example, there's a great Raft library for Go [1] that any project can use to implement distributed consensus without a separate running program. I find this to be a better approach with the same collective development and community testing advantages but without requiring more operational overhead.