- Deploy on Stake Engine — build a game using the provided patterns and launch it directly on the platform.
- Starting point for custom implementations — fork the repo and modify any part of the source code. You have 100% freedom over the codebase.
Key technologies
The SDK is powered by the following npm packages:| Technology | Purpose |
|---|---|
| Svelte 5 | Reactive UI framework for game components |
| PixiJS 8 | WebGL-accelerated 2D rendering |
| pixi-svelte | In-house package combining PixiJS and Svelte for declarative canvas rendering |
| SvelteKit | Application framework and build pipeline |
| TurboRepo | Monorepo task orchestration |
| XState | Finite state machine for bet lifecycle management |
| Storybook | Component isolation and game testing environment |
| Lingui | Internationalisation |
| TypeScript | Type safety across the monorepo |
| pnpm | Package manager with workspace support |
The Stake Engine platform
Stake Engine (engine.stake.com) is the RGS that sits behind every game. When a player places a bet, the RGS returns a book—a JSON object containing a sequence of bookEvents that fully describes how that round plays out. The SDK’s architecture is built around consuming those bookEvents in order.
Architecture overview
The data flow from RGS to screen follows a single, consistent pipeline:- RGS returns a book for each game request.
playBookEvents()iterates throughbook.eventsin sequence—order matters because it determines the visual behaviour (e.g. spin before win).- Each
bookEventHandlerinbookEventHandlerMapprocesses one event type. It typically broadcasts one or more emitterEvents viaeventEmitter. - Svelte components subscribe to emitterEvents with
eventEmitter.subscribeOnMount()and handle them synchronously or asynchronously—waiting for animations to finish before the sequence continues.
Monorepo structure
The repository follows a standard TurboRepo layout:/apps — each folder is a complete, runnable game. The lines game is the primary reference implementation used throughout this documentation.
/packages — shared modules consumed by apps and other packages via workspace:* dependencies. They follow a <type>-<scope> naming convention (e.g. utils-book, components-ui-pixi).
Quickstart
Get the SDK running locally in minutes with Storybook.
Book and Events
Understand the bookEvent and emitterEvent architecture.
Packages
Explore the shared packages available across the monorepo.
