Skip to main content
The Stake Engine Web SDK is a batteries-included framework for building high-quality, production-ready casino games for the web. It combines the reactivity of Svelte 5, the rendering power of PixiJS 8, and the state management of XState into a single declarative programming model. Games built with this SDK can be deployed directly to Stake Engine — a managed Remote Game Server (RGS) platform — with minimal configuration.

Quickstart

Install dependencies, run the sample game in Storybook, and play your first round in under 10 minutes.

Core Concepts

Understand books, bookEvents, emitterEvents, and the event-driven game loop that powers every game.

Add a BookEvent

Step-by-step guide to extending a game with a new bookEvent and wiring it to Svelte components.

API Reference

Complete reference for all pixi-svelte components, utility functions, and the RGS fetcher.

How it works

The SDK models each game round as a book — a JSON payload returned by the RGS that contains an ordered array of bookEvents (e.g., reveal, winInfo, freeSpinTrigger). Your game processes each bookEvent sequentially, broadcasting emitterEvents to Svelte components that handle animations, UI updates, and audio.
1

RGS returns a book

The Remote Game Server responds to a bet request with a book — a JSON object containing the game outcome as an ordered array of bookEvents.
2

playBookEvents() processes each event

playBookEvents() iterates through the array in order, calling the matching handler in your bookEventHandlerMap for each event.
3

Handlers broadcast emitterEvents

Each bookEventHandler calls eventEmitter.broadcast() or eventEmitter.broadcastAsync() to send typed events to subscribed Svelte components.
4

Components animate and update

Svelte components subscribe via eventEmitter.subscribeOnMount() and react to emitterEvents — playing animations, updating counters, and triggering audio.

Sample games

The SDK ships with five fully-implemented reference games you can run, study, and fork:

lines

Classic payline slots with free spin bonus mode.

cluster

Cluster-pay mechanic with tumble/cascade support.

scatter

Scatter-pay game with anticipation animations.

ways

All-ways-pay slots mechanic.

price

Price-based game variant.

number-picker

Number selection game type.

Key packages

pixi-svelte

Svelte 5 components wrapping PixiJS 8 primitives: App, Container, Sprite, SpineProvider, ParticleEmitter, and more.

utils-event-emitter

The typed event bus connecting JavaScript game logic to Svelte component trees.

utils-xstate

XState-powered finite state machine managing bet, autoBet, and resumeBet game flows.

utils-book

createPlayBookUtils() for sequential bookEvent processing with full TypeScript inference.

Build docs developers (and LLMs) love