I am developing a 3D infinite runner game with the Babylon.Js game engine. I am using TypeScript as the main language and Electron to make it into a desktop application.
The idea for this game has evolved over time. It did not start off intended to be an infinite game but after I had a friend suggest that to me I was easily able to do it.
The way that the game works is that I have a script running in a web worker that is generating the placement of tracks and structures. The worker then sends that data to the main process for it to be processed and displayed. The game is always keeping track of where the player is and when they enter a new game zone.
There is a lot more going on but that is the simplest explanation of how I was able to make it infinite.