Reference documentation

Examples

Use examples when you need a practical starting point instead of a concept page.

Updated April 6, 2026

Examples

Use examples when you need a practical starting point instead of a concept page.

This page covers:

  • templates and demos
  • SDK type usage
  • starter patterns that connect the reference docs to real project structure

Templates and Demos

Templates and demos are the fastest way to start from working Playdrop content instead of a blank folder.

Create from a template:

bash example

playdrop project create app my-first-app --template playdrop/template/typescript_template

Templates help because they give you the correct workspace shape, Playdrop-aware project wiring, and an easier transition into local dev and publish.

Demos are better when you want a narrow example of one creator problem, such as player identity, room-based multiplayer, runtime asset loading, or AI-assisted content flows.

For monetization examples, use:

  • sdk-status to inspect runtime state, including ad load and show results
  • sdk-demo to see practical interstitial and rewarded flows inside a hosted game

SDK Types and Patterns

Use this section when you need a practical reminder of what the public SDK exposes and how to keep local types aligned.

Initialize once, then branch into the specific surfaces you need:

ts example

const sdk = await playdrop.init();

console.log(sdk.app.phase);
console.log(sdk.me.username);

Common next surfaces:

ts example

await sdk.me.appData.set("profile", { level: 3 });
const room = await sdk.me.joinRoom();
await sdk.shop.listProducts();
await sdk.achievements.list();
await sdk.leaderboards.get("fastest_lap");

Do not build against guessed SDK shapes. Use the published SDK types and the runtime reference page together.