2.1 KiB
2.1 KiB
AGENTS.md
Online multiplayer Magic: The Gathering (Commander) emulator: Nuxt frontend + Fastify API with a synchronous rules engine that executes compiled card effects.
Layout
backend/— Node 24, Fastify 5, TypeScript (ESM, NodeNext).src/effects/is the oracle-text compiler/pseudocode DSL,src/game/the rules engine and in-memory match manager.frontend/— Nuxt 4 / Vue 3, sources underapp/.backend/docs/card-effects.mdandbackend/docs/game-engine.mdare the detailed references for those subsystems;README.mdhas the full API and config tables.
Commands
docker compose -f docker-compose.dev.yml up --build # full dev stack (:3000, :4000)
cd backend && npm install && npm run dev # API only
cd frontend && npm install && npm run dev # UI only
cd backend && npm test # all backend tests
cd backend && npm run import:cards # Scryfall bulk data -> data/cards.json
cd backend && npm run compile:cards # oracle text -> data/card-effects.json + pseudo.txt
Things to know
- Backend imports need
.jsextensions (NodeNext) even though sources are.ts. backend/data/cards.json(~21 MB) andcard-effects.jsonare generated, not committed; run the import/compile scripts after changing the importer or compiler. Missing card data makes/cardsreturn503.- Manual card implementations live in
backend/data/card-overrides/(one file per card, pseudocode DSL) and take precedence over generated output when compiling. - The effect compiler is conservative: unparseable oracle lines become
unsupportedwith original text — never guess or silently drop them. - Matches are in memory and lost on restart; accounts, saved decks, playmat preferences, and per-deck card backs are in MongoDB through
backend/src/accounts.ts. Game seats still use a per-seat token in the frontend'ssessionStorage; the account login token is in a cookie so the server can gate pages. - Keep style of surrounding code: 2-space indent, single quotes. No linter or formatter is configured.