API Reference

Complete reference for Browser and Server SDKs.

Browser

<script src="https://www.indie.fun/js/indie.js"></script>

new Indie({ appId })Create client — auto-mounts login widget and tracks sessions

No other public methods needed. The widget handles login automatically and notifies your game server via WebSocket when a player joins.

Server

npm install indie

const { Indie } = require('indie/server')

Setup

new Indie({ appId, appSecret })Connect to Indie and start receiving player events

Events

indie.on('playerJoin', (player) => {})Called when a player logs in. player has id, name, data, highScore, permissions.

Player Data

indie.getPlayerData(playerId)Load all saved data for a player. Returns Promise<object>.
indie.savePlayerData(playerId, data)Replace all data for a player. Returns Promise<void>.
indie.updatePlayerData(playerId, data)Merge fields into existing data (partial update). Returns Promise<void>.

Types

Player

{
  id: string
  name: string
  data: Record<string, unknown>
  highScore: number
  permissions: Record<string, boolean>
}