Skip to content
STAIGEGAMES
Help center
Building · 6 min

My game needs a backend (multiplayer, saves, leaderboards)

STAIGE hosts the game client. Here's how to host the server part and connect them.

STAIGE hosts static files only. That's what keeps it fast, free and safe. If your game has a server (Express, Socket.IO, Colyseus, a database…), split it into two parts:

  1. Client (the game in the browser) → hosted by STAIGE.
  2. Server → hosted by you on Render, Fly.io, Railway, or a BaaS like Supabase / Firebase / PlayFab.
  3. Give STAIGE your server URL as the External backend URL.

Connect them

// client: read the server URL from an env var at build time
const SERVER = import.meta.env.VITE_SERVER_URL ?? "https://my-game.onrender.com";
const socket = io(SERVER);
  • Enable CORS on your server for https://play.games.staige.world.
  • Use wss:// / https:// — browsers block insecure connections from HTTPS pages.
  • Free tiers sleep — show a 'waking server…' message on first connect.
Prompt: split my game into client + server
My game currently runs a Node server that also serves the front-end. I want to host the front-end as static files on STAIGE Games and the server separately (e.g. on Render).

Please:
1. Move the client into its own Vite build that outputs dist/ (base "./").
2. Make the client read the server URL from VITE_SERVER_URL with a sensible default.
3. Add CORS on the server allowing https://play.games.staige.world and http://localhost:5173.
4. Add a render.yaml (or Dockerfile) so I can deploy the server.
5. List the exact steps and URLs I need to paste into STAIGE.