Report State should be implemented on your server, as it does require a service key that you may not want to leak publicly. (Not sure where your Node.js comes in compared to the Java)
Other than that guideline, it can be implemented in any place that would allow you to send the state to the Homegraph.
A good place to see the sample code would be in the codelab which is written in Node.js. It shows how to use the actions-on-google
library to do report state (there is no library for Java).
const postData = {
requestId: 'ff36a3cc', /* Any unique ID */
agentUserId: '123', /* Hardcoded user ID */
payload: {
devices: {
states: {
/* Report the current state of our washer */
[event.params.deviceId]: {
on: snapshotVal.OnOff.on,
isPaused: snapshotVal.StartStop.isPaused,
isRunning: snapshotVal.StartStop.isRunning,
},
},
},
},
};
return app.reportState(postData)
.then((data) => {
console.log('Report state came back');
console.info(data);
});