Foundry

Help Center

Glint SDK Quickstart

Go from an empty folder to a published Glint game: install the SDK and CLI, scaffold a starter, preview it in the Local Emulator, validate it, and upload it in Glint Studio.

Glint SDK · 5 min read

The Glint SDK (@joinfoundry/glint-sdk) connects a browser game to Glint: loading progress, pause and mute, cloud saves, achievements, leaderboards, controller remapping (sdk.input), and multiplayer rooms. The same package includes the glint CLI, which scaffolds starters, runs a Local Emulator with Glint's sandbox, and validates builds before upload.

What You Need#

Install and Update the CLI#

The CLI is the glint command in the scoped @joinfoundry/glint-sdk package. Update to the latest version before you start a build or upload one. Newer versions carry the current validation rules.

Bash
# Check the latest published version on npm
npm view @joinfoundry/glint-sdk version
# Install or update globally
npm install --global @joinfoundry/glint-sdk@latest
glint help

To run the latest CLI from any folder without a global install or a stale npx cache, pass -p @joinfoundry/glint-sdk@latest:

Bash
npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint <command>

Inside a project that already lists @joinfoundry/glint-sdk as a dependency (the Phaser, Three.js and KAPLAY starters do), update it with npm install @joinfoundry/glint-sdk@latest and then npx glint <command> runs the installed copy. Bare npx glint fails in folders where @joinfoundry/glint-sdk isn't installed.

Create a Starter#

Bash
glint init vanilla-ts my-game

init copies a starter into the folder you name (the current folder if you leave it out) and adds glint.js, the browser build of the SDK. Files with the same names in that folder are overwritten.

Template What you get
vanilla-ts A canvas game in plain JavaScript with no build step. It saves the best score to a cloud save slot. This is the default.
multiplayer-ts A canvas arena with Quick Join, Create Room and Invite buttons, binary position updates and host migration.
phaser Phaser 3 with Vite.
threejs Three.js with Vite.
kaplay KAPLAY with Vite.
godot The Godot 4.3+ adapter: Glint.gd, an export preset and an HTML shell. See Godot 4.3+ .
unity The Unity WebGL adapter: Glint.jslib, Glint.cs and a WebGL template. See Unity WebGL .

The vanilla-ts starter is ready to play as it is: index.html, main.js, glint.json and glint.js.

Add the SDK to Your Game#

Every game needs the same few calls: start the SDK, report loading progress, say when the first screen is interactive, stop on pause, and follow Glint's mute button.

Script tag
// index.html loads ./glint.js before your game script.
const sdk = await window.Glint.init();
sdk.lifecycle.loadingProgress(0.5);
let muted = sdk.system.isMuted();
sdk.system.onMuteChange(next => { muted = next; });
sdk.lifecycle.onPause(() => { /* stop requestAnimationFrame, physics and audio */ });
sdk.lifecycle.onResume(() => { /* start the loop again */ });
sdk.lifecycle.ready();

Outside Glint, Glint.init() still resolves, with a standalone fallback, so the same build runs when you open it directly. Everything else the SDK can do is in the JavaScript API Reference. For engine-specific setup, see Web Engines.

Preview in the Local Emulator#

Bash
glint preview my-game

Open http://127.0.0.1:4173. The Local Emulator serves your build from a separate local origin with Glint's production Content Security Policy, so anything that would break on Glint breaks here too. Its toolbar mutes, pauses and resumes the game, switches between free, demo, owned and Glint Pass modes, and spawns extra players. Add --players 2 to open two panes for multiplayer. See preview.

Validate the Build#

Bash
glint validate my-game

The validator checks the folder or ZIP against Glint's rules and budgets, then prints PASS or FAIL, a Performance Score out of 100 and whether the build qualifies for the Loads Fast badge. Errors make the command fail. Fix every error and as many warnings as you can; each code is explained in Error and Warning Codes.

Package the Build#

Zip the contents of the build folder so that index.html and glint.json sit at the top level of the ZIP, not inside a folder. For the Phaser, Three.js and KAPLAY starters, the build folder is dist after npm run build. Use standard ZIP compression and leave the files themselves uncompressed: Glint compresses them with Brotli when you upload. The full layout rules are in Platform Rules and Budgets.

Upload and Publish#

You can upload from the command line or in Glint Studio (glint.joinfoundry.xyz/studio, under Glint Studio in the account menu):

  1. From the CLI: Create a Foundry personal token with Marketplace write (marketplace:write) access in AI Agents settings , set FOUNDRY_API_TOKEN, and run: Bash
    npx --yes --prefer-online -p @joinfoundry/glint-sdk@latest glint publish my-game --interactive
    This creates or updates your Glint Studio game, uploads your cover and screenshots, packages and uploads the build ZIP, waits for Package X-Ray and Brotli repackaging, and prints a link to the game in Glint Studio. For later builds, use glint upload my-game --game <id-or-slug>.
  2. Or in Glint Studio: Create the game in Glint Studio (Create a Game ) and upload the ZIP in Build & X-Ray (Upload a Build ). Drafts appear in the Releases list on the Glint Studio home page.
  3. If your game unlocks achievements or submits scores, define their keys in Glint Studio or with the MCP tools glint_upsert_achievement and glint_upsert_leaderboard. See Achievements and Leaderboards .
  4. Open your game in Glint Studio, answer the Content rating questions, confirm your publishing rights, add seller details if the game is paid, and click Publish. See Ratings and Publishing .

Next Steps#

Still stuck? Contact Support.