
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@guydav/phaser-on-nodejs
Advanced tools
Allows you to run Phaser 3 games (including Phaser's physics engines) on Node.js.
⚠️ If your goal is to run the Arcade Physics on the server, I highly recommend using arcade-physics.
Works with Phaser >=3.55.2.
Successfully tested with v3.87.0
npm install @guydav/phaser-on-nodejs
require('@guydav/phaser-on-nodejs')
// or with es6
import '@guydav/phaser-on-nodejs'
Install and require phaser and @geckos.io/phaser-on-nodejs. Make sure you use Phaser in headless mode on the server { type: Phaser.HEADLESS }
require('@guydav/phaser-on-nodejs')
const Phaser = require('phaser')
// set the fps you need
const FPS = 30
global.phaserOnNodeFPS = FPS // default is 60
// your MainScene
class MainScene extends Phaser.Scene {
constructor() {
super('MainScene')
}
create() {
console.log('it works!')
}
}
// prepare the config for Phaser
const config = {
type: Phaser.HEADLESS,
width: 1280,
height: 720,
banner: false,
audio: false,
scene: [MainScene],
fps: {
target: FPS
},
physics: {
default: 'arcade',
arcade: {
gravity: { y: 300 }
}
}
}
// start the game
new Phaser.Game(config)
You can load textures (images, spritesheets etc.) on the server.
preload() {
// use a relative path
this.load.image('star', './assets/star.png')
}
create() {
const star = this.physics.add.sprite(400, 300, 'star')
}
But to save some memory, I recommend the following approach instead:
class Star extends Phaser.Physics.Arcade.Sprite {
constructor(scene, x, y) {
// pass empty string for the texture
super(scene, x, y, '')
scene.add.existing(this)
scene.physics.add.existing(this)
// set the width and height of the sprite as the body size
this.body.setSize(24, 22)
}
}
If you are using node-fetch, you do not need to do anything.
If you are using axios, you have to make sure XMLHttpRequest will not break:
XMLHttpRequest is only use in the browser. Phaser.js is a browsers framework which uses XMLHttpRequest so phaser-on-nodejs has to provide a mock implementation. Unfortunately, axios is a isomorphic framework. On initialization, axios checks if XMLHttpRequest is available and will think it is running in the browser. To make sure axios works on nodejs, we just have to hide XMLHttpRequest from axios during its initialization.
See the snipped below to make it work:
// remove fakeXMLHttpRequest
const tmp = XMLHttpRequest
XMLHttpRequest = undefined
// init axios
const axios = require('axios').default
// restore fakeXMLHttpRequest
XMLHttpRequest = tmp
FAQs
Allows you to run Phaser 3 games (including Phaser's physics engines) on Node.js.
The npm package @guydav/phaser-on-nodejs receives a total of 1 weekly downloads. As such, @guydav/phaser-on-nodejs popularity was classified as not popular.
We found that @guydav/phaser-on-nodejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.