Skip to content

About

Open source Magic The Gathering Collection Database

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Colorless Mana — Magic: The Gathering Collection Database

A multilingual card database and personal collection tracker. Card data comes from MTGJSON, set icons and release dates from Scryfall. Users sign in with Discord.

Requirements

  • PHP 8.4.1+ — ctype, curl, dom, filter, gmp, iconv, intl, json, mbstring, pdo_mysql, redis, xml, zip
  • MariaDB 10.6+
  • Redis
  • Node and pnpm
  • Symfony CLI, optional — picks the PHP version from .php-version

Setup

git clone git@github.com:ThauEx/colorless-mana.git
cd colorless-mana
symfony composer install
pnpm install
pnpm run build

Create a .env.local with:

APP_ENV=prod
APP_SECRET=
DATABASE_URL="mysql://user:password@127.0.0.1:3306/colorless_mana?serverVersion=mariadb-12.3.3"
REDIS_URL=redis://localhost
OAUTH_DISCORD_CLIENT_ID=
OAUTH_DISCORD_CLIENT_SECRET=
SENTRY_DSN=

serverVersion has to match the running database, Doctrine generates its SQL for that version.

On an empty database the migrations do not apply — they continue an older schema. Create it from the mappings and mark them as done:

symfony console doctrine:schema:create
symfony console doctrine:migrations:version --add --all

Otherwise:

symfony console doctrine:migrations:migrate

Assets

pnpm run dev      # development build
pnpm run watch    # rebuild on change
pnpm run build    # production build

public/build/ is not in version control. Where the server has no Node toolchain, build locally and copy the directory across.

Card data

symfony console mtgjson:import:cards path/to/AllPrintings.json
symfony console mtgjson:import:prices path/to/AllPrices.json
symfony console mtgjson:sync:sets              # set codes and release dates only
symfony console mtgjson:cleanup:stale-cards    # dry run; --force to apply

The card import matches by Scryfall id, updating existing cards and creating missing ones, and refreshes the sets table along the way. The cleanup removes card rows the last import did not touch, which are leftovers from changed MTGJSON uuids.

Both dumps are also available gzipped:

curl -fsSL https://mtgjson.com/api/v5/AllPrintings.json.gz | gunzip > AllPrintings.json

Tests

symfony php vendor/bin/phpunit

Unit tests only, no database or kernel required.

Further reading

docs/card-finishes.md describes how foil types are modelled: the finishes, the rules for deriving them from MTGJSON, the exceptions, and the "★" convention for foil-only variants.

About

Open source Magic The Gathering Collection Database

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages