Technology Stack
MTG Codex is a full-stack web application with several moving parts. Here's a complete breakdown of what's running under the hood.
Hosting & Infrastructure
The API runs on DigitalOcean App Platform in a Docker container. The database, search and the data ingest run on our proprietary infrastructure: the full Scryfall card data nightly, and prices every six hours. The frontend is served by Vercel, which handles CDN distribution and Edge caching; every change to the main branch is built on our own build infrastructure and published to Vercel. TLS certificates are managed via Let's Encrypt.
Languages & Frameworks
The backend is Python 3.10 running FastAPI with Uvicorn as the ASGI server. The frontend is Next.js 14 (App Router) with TypeScript and React 18. Styling is done with Tailwind CSS.
Databases & Search
PostgreSQL is the primary database, accessed via psycopg 3 with a synchronous connection pool. User accounts, collections, decks, tags, messages, notifications. Everything relational lives here.
Elasticsearch 9 powers the card search, pricing index, and faceted filtering. It's what keeps searches responsive across the card catalog, and what makes the multi-dimensional filters (color + type + rarity + set + oracle text) work together efficiently.
APIs & Third-Party Services
| Service | What It Does |
|---|---|
| **Google Gemini** | Card recognition on **Gemini 2.5 Flash Lite**, chosen for speed because a scan that gets slower is a scan you stop using. Deck analysis runs on **Gemini 3.5 Flash**, where thinking time buys better recommendations |
| **Scryfall** | Card data, images, and bulk pricing. The nightly ingest job pulls their full dataset |
| **EDHREC** | What other players run with each commander, and its most played combos, for suggestions and Pro Analysis. Each commander's page is kept for a week, so we ask them once, not every time you click |
| **Commander Spellbook** | Game-winning combos for the Synergies tab: which combos a deck has or is one card away from, with the steps |
| **SendGrid** | Transactional email for verification messages and password resets |
Key Libraries
On the Python side: PyJWT and bcrypt for authentication, Pydantic for validation, WebSockets for the real-time phone-to-desktop connection, Pillow for image preprocessing before it goes to Gemini, HTTPX for async HTTP, and ijson for streaming the Scryfall bulk JSON without loading the whole thing into memory.
On the JavaScript side: Axios for API calls, Lucide React for icons, Recharts for the price and deck charts, react-markdown with remark-gfm for notices and comments, date-fns for date formatting, qrcode.react for generating the scan session QR codes, and React Flow with dagre for the combo flow charts.
---
Legal & Attributions
Magic: The Gathering
MTG Codex is unofficial Fan Content permitted under the Wizards of the Coast Fan Content Policy. It is not approved or endorsed by Wizards of the Coast.
Magic: The Gathering, card names, card images, mana symbols, set symbols, and all associated trademarks are the property of Wizards of the Coast LLC, a subsidiary of Hasbro, Inc. Card images are sourced from Scryfall and are the copyrighted property of their respective rights holders. They are used here for identification and reference purposes only. MTG Codex does not claim ownership of any Magic: The Gathering card images, artwork, or related content.
Scryfall
Card data and pricing are provided by Scryfall (scryfall.com). Scryfall is not affiliated with or endorsed by Wizards of the Coast. Card images from Scryfall are used in accordance with their stated usage guidelines.
EDHREC and Commander Spellbook
Commander popularity numbers and combo play counts come from EDHREC (edhrec.com). Combo steps come from Commander Spellbook (commanderspellbook.com). Both are credited with a link wherever their data shows, and neither is affiliated with or endorses MTG Codex.
Open Source
MTG Codex is built on the shoulders of a lot of excellent open-source work. Sincere thanks to the maintainers and contributors of FastAPI, Next.js, React, Tailwind CSS, Elasticsearch, PostgreSQL, psycopg, Pydantic, Lucide, and every other library listed above.
Trademarks of the Software We Run On
Naming these is a statement of what MTG Codex runs on, nothing more. None of them are affiliated with this project, and none of them endorse it.
Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.
Elasticsearch is a trademark of elasticsearch B.V., registered in the U.S. and in other countries.
Vercel is a trademark of Vercel, Inc. DigitalOcean is a trademark of DigitalOcean, LLC.
Disclaimer
MTG Codex is a personal fan project, provided as-is without warranty. Card prices are sourced from Scryfall and are estimates. They may not reflect actual current market values. MTG Codex is not a marketplace and does not facilitate buying, selling, or trading of cards.