In your own Node app
npm install tickcli-js wsimport { createGameServer } from "tickcli-js/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 |
Besides the games, the server sends the page libraries and installed engines compressed (brotli or gzip, made once, off the event loop) with an ETag, and the page names each by its content (/client/game.js?v=<12 hex>), so a repeat visit downloads nothing. Big art can sit beside a game as games/assets/<page>.<file>.<hash>.js (<hash> = 12 hex digits that change with the file’s content): /play/assets/ serves these compressed and cached for good, so a new version of a game re-downloads only its 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-js (the hub, no dependencies), tickcli-js/node (sockets, tickets, guest passes, saves; uses ws) and tickcli-js/client/*.js (the browser libraries). See Hosting it.