Tarot.js ·

Live Demo | Getting Started | Documentation | GitHub
Tarot.js is a powerful and customizable JavaScript library for creating and managing Tarot card decks, custom spreads, and readings. Whether you're a Tarot enthusiast or a developer looking to integrate Tarot readings into your application, Tarot.js offers a flexible toolkit to enhance your experience.
- Deck Management: Easily draw, shuffle, and get details about your Tarot deck.
- Custom Spreads: Create and manage unique Tarot spreads tailored to your needs.
- Readings: Perform readings using your custom spreads, drawing the specified number of cards for each position.
- Current Spread Tracking: View the most recent spread and cards drawn for a convenient reference.
- Detailed Deck Information: Retrieve full deck details, including card counts and each card’s metadata.
You can view a demo of Tarot.js in use here.
How to use Tarot.js:
import Tarot from "https://esm.sh/gh/MarketingPipeline/Tarot.js";
// Load a existing tarot deck via ES6 assert import or via fetch etc...
import englishDeck from "https://esm.sh/gh/MarketingPipeline/Tarot.js/decks/en/default.json" assert { type: "json" };
// Initialize a Tarot instance and deck
const tarot = new Tarot();
tarot.initializeDeck(englishDeck);
// Access current deck and spread information
console.log(tarot.getDeckInfo());
// Add a spread (e.g., Past, Present, Future)
tarot.addSpread('Three-Card Spread', {
positions: ['Past', 'Present', 'Future'],
description: 'Insight into past, present, and future aspects.'
});
// Perform a reading using the spread
console.log(tarot.doReading("Three-Card Spread"));
// Make your own deck
const your_own_custom_deck = tarot.initializeDeck([
{
name: "The Fool",
meaning: "New beginnings, innocence",
whatever_key_names_you_want: "l33t"
},
{
name: "The Coder",
meaning: "Tired, broke, curious",
whatever_values_you_want: ["dope"]
}
/* Add more card objects as needed.
Note: Objects must be same length or greater as your positions in your spread.
*/
]);
// Add your custom spread
tarot.addSpread("shakespeare", {
positions: ["To be", "Not to be"],
description: "Random example spread"
});
console.log(tarot.doReading("shakespeare"));
// View the most recent spread and cards drawn
console.log(tarot.getCurrentSpread());
For more advanced usage you can find the Tarot.js documentation here.
Contributions are welcome! Feel free to submit issues, suggest features, or create pull requests to improve Tarot.js.
See also the list of contributors who participate in this project.
This project is licensed under the MIT License - see the LICENSE file for details.