The cloud IoT providers all tend to use per device certificates to identify each device individually.
You have 2 choices here:
You flash the certificate to the device at manufacturing time.
You use the platforms HTTP interfaces to provision the certificate to the device at the point it is connected to the wifi and registered to a user.
Both of these ...
There is nothing wrong with that approach.
The NodeJS app doesn't need to subscribe to the messages published by the ESP32 devices if it doesn't need the data, it can quite happily just publish settings change updates, either to a device specific topic or to a shared topic with a device ID in the payload.
The average broker will handle thousands of clients ...
I ended up just implementing everything, including local services as Homie devices, which makes integration in openhab extremely simple and allows to quickly run those services on other devices withouth the need to reconfigure anything.
Your question is a bit confuse for this forum, however we can provide you some pointers so that you can rephrase your question and progress in the topics.
You do not need any kind of VM, however to do that you need:
A webserver and an open port on your machine. By default webserver bind themselves to the port 80, but on most computer and routers the port ...