NodeJS with BabylonJS?


I have successfully created BabylonJS sites based off of an index.html + javascript files. I have also created middleware components using NodeJS. I want to try to combine the two of them and create a BabylonJS site served by NodeJS. Can anyone point me to an example project, or tutorial, using both NodeJS and BabylonJS?


If you’re referring to creating a webserver that can serve the static files (index.html, etc) to a browser, then there are many options. Webservers that serve files are pretty generic, and they don’t really care what files they serve.

The easiest I’ve come across is this: http-server - npm
The static files (index.html, css, js) go into a folder, public by default, and then one can run http-server from the command line in node. I use this in my development environment all of the time, and have run it in production a bit as well.

If you’re referring to having made express.js/connect middleware, then there is Serving static files in Express , which has the same end result as above. The difference here is that this program also has routing and runs on the same port. I can clarify if desired.

In production, it is worth noting that node is rarely used to serve static content. Node.js is perfectly capable of serving static files, it is just that the most common deployment of node application leaves the static file serving to nginx ( ). The typical architecture here is that nginx listens to all requests, takes the ones that refer to static files, and passes the rest to a node.js. Probably avoid this initially unless you’re in a linux sysadmin mood :wink:


Thank you I think that gives me enough to learn what I need to by breaking a few things.


Saw your question, and let others answer first as I doubted a nodeJS based BabylonJS client app was what you were looking for. For the sake of completeness, this is also probably implementable.

There is a Native VR/AR/XR engine for JavaScript implemented using NodeJS. I presume it is for making an app store deploy-able, standalone webXR application for headsets (currently only Magic Leap), but it seems there is also a desktop option as well.

My initial look at this reminds me of that Haxe port of BabylonJS. It was never complete, never being able to do things like WebAudio, & always out of date. This is using the actual babylon.min.js file so this is different ballgame. You cannot have a webGL context outside of a browser, so this uses something called webgl-to-opengl.

I plan to do a desktop test the near future.

Just making notes for myself as in the past. I found out what is really going on with how you could possibly get nodeJS to run on magic leap (Android based). There is a forked repo of NodeJS.

Additionally, there is a whole directory ofdocumentation files.


I have been learning JavaScript over the last several months. Mostly with NodeJS. I was really just hoping to leverage the skills I have learned and combine that with BabylonJS on platforms like Heroku


I have been building an app with Node.js, express,, and Babylon. My approach is having the node server run the NullEngine, client sends data to server requesting a particular mesh, server creates the mesh, serializes it, stringifies it, then sends the string to the client to load. While many components of the scene are handled by the client, all mesh creation (except instances) and most validation checks are done server side.


I have a github template I use with my preferred setup here if it helps: GitHub - TrevorDev/testProjectBabylon


I decided it was easier to make my own template using just Express and NodeJS. GitHub - yazheirx/babylon_express_server: An implementation of Express and BabylonJS to make it easier to code BabylonJS apps in NodeJS. Feedback is appreciated