Quick start
This guide uses a web game. Native games work the same way through the REST API.
-
Add the SDK to your game.
Download
spawnle.js(or install it from npm), ship it with your game and load it:index.html <script src="spawnle.js"></script><script type="module" src="game.js"></script>The launcher also serves the SDK next to your game at
/__spawnle/sdk.js, always matching the launcher’s version; use that path if you prefer, but it only exists inside Spawnle. -
Start a session.
game.js const spawnle = await Spawnle.init();console.log(`Hi ${spawnle.user.displayName}!`); // already signed inconsole.log(spawnle.mode); // "spawnle" or "local"Opened outside Spawnle,
init()runs in local mode: a stand-in player and everything kept inlocalStorage, so your game keeps working while you build it. -
Save the player’s progress to the cloud.
await spawnle.saves.save("slot1", JSON.stringify({ level: 3, coins: 120 }));const saved = await spawnle.saves.load("slot1"); // null when emptyconst state = saved ? JSON.parse(saved) : newGame(); -
Define an achievement and unlock it.
In the launcher, open Developer dashboard → your game → SDK, add an achievement with the key
first-winand save. Then, in your game:const result = await spawnle.achievements.unlock("first-win");if (result.newly) showToast(`🏆 ${result.name}`);Unlocking twice is harmless:
newlytells you whether it was new. -
Try it in the launcher.
Publish your game with the visibility Only me to test it privately, then press Play from your library. Inside Spawnle,
spawnle.modeis"spawnle"and saves, achievements and scores reach the cloud.
With a bundler
Section titled “With a bundler”npm install @spawnle/sdkpnpm add @spawnle/sdkimport Spawnle from "@spawnle/sdk";
const spawnle = await Spawnle.init();The package ships TypeScript types.
- Web games — how the launcher serves your game, engines, storage.
- Achievements and Leaderboards.
- Example: Hello Spawnle — a complete tiny game.