dddice JavaScript SDK

The dddice JavaScript SDK allows developers to render and roll custom digital dice using the dddice API.

This can be useful for building external applications such as:

  • Browser Extensions
  • Custom Game Integrations
  • OBS Plugins
  • VTT Modules & Plugins


Looking for working examples of dddice using different frameworks? Check out the examples repository.


In order to utilize the dddice JavaScript SDK, you will need to generate an API Key. More information can be found on the API Documentation site.


To utilize dddice in your own project, install the library using npm.

npm i dddice-js

Or include the library from our CDN.

<script src="https://cdn.dddice.com/js/dddice-latest.js"></script>

Initialize the library to establish a connection and begin rendering.

// import ThreeDDice class if using npm
import { ThreeDDice } from 'dddice-js';

// initalize dddice with a <canvas /> element and API key
const dddice = new ThreeDDice(document.getElementById("dddice"), "<api_key_goes_here>");

// start dddice and connect to a room to receive rolls
dddice.connect("<room_id_goes_here>"); // make sure you're in this room!

Roll Dice

To roll dice, simply call the roll function. This will roll the provided theme and die type in the connected room.

theme: "dddice-standard",
type: "d20",

Diving In

To learn more, dive into the ThreeDDice and ThreeDDiceAPI classes.

There you will find useful methods to join a room, update participants, upload custom dice themes, and more!

Generated using TypeDoc