I did a small tool for electron at the time to make it easier to write code.
There is electron-bridge to define a common pattern and more importantly electron-bridge-cli. It allows to write one Typescript class (schema), and then generate code to declare API, and use it between main/renderer process.
If it is interesting and ok to add/refactor, I can write a PR later to integrate it.