I want to use a node script that contains an events listener function (e.g. https://portal.thirdweb.com/sdk/advanced-features/contract-events#listen-to-all-events) inside my Next.js app.
As there is no server and the serverless functions need a trigger, I'm not sure where this kind of code should live.
How can I handle this case?