By the end of this guide you will have MTG Cheaper Deck installed, your local Scryfall card database populated, and your first deck analysis running — either as a local web app in your browser or as a one-shot CLI report in your terminal. The whole process takes under five minutes on a typical machine.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/invvd/mtg-cheaper-deck/llms.txt
Use this file to discover all available pages before exploring further.
Create and activate a virtual environment
Create an isolated Python environment so the project’s dependencies do not conflict with anything else on your system.Then activate it for your platform:
- Windows
- Linux / macOS
Install dependencies
Install all required packages from This installs the five direct dependencies the project relies on:
requirements.txt.- requests — HTTP client used by both the Moxfield fetcher and the Scryfall sync.
- python-dotenv — loads
DATABASE_URLand other settings from the.envfile. - sqlalchemy — SQLAlchemy Core powers the database layer; switching engines requires only a URL change.
- rich — terminal formatting for the interactive mode and CLI report tables.
- flask — lightweight web framework for the local web app interface.
Create the .env file
Create a
.env file in the project root to configure the database connection..env
SQLite is the default and requires no extra installation — the database file is created automatically inside
./data/ on first run. To use PostgreSQL instead, change DATABASE_URL to a postgresql+psycopg://... connection string and install psycopg[binary] (pip install "psycopg[binary]"). No other code changes are needed.Sync the Scryfall database
Populate the local card database by downloading the Scryfall Oracle Cards bulk file.This fetches the current bulk-data download URL from
api.scryfall.com/bulk-data/oracle-cards, streams the gzipped JSONL file (~38k cards), and upserts every card into ./data/cards.db in batches of 1,000. The sync stores card names, oracle text, keywords, color identity, CMC, EDHREC rank, legalities, and USD prices — everything the scoring algorithm needs.The first sync takes approximately 30–60 seconds depending on your connection and machine. Re-run
sync_scryfall.py daily (or set up a cron job) to keep card prices and EDHREC rankings fresh. The sync is completely independent of the user-facing tools and never blocks a deck analysis.Run the tool
Choose whichever interface suits your workflow. All three read from the same local database.
- Web App — starts a local Flask server at http://127.0.0.1:5000. Open it in your browser to browse the full deck with real Scryfall card images, filter by card category, and apply replacements one click at a time while watching the deck total update live.
- Interactive Terminal — steps through the deck card by card in your terminal, showing scored suggestions for each slot and letting you pick a replacement or move on.
- CLI Report — prints a single-pass Rich table with original card, suggested replacement, price delta, savings percentage, similarity score, and the reasons behind each match. Append
--jsonto get machine-readable output instead.
Next: Web App
Learn how to use the local Flask web app to review and replace cards across your entire deck with images and live price tracking.
Next: How Scoring Works
Understand the four-factor similarity formula — keywords, oracle text, CMC, and EDHREC rank — and how to read the score thresholds.