Getting Started

Add login and cloud saves to your game in 2 steps.

1

Create a Game & Get API Keys

  1. Sign up at modd.io/signup
  2. Go to Developer and click “New Game”
  3. Open your game and click “Generate API Keys”
  4. Copy your App ID and App Secret
2

Add to Your Game

Browser (game page)

<script src="https://www.modd.io/js/moddio.js"></script>
<script>
  new Moddio({ appId: 'your-app-id' });
</script>

A login widget appears automatically. Players log in, and the event is sent to your game server.

Server (game server)

npm install moddio
const { Moddio } = require('moddio/server');

const moddio = new Moddio({
  appId: 'your-app-id',
  appSecret: 'your-app-secret',
});

moddio.on('playerJoin', (player) => {
  console.log(player.id);          // unique player ID
  console.log(player.name);        // display name
  console.log(player.data);        // saved game data (guaranteed loaded)
  console.log(player.permissions); // { chat: true, vip: false }
});

// Save player data anytime
moddio.savePlayerData(player.id, { highScore: 9001 });

That's it. See the API Reference for details.