Star
SDK Documentation

Star SDK

Browser game SDK with built-in leaderboards and mobile-safe audio.Works on iOS Safari. No backend needed.

Works with every bundler and framework

Setup

Required for leaderboards

Register your game to get a gameId. Leaderboards won't work without this step.

npx star-sdk init "Your Game Name"

This creates a .starrc file with your gameId. Open it, copy the gameId, and pass it to Star.init(). The gameId is a server-issued token — do not make one up.

index.js
import Star from 'star-sdk';
Star.init({ gameId: '<gameId from .starrc>' });

Why Star SDK?

Skip the boilerplate. Ship the game.

NeedWithout StarWith Star
LeaderboardsBuild a backend, database, authStar.leaderboard.submit(score)
Mobile audioHandle unlock gestures, AudioContextStar.audio.play('coin')
HiDPI canvasManual DPR scaling, coordinate mathAutomatic
iOS SafariDebug audio/touch issues for hoursIt just works
HostingSet up hosting + backend for leaderboardsnpx star-sdk deploy

API Reference

Three APIs. Everything you need.

Star.game()

Game loop, canvas, UI overlay, input handling. Automatic DPR scaling and coordinate conversion.

Star.game(g => {
  g.loop((dt) => {
    if (g.tap) { /* g.tap.x, g.tap.y */ }
    g.ctx.fillRect(0, 0, g.width, g.height);
  });
});

Star.audio

Procedural sounds with 17 built-in presets. Handles iOS Safari audio unlocking automatically.

Star.audio.preload({ coin: 'coin', jump: 'jump' });
Star.audio.play('coin');  // Works everywhere

Star.leaderboard

Submit scores and show rankings. No backend needed. Requires Star.init() with a gameId (see Setup).

// Requires Star.init({ gameId }) — see Setup
Star.leaderboard.submit(score);
Star.leaderboard.show();

Audio Presets

17 built-in procedural sounds — tap any to hear it

Synthesized in real-time with Web Audio API — no files to load

🖱

UI

Actions

Combat

Collection

Quick Start

A complete game in 20 lines

index.js
import Star from 'star-sdk';
Star.init({ gameId: '<gameId from .starrc>' }); // run: npx star-sdk init

Star.game(g => {
  const { ctx, width, height } = g;
  let score = 0;

  // Preload audio
  Star.audio.preload({ coin: 'coin', jump: 'jump' });

  // Game loop — input and drawing happen here
  g.loop((dt) => {
    // Input (polling — coordinates are canvas-space, automatic)
    if (g.tap) {
      score += 10;
      Star.audio.play('coin');
    }

    ctx.fillStyle = '#1a1a2e';
    ctx.fillRect(0, 0, width, height);
    ctx.fillStyle = '#fff';
    ctx.font = '24px sans-serif';
    ctx.fillText(`Score: ${score}`, 20, 40);
  });
});

Claude Code Integration

Install the Star SDK skill for Claude Code to get full API documentation and examples while coding.

npx star-sdk install

Deploy

One command. Live URL. Free hosting.

terminal
# Register your game
npx star-sdk init "My Game"

# Build your game...

# Deploy to Star
npx star-sdk deploy
# => Live at https://buildwithstar.com/games/<id>

Free hosting

No configuration needed

Shareable link

Send anyone your game URL

Leaderboards included

Works automatically

Start Building

Create games that work everywhere, without the boilerplate.