Skip to content

In your own Node app

Terminal window
npm install tickcli ws
import { createGameServer } from "tickcli/serve";
const app = createGameServer({ games: "./games", saves: "./saves", secret: process.env.TICKCLI_SECRET });
console.log("open", await app.listen(8080));
process.on("SIGTERM", () => app.close().then(() => process.exit(0))); // writes pending saves first
Option Default What it does
games the current folder folder of .html games (names: letters, digits, -, _)
saves none a folder for saved profiles and worlds, or your own SavePort
secret random per process signs the players’ pass cookies; keep it stable to keep seats and saves
limits DEFAULT_LIMITS players per room, rooms, message sizes and rates
secure false mark the pass cookie Secure (set it behind https)
title “tickcli games” heading of the game list page

app.server is a plain node:http server and app.hub the RoomHub, so you can add routes or read hub.stats(). A game loads the libraries as room.js, lib:room or tickcli/room.js (same for game.js); the server serves its own copies.

Need signed-in players, your own routes, or games in a sandboxed frame? Build on the parts instead: tickcli (the hub, no dependencies), tickcli/node (sockets, tickets, guest passes, saves; uses ws) and tickcli/client/*.js (the browser libraries). See Hosting it.