Zend certified PHP/Magento developer

Adobe sensei for headless client

We are working on headless approach using NextJS and React for Magento backend, At the back-end we use Adobe Sensei for Product recommendations. Need some guidance or example code to integrate the product recommendation module to our frontend. I went through this URL,
product recommendation for headless but still I am not clear like should the storefront-events-collector – how to configure that with the magento backend and should it be run in a separate port as a server. Can anyone please help me with this.
Thanks,