Running a Node.js app in UE5

A question about this thread was asked of me in direct message. I don’t do code consulting in direct messages, but I’m happy to answer questions in the public thread where others can also benefit from the answer. The question was approximately “how would I really go about integrating Unreal and Node.js”

  1. If the data is actually static, then run the webapp as part of your build, request the data you need with curl, and bake the data files into your Unreal executable.
  2. If the servers can run separate from the client, then run the servers on Amazon or Heroku or your own server or somesuch, register DNS to get to the service, and make a HTTP request from the Unreal client to the service.
  3. If the Node code must run on the same client machine as the Unreal client, then ship the Node executable as a bundled executable, make it respond to some custom port (like 28282 or whatever) and when the client starts up, check whether something is already responding on that port; if not, call the OS to start the Node server that you bundled. When the client needs the data, make a HTTP request to this port, posting the parameters, and reading the data back.

Trying to integrate the node.js code base into the Unreal code base sounds like it is going to be extremely painful, and be very hard to maintain going forward. I highly recommend using one of the other methods I suggest above.

4 Likes