Hi….How do you want to connect both boards?
Via I2C (slave on the Nano, master on the ESP) or UART?
Maybe the last one is the simplest one and then you could use the P087_SerialProxy, which essentially does echo the received string on the selected serial port to a MQTT controller.
That may be the best fit for your application.