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.
import Star from 'star-sdk';
Star.init({ gameId: '<gameId from .starrc>' });Why Star SDK?
Skip the boilerplate. Ship the game.
| Need | Without Star | With Star |
|---|---|---|
| Leaderboards | Build a backend, database, auth | Star.leaderboard.submit(score) |
| Mobile audio | Handle unlock gestures, AudioContext | Star.audio.play('coin') |
| HiDPI canvas | Manual DPR scaling, coordinate math | Automatic |
| iOS Safari | Debug audio/touch issues for hours | It just works |
| Hosting | Set up hosting + backend for leaderboards | npx 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 everywhereStar.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
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);
});
});Examples
Single-file games you can play, view source, and build on
Claude Code Integration
Install the Star SDK skill for Claude Code to get full API documentation and examples while coding.
npx star-sdk installDeploy
One command. Live URL. Free hosting.
# 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