Skip to content

3. Tarot.js Decks

Jared Van Valkengoed edited this page Oct 6, 2025 · 1 revision

Tarot.js comes with decks organized by language and allows developers to add their own custom decks. This documentation explains the folder structure, naming conventions, and usage.

You can find the list of all the current decks here.

Folder Structure

Decks should organized by language code. For example:


decks/
├─ en/
│  ├─ default.json
│  ├─ english_waites.json
├─ fr/
│  ├─ french.json
│  ├─ tarot_de_france.json
├─ es/
│  ├─ spanish.json
│  └─ tarot_espanol.json

  • Each language has its own folder (e.g., en for English, fr for French).
  • Deck files are .json and contain arrays of Tarot card objects.
  • Developers can add new decks to the appropriate language folder.

File Naming Conventions

  • Use a descriptive name for the deck (e.g., waites.json).
  • Keep lowercase letters and underscores for multi-word names.
  • Avoid special characters in filenames.

Deck File Structure

Each deck JSON file is an array of card objects. Example:

[
  {
    "name": "The Fool",
    "arcana": "Major",
    "number": 0,
    "suit": null,
    "meaning": {
      "upright": "New beginnings, optimism, trust",
      "reversed": "Recklessness, taken advantage of, inconsideration"
    }
  },
  {
    "name": "The Magician",
    "arcana": "Major",
    "number": 1,
    "suit": null,
    "meaning": {
      "upright": "Skill, resourcefulness, manifestation",
      "reversed": "Manipulation, poor planning, untapped talents"
    }
  }
]

Adding a Custom Deck

To add your own deck:

  1. Create a JSON file following the same structure as existing decks.
  2. Place it in the appropriate language folder, e.g., decks/en/my_custom_deck.json.
  3. Load it in your code using Tarot.initializeDeck():
import Tarot from '../tarot.js';
import customDeck from './decks/en/my_custom_deck.json' assert { type: "json" };

const tarot = new Tarot();
tarot.initializeDeck(customDeck);

Notes

  • Decks are immutable once initialized in the Tarot.js library.
  • Developers can add multiple decks per language.
  • Deck JSON files should be UTF-8 encoded to support special characters.
Clone this wiki locally