A Phaser 3 project template that demonstrates React communication and uses Vite for bundling. This project includes hot-reloading for development, production-ready builds, and a backend server integrated into an Electron app.
- Node.js is required to install dependencies and run scripts via
npm.
electron-app/- Contains both frontend (Phaser 3) and backend (Express server) code.electron-app/server/- Contains the backend server code for handling API requests and other server-side logic.
From the electron-app directory, you can run the following commands:
| Command | Description |
|---|---|
npm install |
Install project dependencies for the frontend. |
npm install (in server/) |
Install dependencies for the backend server. |
npm run dev |
Start the app in development mode with hot-reloading. |
npm run build |
Build the frontend with production settings. |
npm run build-electron |
Build the frontend and package the Electron app. |
-
Navigate to the App Directory and Install Dependencies:
- From the root directory, navigate to
electron-appand install the dependencies for both frontend and backend.cd electron-app npm install cd server npm install cd ..
- From the root directory, navigate to
-
Run the Project:
- Development Mode: Start the development server with hot-reloading:
npm run dev
- Build for Production: To build the frontend and package the Electron app for production, use:
npm run build-electron
- Development Mode: Start the development server with hot-reloading:
Edit any files in the electron-app/src folder. Vite will automatically recompile and reload the frontend during development.
When ready for deployment, use the following command to build and package the Electron app:
npm run build-electron