Quickstart

From runtime key to first saved game.

Use a stage key while building, configure the SDK once, write the default autosave data locally, and add sync when the player reaches a safe moment.

stage key firstone-save pathautosave-ready

Shortest Path

This is the canonical startup flow.

Keep the first pass narrow: project key, SDK install, local-first data write, then sync policy.

01

Create a Persistly project and copy the stage runtime key.

02

Install the SDK for your game surface.

03

Configure PersistlyGameSaves with local storage.

04

Save locally first, then call due-sync or force-sync at safe gameplay moments.

First Save

The JavaScript path starts with PersistlyGameSaves.

This is the only code sample you need on the quickstart page: configure, save one default game save, load it, and force-sync when safe.

TYPESCRIPT
import { PersistlyGameSaveStatus, PersistlyGameSaves } from "@persistlyapp/sdk";

await PersistlyGameSaves.configure({
  runtimeKey: "ps_test_replace_me",
});

const loaded = await PersistlyGameSaves.shared.loadData();

if (loaded.status === PersistlyGameSaveStatus.LocalFound && loaded.data) {
  console.log("Boot from local data:", loaded.data);
} else {
  console.log("Start new game.");
}

// Local write. This does not need a network request.
await PersistlyGameSaves.shared.saveData({
  level: 5,
  coins: 1200,
  checkpoint: "forest-gate",
}, {
  slotInfo: { characterName: "Astra", slot: "main" },
});

// First sync creates a Persistly account + slot if needed.
const sync = await PersistlyGameSaves.shared.forceSyncData();

if (sync.status === PersistlyGameSaveStatus.Synced) {
  console.log("Synced to Persistly.");
}

if (sync.status === PersistlyGameSaveStatus.Conflict) {
  console.log("Show a local-vs-cloud recovery UI.");
}

Branch Next

Choose what to read after the first save works.