Skip to main content

Overview

loader-client is a Bun HTTP server that bridges the browser and the compiled game client. It serves the loader-website frontend, exposes the game file manifest, delivers the compiled game assets, and forwards environment variables to the browser. It is the single entry point for everything the player’s browser contacts.

Usage

Or invoke directly after building the loader packages:

Routes

Options

Watch mode

When --watch is enabled, loader-client starts a WebSocket server on --watch-port (or a random free port) and sets the watch.url field in the manifest response. Any file change in the game directory causes the server to broadcast an update message. The loader-website frontend connects to that WebSocket and reloads the page on receipt. Pass --watch-server-dir to also reload when the server game directory changes — useful when client and server are compiled in one step.

HTTPS / TLS

Pass --cert and --key to enable HTTPS. The server reads both files with Bun’s native TLS support. The /env response will include tlsEnabled: true so the game can detect the protocol at runtime. HTTPS is required when the browser enforces a secure context — for example when using the Origin Private File System API used by loader-website to cache game files.

Examples

Start on port 8080:
Start with watch mode:
Start with HTTPS:
Point to a custom game directory: