Hosting Quick Start¶
Put a browser game online in about five minutes.
Before you start¶
You need:
- A GameFuse account and a game. Note the game's ID.
- A hosting plan for that game. Open your game in the dashboard, then Hosting, and pick a plan. Basic is $1 a month.
- Your game's upload key. It is in the same Hosting tab (it is the same
mpk_...key the Multiplayer tab shows). - Node.js on your computer, to run the
gamefusecommand. - A game that builds to a folder with an
index.htmlat the top.
Hosting serves the files of a finished build. It does not run a server. See the Overview.
1. Install the command¶
2. Build your game¶
Make the finished browser build. For a game made with Vite or webpack:
This usually makes a dist folder. Unity, Godot and the others have their own export step. See Engine Guides.
3. Upload it¶
Put your upload key and game ID in a .env file in your project folder:
# .env (keep it out of git: it holds a secret)
GAMEFUSE_UPLOAD_KEY=mpk_your_upload_key
GAMEFUSE_GAME_ID=123
Add .env to your .gitignore. Then run this in your project folder:
The command:
- Checks the folder: an
index.htmlat the top, every file it points to is there, sizes inside your plan. See The Check. - Opens the game in a hidden Chrome to make sure it loads without errors and draws something.
- Uploads it and makes it live.
- Prints the address:
You can also pass them each time instead: gamefuse hosting deploy dist --game 123 --key mpk_....
Keep the key out of your build
Vite and similar tools copy settings named VITE_... (or NEXT_PUBLIC_..., REACT_APP_...) into the game, where players can read them. Never give the upload key one of those names. GAMEFUSE_UPLOAD_KEY is safe. The check refuses an upload that contains a .env file.
4. Open it¶
Or open the address in any browser. Send it to your players.
5. Upload a new version¶
Build again and run the same deploy command. The new version replaces the old one. If something is wrong, go back to the previous upload:
Next¶
- Use your own domain, such as
play.yourgame.com: Use Your Own Domain. - Every command and option: The gamefuse Command.
- See how many players load your game: Hits.