Compendium Packs

Compendium packs provide content creators and game-masters with an amazing way to store and organize their content. The following video provides an overview of the Compendium system and it’s basic usage.

Compendium API Usage

Module developers can interact with compendia in a programmatic way using the API offered by the Compendium() class.

class Compendium(metadata, options)

The Compendium class provides an interface for interacting with compendium packs which are collections of similar Entities which are stored outside of the world database but able to be easily imported into an active session.

When the game session is initialized, each available compendium pack is constructed and added to the game.packs.

Each Compendium is distinctly referenced using its canonical “collection” name which is a unique string that contains the module name which provides the compendium as well as the name of the pack within that module. For example, in the D&D5e system, the compendium pack which provides the spells available within the SRD has the collection name “dnd5e.spells”.

  • metadata (Object) – The compendium metadata, an object provided by
  • options (Object) – Application rendering options


// Let's learn the collection names of all the compendium packs available within a game => p.collection);

// Suppose we are working with a particular pack named "dnd5e.spells"
const pack = game.packs.find(p => p.collection === "dnd5e.spells");

// We can load the index of the pack which contains all entity IDs, names, and image icons
pack.getIndex().then(index => console.log(index));

// We can find a specific entry in the compendium by its name
let entry = pack.index.find(e => === "Acid Splash");

// Given the entity ID of "Acid Splash" we can load the full Entity from the compendium
pack.getEntity( => console.log(spell));
// We often may want to programmatically create new Compendium content
// Let's start by creating a custom spell as an Item instance
let itemData = {name: "Custom Death Ray", type: "Spell"};
let item = new Item(itemData);

// Once we have an entity for our new Compendium entry we can import it, if the pack is unlocked

// When the entity is imported into the compendium it will be assigned a new ID, so let's find it
pack.getIndex().then(index => {
  let entry = index.find(e => ===;

// If we decide to remove an entry from the compendium we can do that by the entry ID

Customize Compendium closing behavior to toggle the sidebar folder status icon


The canonical Compendium name - comprised of the originating module and the pack name


type: String

The Entity type which is allowed to be stored in this collection


Get a single Compendium entry as an Entity instance

  • entryId (String) – The compendium entry ID to instantiate

Promise – A Promise containing the returned Entity


Get a single Compendium entry as an Object

  • entryId (String) – The compendium entry ID to retrieve

Promise – A Promise containing the return entry data, or undefined


Get the Compendium index Contains names and IDs of all data in the compendium

Returns:Promise – A Promise containing an index of all compendium entries

Import a new Entity into a Compendium pack

  • entity (Entity) – The Entity instance you wish to import

type: Array

An index of data contained within this compendium. The index is empty until getIndex() is called.


type: Object

The compendium metadata which defines the compendium content and location


Is this Compendium pack publicly visible to all players or private for the GM only?


Remove a single Compendium entry by its ID

  • entryId (String) – The compendium entry ID to remove

Override the default Application() rendering logic to wrap the render call in a promise which retrieves the compendium data.

  • force (Boolean) – Render even if the app is not currently present in the DOM