frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: mtg-crucible, an NPM package to render custom Magic the Gathering cards

https://www.npmjs.com/package/mtg-crucible
2•CarlsJrMints•1h ago
mtg-crucible is a node package which can run serverside or clientside. Given a structured description of a card, or a text representation of the card, it will produce an output image of the card.

Try it out in your browser: https://domainellipticlanguage.com/project/mtg-crucible-play...

Comments

CarlsJrMints•1h ago
There are a good number of tools for creating custom MTG cards, a few of them open source. But so far there haven't been any self-contained, composable packages. There are 3 main modules to the package, a parser with associated relevant interfaces, the rendering engine itself, and a React component for displaying rendered cards.

For the parser I was inspired by the lightweight text format that scryfall uses, like[1]

  Llanowar Elves {G}
  Creature — Elf Druid
  {T}: Add {G}.
  1/1
Crucible's text format [2] is a superset that allows specifying "non-functional" parts of the card, like flavortext, rarity, art, etc. The text format gets parsed into a structured CardData interface. One challenge was accomodating different structured abilites for different card types, like Planeswalkers, Sagas, etc. which I solved using TypeScript discriminated unions. This gives a fair amount of flexibility for consumers since if you are building a UI, you can use the structured ability interfaces, or you can use the raw string interface for abilities.

The rendering engine uses the Canvas API to compose the various visual elements. Implementing the rendering engine made me a lot more aware of card formatting details. For example hybrid frames vs. gold frames, accent colors, legend crowns, snow & nyx borders, information in the footer. There are a number of styling rule edge cases that had to be solved (a 2-color artifact uses those 2 colors in the accent, but gold for the type, name, and power/toughness boxes. But if the 2-colors are from hybrid mana, the accent is the same, but the name line uses the standard artifact color for the boxes).

This package also solves the problem of reinventing the wheel when displaying cards in a browser. It provides a React component which provides invisible text to make the cards ctrl+f-able, a context menu for copying the image or text of the card, and rotations for dual-faced cards.

This project had a lot of scope creep. MTG cards come in a variety of layouts, but it is heavily skewed towards "normal" (covering about 99% of cards) [3]. I had an MVP for rendering standard (or normal) framed cards in about a day. But I figured I should support all the primary card types, so I implemented support for Planeswalkers and Battles (about .1% and .01% respectively). Since Battles are dual-faced, I figured I might as well support transform cards and modal dual-faced. Then the Prepare mechanic came out in Secrets of Strixhaven so I should support that as well. In then end I supported just about every card layout, including split, flip, omen, adventure, aftermath, prototype, leveler. This greatly complicated the parser, rendering engine, and react component, but I am happy with how comprehensive the package is.

I've used this package for three projects so far (not including the playground page https://domainellipticlanguage.com/project/mtg-crucible-play...):

thismagiccarddoesnotexist.com [4] - a site for generating cards with AI

obsidian-custom-mtg [5] - an Obsidian plugin for making custom cards in markdown using a variant of the Scryfall spoiler text format

command-tower-mcp [6] - an MCP server for managing decks and custom cards on Archidekt.

If you build anything, I would love to know. Open a PR on the GitHub repo to give yourself a shoutout in the README https://github.com/domainellipticlanguage/mtg-crucible#in-th...

[1] https://api.scryfall.com/cards/73542493-cd0b-4bb7-a5b8-8f889...

[2] https://github.com/domainellipticlanguage/mtg-crucible#text-...

[3] https://scryfall.com/search?q=layout%3Anormal

[4] https://thismagiccarddoesnotexist.com/

[5] https://github.com/domainellipticlanguage/obsidian-custom-mt...

[6] https://github.com/domainellipticlanguage/command-tower-mcp

Test

1•lynn_lee•13s ago•0 comments

M5 CardputerZero – Pocket Raspberry Pi Computer for Hackers

https://shop.m5stack.com/pages/m5-cardputerzero
3•mromanuk•4m ago•0 comments

Show HN: Sonoday Radio – Listen to Podcasts like they are Radio

https://listen.sonoday.com
1•josnatol•6m ago•0 comments

Cloudflare Wrangler CLI auth profiles support

https://developers.cloudflare.com/changelog/post/2026-07-02-wrangler-auth-profiles/
1•sarreph•6m ago•0 comments

Lenny the LLM – You will learn how LLMs work from this fun short story

https://www.ivokund.com/lenny-the-llm-life-as-a-language-model/
1•ikund•9m ago•1 comments

DaisyUI uses AI generated images AND ART to sell merchandising

https://swag.daisyui.com/en-eur/products/html-scientist-t-shirt
1•manuel_png•9m ago•1 comments

How Well Can You Hear Audio Quality?

https://www.npr.org/sections/therecord/2015/06/02/411473508/how-well-can-you-hear-audio-quality
1•vgeek•11m ago•0 comments

Local Reasoning for Global Properties

https://tratt.net/laurie/blog/2026/local_reasoning_for_global_properties.html
1•surprisetalk•12m ago•0 comments

Show HN: Diff two versions of an AI agent and catch silent permission changes

https://www.agent-kits.com/drift
1•stoicstoic•14m ago•0 comments

86Box: Help Needed

https://86box.net/2026/07/03/help-needed.html
1•ingve•15m ago•0 comments

A Road to Common Lisp (2018)

https://stevelosh.com/blog/2018/08/a-road-to-common-lisp/
1•AlexeyBrin•16m ago•0 comments

Despite the darkness, I still see signs of hope in America

https://arstechnica.com/culture/2026/07/at-250-years-there-are-still-reasons-for-hope-in-america/
2•rbanffy•19m ago•1 comments

Demystifying MLsub – The Simple Essence of Algebraic Subtyping

https://lptk.github.io/programming/2020/03/26/demystifying-mlsub.html
1•weatherlight•20m ago•0 comments

Feedback about a Visualping alternative using AI to monitor websites

1•arthurdelerue•24m ago•0 comments

Hyperstition Unslop AI fiction writing contest

https://www.commonreader.co.uk/p/the-2026-hyperstition-unslop-ai-fiction
1•surprisetalk•26m ago•0 comments

Lords of Finance: The Bankers Who Broke the World

https://en.wikipedia.org/wiki/Lords_of_Finance
2•rendx•27m ago•0 comments

Why implementing ActivityPub is hard, and why it doesn't have to be

https://hackers.pub/@fedify/2026/why-activitypub-is-hard
4•dahlia•29m ago•0 comments

Show HN: NBA Trivia Game

https://stats-nba-game.onrender.com/
1•chistev•30m ago•0 comments

Seismograph – open-source early warning for silent LLM API drift

https://github.com/Tania-coder/SEISMOGRAPH
1•tania-coder•30m ago•0 comments

Open Hardware and Free Software: Teufel Mynd, a Case Study

https://fsfe.org/news/2026/news-20260629-01.en.html
2•hutattedonmyarm•33m ago•0 comments

Automatic Prefix Caching – vLLM

https://docs.vllm.ai/en/latest/design/prefix_caching/
1•ankitg12•34m ago•0 comments

Amazon has enough satellites to launch its Starlink competitor

https://www.theverge.com/science/960563/amazon-leo-service-tipping-point
4•root-parent•37m ago•0 comments

Wordgard Release 0.1

https://marijnhaverbeke.nl/blog/wordgard-0.1.html
1•exceptione•37m ago•0 comments

Open Source Touhou Clone

https://taisei-project.org/
3•BoingBoomTschak•42m ago•0 comments

GitHub is mailing free CDs of your public code to mock PlayStation disc changes

https://www.windowslatest.com/2026/07/03/microsoft-github-is-burning-free-cds-of-your-public-code...
4•ninko•42m ago•1 comments

We need an accounting system for cognitive debt

https://raw.githubusercontent.com/MikaeI/cognizance/refs/heads/main/we_need_an_accounting_system_...
3•theanonymousone•45m ago•0 comments

Say No to Online Age Verification

https://reclaimthenet.org/age-verification
6•bilsbie•45m ago•0 comments

Relationships make us happy – and healthy

https://news.harvard.edu/gazette/story/2023/02/work-out-daily-ok-but-how-socially-fit-are-you/
2•Anon84•46m ago•0 comments

Show HN: A tool to help people in social situations

https://spotthecue.com/
2•scamdrill•52m ago•0 comments

Show HN: Quick anonymous text and file sharing over the internet

https://9.1-1-1.de
1•y42•52m ago•0 comments