This page covers the lifecycle of an installed theme from the developer’s side: how an archive gets onto a server, what happens at activation, how updates and rollback work, and where files live. The operator’s view is in the Appearance admin guide.
Distribution
- Themes are distributed only as
.tgzarchives. There is no package registry. - Operators install an archive in Site & Content › Themes. Uploading needs the
appearance:installpermission, held by super admins and by the seeded Theme manager group. - Official archives may ship inside the product image as pre-installed, inactive themes under
themes-bundled/(source Bundled). None ships today. Theme sources, including the samples, are never shipped. - The built-in theme
defaultis never uploaded and never appears as an archive.
Upload and validation
- The archive (at most 30 MB) is checked for format, path safety and size, then validated against every rule in Validation and Scanner Rules. The parent named in
extendsmust be installed. - A rejected archive is not installed; the report names the rule, file and line.
- An accepted archive is unpacked to
themes/<slug>/<version>/on the server’s themes volume and recorded as installed and inactive. - The theme’s strings are seeded into the phrase table, skipping keys that already exist.
Preview and activation
- Preview applies the theme to the operator’s own browser only: a one-hour cookie on the admin session that the public theme endpoints honour for a signed-in admin. Stop preview ends it.
- Activate sets the theme as the player theme. Players see it only while Show the active theme to players is on; with it off, the public endpoints answer
defaultwhatever is active. - On activation every connected browser receives
appearance_updated, fetches the theme configuration again, loads the bundle and the theme’s stylesheet, and swaps parts and views without a page reload. The token sheet (theme.css) is re-read at the same time, so new token values and custom CSS appear live as well. - Activation and rollback re-validate the installed files; a theme that no longer validates is refused.
- A child theme requires its parent to be installed. Parent loads first, then child.
- If the bundle fails to load, does not call
defineTheme, or itsengines.contractdoes not match the running product, the client keepsdefaultand logs a[theme]warning. If theme code throws while rendering, the theme is deactivated for that browser’s session anddefaultrenders in its place, without a reload.
Runtime delivery
| Request | What is served |
|---|---|
GET /api/v1/config/theme | The resolved configuration: active theme, parent chain, entry URL, tokens, overrides, version |
GET /api/v1/config/theme.css | The layer order, the merged token block on :root and the operator’s sanitised custom CSS |
GET /api/v1/config/theme.js | A redirect to the active theme’s immutable bundle, or an empty module when default is active |
GET /themes/<slug>/<version>/… | The installed theme’s files, with immutable cache headers |
Bundles are addressed by version, so a new version never overwrites a cached one. The entry bundle, the stylesheet and the screenshot URLs also carry the archive’s checksum (dist/theme.js?v=<16 hex>): a version that is deleted and uploaded again with different files gets new URLs, so a returning browser does not keep the old files from its year-long cache. Chunks are content-hashed by the build and need no query. Publish every change as a new version anyway: that is what players’ rollbacks and the update history rely on. The full reference is in the REST API and the WebSocket events (appearance_updated).
Updating
Uploading a newer version of an installed theme upgrades it in place: the new version becomes the installed one (and stays active if the theme was active), and the previous version is kept for rollback. The installed version and the previous version kept for rollback cannot be uploaded again (409; the Themes page shows the reason above the list); deleting the theme removes both, after which any version can be uploaded again. Operator overrides are keyed by theme slug and survive the update.
Rollback
Roll back returns to the previous version of the same theme, and the two swap places, so a second rollback goes forward again. Deactivate returns the install to default without a page reload.
Deletion
Deleting a theme removes its files, its saved settings and its seeded strings. The active theme, the built-in theme and a theme another theme extends cannot be deleted.
Export, no duplication
Export downloads the installed version as <slug>-<version>.tgz. Duplicating a theme is not offered (decision 37b): a copy needs a new slug, and the theme’s own ids and strings carry its slug (theme.<slug>.*), so a renamed copy would not validate. To fork a theme, change its slug and every theme.<slug>.* id in the source, then build and upload it.
Permissions
| Permission | Level | Allows |
|---|---|---|
appearance:read | a1 | See Appearance |
appearance:edit | a1 | Customise, branding, menus, custom CSS, activation |
appearance:install | a | Upload and delete archives |
A seeded Theme manager group at level a1 holds appearance:install and appearance:edit by override.
Deployment notes
- Installed themes live in
themes/<slug>/<version>/under the server’s working directory;THEMES_DIRoverrides the folder. In development that isthemes/in the root of the Poker Engine source. - Docker installs keep them in the
themes_datavolume (/app/themes), which survives upgrades. The shipped nginx config has the/themes/location, the theme endpoint locations outside the API rate zone, and a 50 MB body limit on the upload route. See Deployment. - Kubernetes installs use the
persistence.themesclaim and must route/themes/and/api/v1/config/theme.css|jsto the app. With more than one replica the theme files must be on aReadWriteManyvolume. See Kubernetes.