PlaycademyPlaycademy

Launch Modes

How your project is launched (platform, demo, or standalone)

Overview

Every Playcademy project runs in one of three launch modes.

The mode determines which features are available and how the SDK behaves.

ModeWhere it runsUserSDK behavior
PlatformInside the Playcademy hubAuthenticatedFull SDK (all namespaces available)
DemoInside a landing-page iframeAnonymousLimited set of namespace methods enabled
StandaloneThird-party embedNo userMock token; real platform calls will not succeed

Two URLs after deploy

When you deploy, Playcademy displays two URLs for your project:

  1. Platform link: runs your project inside the Playcademy hub (platform mode)
  2. Standalone link: runs your project directly (standalone mode)

Demo mode is a third scenario relevant to landing page demos.


Choosing a Mode

You don't pick a mode in production. Instead, the runtime decides:

ScenarioLaunch Mode
Embedded in the hubplatform
Embedded in a demo shelldemo
Opened directlystandalone

Local development

For local development with the Vite plugin, you pick the mode to simulate.


Platform

Your project is embedded in the Playcademy hub with an authenticated user and a real session.

  1. Full SDK access: users, scores, runtime, etc.
  2. Authenticated playcademyUser in custom routes
  3. This is the default for the Vite plugin (mode: 'platform')
const client = await PlaycademyClient.init()

if (client.mode === 'platform') {
    const user = await client.users.me()
}

Demo

In demo mode, your project runs inside our landing page. There is no authenticated user — the experience is anonymous — but the shell environment is present, allowing the SDK to communicate demo-specific events and lifecycle updates.

Available in demo mode:

MethodDescription
scores.submit()Record a score (no identity required)
leaderboard.fetch()Read the game's leaderboard
runtime.*Lifecycle, assets, and pause/resume events
backend.*Call your custom API routes over HTTP
client.demoDemo-only namespace
Example
const client = await PlaycademyClient.init()

if (client.mode === 'demo') {
    // Commence the demo variant of the game
}

Guard identity-bound calls

Identity-bound namespaces — e.g. users.* — throw PlaycademyError in demo mode.

There's no real user behind the session. Gate them behind client.mode === 'platform'.


Standalone

Your project is opened directly, i.e. not inside an iframe, and there is no platform context.

  1. No real user, no sandbox, no shell
  2. Real platform API calls will not succeed
  3. Useful raw previews, or embedding your project outside Playcademy entirely
  4. If you need real user accounts in standalone, use the Authentication integration
Example
const client = await PlaycademyClient.init()

if (client.mode === 'standalone') {
    // Skip platform-specific UI, or show a "launch on Playcademy" CTA
}

Writing Mode-Aware Code

The SDK exposes the current mode as client.mode. Branch on it when behavior must differ:

Example
import { PlaycademyClient } from '@playcademy/sdk'

const client = await PlaycademyClient.init()

switch (client.mode) {
    case 'platform':
        await renderAuthenticatedUI(client)
        break
    case 'demo':
        await renderDemoUI(client)
        break
    case 'standalone':
        await renderStandaloneUI(client)
        break
}

Local Development

The Vite plugin simulates each mode locally:

ModeSandboxDev shellUse case
PlatformDay-to-day development against the full platform
DemoBuilding and testing the landing-page demo flow
StandaloneTesting without any Playcademy context

What's Next?

On this page