Skip to content

Spell and Magic Item JSON (5etools)

Structured spells and magic items follow the same idea as creatureStats:

  • Data files live under src/content/docs/world/** with suffixes .spell.json and .item.json.
  • Astro collections spells and itemData load them; each file’s collection id is the path relative to world without .json (same rule as creatures).
  • Docs frontmatter may reference them with spellStats and itemDataStats (validated with SpellDataSchema and ItemDataSchema from @bastion-falls/5e-schema-zod).

The same files can drive inline <Spell /> tooltips in prose via the json or spell props; see 5etools: Inline spell, feat, and condition references.

YAML example:

spellStats:
demoFireBolt: misc/examples/fire-bolt.spell
import SpellBlock from '../../../../components/SpellBlock.astro';
<SpellBlock spell={frontmatter.spellStats.demoFireBolt} />

The collection is named itemData so it does not collide with the existing MDX item collection (src/content/docs/world/items). Frontmatter uses itemDataStats:

itemDataStats:
demoPotion: misc/examples/potion-of-healing.item
import ItemBlock from '../../../../components/ItemBlock.astro';
<ItemBlock item={frontmatter.itemDataStats.demoPotion} />

Fire Bolt

Evocation cantrip

Casting Time 1 action
Range 120 ft.
Components V, S
Duration Instantaneous

You hurl a mote of fire at a creature or object within range. Make a ranged spell attack against the target. On a hit, the target takes 1d10 fire damage. A flammable object hit by this spell ignites if it isn't being worn or carried.

This spell's damage increases by 1d10 when you reach 5th level (2d10), 11th level (3d10), and 17th level (4d10).

Potion of Healing

P, Common

0.5 lb.50 gp

A character who drinks the magical red fluid in this vial regains 2d4 + 2 hit points. Drinking or administering a potion takes an action.

  • entries and entriesHigherLevel use the same mixed 5etools shapes as the bestiary; the UI flattens them to plain text (including stripping {@...} tags to readable text where possible).
  • Item value in 5etools is typically in copper pieces; the block displays a simple gp / sp / cp conversion.
  • Do not register *.spell.json or *.item.json as a separate Starlight doc glob with docsSchema — only this project’s collections + frontmatter extension, matching the creatureStats pattern.