MTG Cheaper Deck uses python-dotenv to load configuration from aDocumentation 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.
.env file placed in the project root. When any module is imported, load_dotenv() runs automatically and populates os.environ with the values in that file. There is only one required variable — DATABASE_URL — and it already has a sensible default, so a minimal setup requires nothing more than creating the file shown below.
Create the .env file
Place a.env file at the project root before running any command. The minimal configuration that gets everything working out of the box is:
Environment Variables
SQLAlchemy connection URL for the card database. Controls which database engine is used to store and query Scryfall card data. Defaults to
sqlite:///./data/cards.db when the variable is not set.SQLite (default)
SQLite requires zero additional installation — it ships with Python’s standard library. WhenDATABASE_URL points to a SQLite file, init_db() (called inside db.py and at the start of sync_scryfall.py) automatically creates the data/ directory if it does not exist, so there is no manual folder setup needed. The database file is excluded from version control via .gitignore, so it will never be accidentally committed.
PostgreSQL
To switch to PostgreSQL, changeDATABASE_URL to a PostgreSQL connection string and install the driver:
.env:
db.py table definition and upsert logic are fully portable — no changes are needed there. The get_engine() function detects the dialect at runtime and sets the appropriate connection arguments automatically.
Data directory
The following files are created underdata/ during normal operation. All of them are excluded from git:
| File | Description |
|---|---|
cards.db | SQLite database containing all synced Scryfall card data. Excluded from git. |
oracle-cards.jsonl.gz | Compressed bulk file downloaded from Scryfall. Re-downloaded on each sync_scryfall.py run. Excluded from git. |
compare.html | Temporary card comparison page generated during analysis. Excluded from git. |
The
.env file itself is also listed in .gitignore and will never be committed. Keep any sensitive credentials (such as a PostgreSQL password) out of version control by relying on this exclusion.