Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v8 or higher recommended)
- npm (comes with Node.js)
- PostgreSQL database
- Git for cloning the repository
Installation and setup
Install dependencies
Install all required npm packages:This installs:
- React and Redux for the frontend
- Express for the backend server
- Sequelize for database ORM
- Material-UI for the component library
- Webpack for bundling
Configure the database
Set up your PostgreSQL database connection. The application uses Sequelize ORM and will automatically sync your database schema on startup.
Make sure your PostgreSQL server is running and accessible. The database configuration is typically found in the server/db/models directory.
Start the development server
Launch both the webpack dev server and the backend API:This command:
- Starts webpack in watch mode to bundle your React application
- Runs nodemon to automatically restart the server on changes
- Syncs the database schema
- Starts the Express server on port 4000
Building your first deck
Once the application is running, you can start building your deck:Search for cards
Use the card search interface to find Magic cards you want to add to your deck. The application connects to card data to provide autocomplete suggestions.
Add cards to your deck
Select cards from the search results to add them to your deck. Each card will appear as a row in the deck list table.
Adjust quantities
Use the increment (+) and decrement (-) buttons to adjust card quantities:
- Most cards are limited to 4 copies (per Magic rules)
- Basic lands can be added without limit
- The green (+) button adds a copy
- The blue (-) button removes a copy
- The red (×) button removes the card entirely
View probability analysis
As you build your deck, the columns labeled 1-8 show the probability of drawing each card by turns 1 through 8. This helps you:
- Ensure you have enough mana sources to cast your spells on time
- Identify if you need more or fewer lands of specific colors
- Optimize your curve based on when you can reliably cast your spells
Production build
To create a production build:What’s next?
Now that you have MTG Deck Builder running, explore the features in depth:Deck Building
Learn how to manage your deck with the interactive interface
Probability Calculator
Understand how the hypergeometric distribution analysis works
Mana Optimization
Master multi-color mana bases and fetch land strategies
API Reference
Integrate MTG Deck Builder into your own applications
