gpuijs

Reference

Environment variables

gpuijs is configured by convention. Environment variables cover the rest: overrides for development and benchmarking, and the plumbing between the CLI, the host and the app.

#Variables you set

VariableRead byEffect
GPUIJS_HOSTCLIThe host binary to run (dev) or package (build), instead of the installed @gpuijs/darwin-* one (in a gpuijs checkout, target/debug/gpuijs or a fresh cargo build --release)
GPUIJS_PRODUCTIONCLIWith dev: bundle production builds of the framework and libraries, and minify, as build does. Use it for benchmarks.
GPUIJS_WINDOW_SIZEHostWIDTHxHEIGHT, like 1440x900. Opens the window at that size, overriding new Window()'s width and height.
GPUIJS_PROFILEHostPrints a per-frame timing breakdown to stderr. See Performance.
GPUIJS_BENCH_SOCKETHostA Unix socket path where the host listens for a benchmark driver. See Performance.
ROUTEAppThe initial URL path, like /settings, for apps with a client-side router
GPUIJS_WINDOW_SIZE=1440x900 GPUIJS_PROFILE=1 ROUTE=/calendar bun js/bin/gpuijs.js dev examples/my-app

#Variables gpuijs sets

You don't set these. They're listed to explain what's going on, and for debugging.

VariableSet byMeaning
GPUIJS_CSSCLI, or the packaged hostThe compiled stylesheet the app sends to the host at startup
GPUIJS_PUBLICCLI, or the packaged hostThe public/ directory that root-relative asset URLs resolve against
GPUIJS_APP_NAMECLI, or the packaged hostThe app's name, for app.getName() and menu role labels
GPUIJS_BODY_CLASSCLIClasses from index.html's <body class>, added to <body>. A packaged app has them compiled into its bundle.
GPUIJS_BUNCLIThe Bun executable the host uses to run the bundle in development
GPUIJS_SOCKETHostThe Unix socket the app connects to for host-to-app messages
GPUIJS_INHostThe named pipe the app writes its messages to
GPUIJS_SYNCHostThe named pipe the host answers forced layouts on
GPUIJS_DATA_DIRPackaged host~/Library/Application Support/<id>, where localStorage is kept
GPUIJS_CACHE_DIRPackaged host~/Library/Caches/<id>, where remote images are cached

Running a bundle directly with bun .gpuijs/app.js fails with GPUIJS_SOCKET is not set; launch this bundle through the gpuijs host. The host has to start the app. See Architecture.