Installation

Get started with martini-kit in under a minute.

Prerequisites

  • Node.js 18+ (18.x, 20.x, or 22.x)
  • Package manager: npm, pnpm, or yarn

Install Packages

Choose your development approach:

Install martini-kit with Phaser helpers for rapid game development:

# Using pnpm (recommended)
pnpm add @martini-kit/core @martini-kit/phaser phaser

# Using npm
npm install @martini-kit/core @martini-kit/phaser phaser

# Using yarn
yarn add @martini-kit/core @martini-kit/phaser phaser

What’s included:

  • @martini-kit/core - Core multiplayer engine
  • @martini-kit/phaser - Phaser adapter + helpers (SpriteManager, InputManager, etc.)
  • phaser - Phaser 3 game engine

What’s Included

@martini-kit/core

The core multiplayer engine. Provides:

  • defineGame() - Declarative game definition
  • GameRuntime - State management and sync
  • Diff/patch algorithms for efficient networking
  • Transport interface for custom backends

@martini-kit/phaser

Phaser 3 adapter with helpers:

  • PhaserAdapter - Connects martini-kit to Phaser scenes
  • SpriteManager - Automatic sprite synchronization
  • InputManager - Simplified input handling
  • PhysicsManager - Physics behavior presets

phaser

Phaser 3 game engine (peer dependency).

Verify Installation

Create a test file to verify everything installed correctly:

// test.ts
import { defineGame } from '@martini-kit/core';
import { PhaserAdapter } from '@martini-kit/phaser';

console.log('✅ martini-kit installed successfully!');
console.log('defineGame:', typeof defineGame);
console.log('PhaserAdapter:', typeof PhaserAdapter);

Run it:

node test.ts

You should see:

✅ martini-kit installed successfully!
defineGame: function
PhaserAdapter: function

martini-kit is built with TypeScript and includes full type definitions.

// tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "lib": ["ES2020", "DOM"],
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true
  }
}

Next Steps

Ready to build your first game? Continue to the Quick Start guide!