artysan/dragons-lairPrivate

Dragon's Lair

The digital companion of our D&D table.

The problem
At the table the rules live in nine books, the sheets on paper corrected by hand and the master's notes in a notebook.
What I built
An app for the players' phones and the master's laptop: it knows the rules, does the sheet's maths and keeps the campaign.

9rulebooks inside the app

TypeScriptReactDenoHonoPostgres
Start

§ 1The table

Maps and dice stay on the table. The rest goes in the app.

The app helps everyone, the master most of all. But the physical touch stays: real dice, paper maps, miniatures. For now, at least.

1234

On the table

  1. Maps and miniaturesPaper and plastic. The app doesn't draw them or move the pieces.

  2. Real diceWhoever plays rolls them; when the master asks for a roll, the result comes from the phone.

In the app

  1. Everyone's sheetOn the phone, and the app does the maths.

  2. The master's toolsEncounters, turns, monsters and secrets, on the laptop behind the screen.

No longer on the table:the booksthe paper sheetsthe master's notes

§ 2The rules

The app counts the rules.

Change one thing on the sheet and the numbers update by themselves, each with its reason.

  • Toughfeat

    Level4 → 5

    Hit point maximum
    44 → 54

    Tough gives 2 hit points per level: from 8 to 10.

    in the formathp.max + 2 * level

  • Defensefighting style

    Armornone → chain mail

    Armor Class
    11 → 17

    16 from the chain mail plus 1 from Defense, which counts only while wearing armor.

    in the formatac + 1 when wearing(armor)

  • Fireballspell

    Slot3rd → 5th

    Damage
    8d6 → 10d6

    One more die for every slot level.

    in the format(5 + slot)d6

  • Wild Shapedruid

    FormDruid → Wolf

    Armor Class
    13 → 12
    Speed
    30 ft → 40 ft
    Attack
    Quarterstaff → Bite +4

    The sheet takes the beast's numbers and attacks.

    in the formattransform: ac, speed, attacks

If the master forces a rule, it stays on record.Only the master can: the sheet marks it and the log remembers it.

Examples: 5.5 rules, invented characters

§ 3The .lair format

The rules are made of bricks.

I rewrote the books' rules with a few pieces the app knows how to use. A feat is no longer a paragraph to read: it's something the sheet applies.

Magic Initiatecomplete

Origin feat, can be taken more than once

  1. choiceA spell list: Cleric, Druid or Wizard.
  2. choiceTwo cantrips and a level 1 spell from that list.
  3. choiceThe ability to cast them with: Intelligence, Wisdom or Charisma.
  4. grantThe chosen spells go on the sheet.
  5. resourceOne free cast, back after a long rest.
  6. actionCast the spell without spending a slot.
A 5.5 feat, summarised: none of the book's text

The bricks

  • modifier
  • grant
  • resource
  • action
  • trigger
  • state
  • choice
  • collection
  • transform
  • patch
  • value
  • feature weapon

12 kinds of entry

classes · subclasses · features · feats · spells · items · creatures · conditions · tables · species · backgrounds · chapters

Every entry says how much it can do

  • completeThe app applies the whole rule.
  • partialIt applies part of it and says what's missing.
  • text onlyIt shows it; a person applies it.
  • You can only pick what the rule allows.
  • What the format can't say stays text, declared as such: no invented rules.

§ 4The master

The master sees everything. The others, their part.

Every line of the log has a version for the master and one for the others. And what the master hides doesn't exist for the players: it shows up in no list, search or menu.

The master

  1. 21:14Elara: 24 fire damageHP 20/44
  2. 21:16The master forces Elara's AC to 17was 16
  3. 21:18The master rolls d20 + 5, hidden14

Another player

  1. 21:14Elara: fire damageBloodied
  2. 21:16The master forces a value on the sheet
  3. this line never reaches the player

The master seesRing of Misfortunecursedshows as «Ring of Protection»

Whoever wears it seesRing of Protection

What the master can hide

  • The codex. A whole entry, or a single block inside one.

  • The compendium. Books, chapters or single entries, campaign by campaign.

  • Secret parts. Like an item's curse: the player reads it only once the master reveals it.

  • Masked items. The player sees a fake name until the master reveals the real one. Rolls already use the real numbers.

404If someone tries to open it anyway, the app answers «not found», as for a thing that isn't there.

Example: invented campaign, names and items

§ 5At the table, today

What the app already does, evening after evening.

We really play with it: every feature was born from an evening at the table.

The evening

  • Initiative and turns

    The master prepares encounters; the app lines up the turns.

  • Concentration

    Whoever takes damage gets the saving throw on the phone.

  • Timed effects

    They last rounds, minutes or hours, and expire by themselves.

  • Proposals

    What a player does to another waits for the master's yes.

  • Loot

    Shared at the table, even mid-fight.

  • Game nightscoming

    Opened and closed, with their notes.

The character

  • Guided creation

    Level 1 step by step, with filtered choices.

  • Levelling up

    Guided, and choices aren't lost when you switch phones.

  • Sheet on paper

    Two A4 pages, like the Player's Handbook sheet.

  • Roll tray

    Free rolls or rolls asked by the master, always at hand.

Between evenings

  • Codex

    The campaign's memory: places, people, clues.

  • Journals

    Everyone tells their own version.

  • Atlas

    The maps, with the fog the master lifts where the party has been.

  • Messages

    Between master and players, inside the campaign.

§ 6The assistant

An AI assistant that knows the rules and the campaign.

It connects to the app through MCP, the standard way an AI assistant uses a program. It reads the compendium and works on the campaign under the master's own rules: every change stays in the log and can be undone.

The master and their assistant

  1. On the city map, what's at the harbour?
  2. Cutting the harbour out of the map to read it up close. coming
  3. Three piers, a watchtower and an inn. Shall I make it a codex entry, visible only to you?
  4. Yes, thanks.

In the app

The citythe harbour

The harbourmaster only

  • · Three piers
  • · A watchtower
  • · An inn

via assistant · can be undone

Example: invented city and places

The end

The rest is in the details.

Below is the project README. For questions, or to work on something together, get in touch.

Details

README.md

What it is

Dragon's Lair is the app we use at our D&D table (5.5 rules): everyone has their sheet on the phone, the master has his tools on the laptop, and the campaign lives in one place. We play in person: maps, miniatures and dice stay on the table. It is not a virtual tabletop.

What it does

  • Computed sheet. Armor Class, hit points, rolls, spells, resources: the app counts the numbers from the rules, and each says where it comes from. Only the master can force them, and the override stays on record.
  • Characters. Guided level 1 creation, levelling up that keeps your choices, a printout on two A4 pages like the Player's Handbook sheet.
  • The evening. Prepared encounters, initiative and turns, effects that expire by themselves, the Concentration save asked on the player's phone, proposals between players that the master accepts or refuses, loot.
  • The campaign. Codex, journals, an atlas with fog, messages, a searchable compendium of the books.
  • Who sees what. Every log line has a version for the master and one for the others. The master hides codex entries, parts of the compendium, secrets and masked items; to someone who shouldn't know, the app answers 404, as for a thing that doesn't exist.
  • Assistant. An MCP server: an AI assistant reads the compendium and works on the campaign under the master's rules, and every change can be undone.

Italian and English; the books' data stays in English.

Architecture

format → engine → contract → api → web, in one repository:

  • format: the schemas of the .lair format (12 kinds of entry, the rules' bricks, a small formula language). A book is a package of JSON files, validated before it reaches the table.
  • engine: the rules engine, pure code with no I/O: it takes the character and the packages and returns every number with its reason.
  • contract: the API's endpoints and answers, described with zod.
  • api: Hono on Postgres.
  • web: React + Vite. The web never recomputes a rule: it shows the engine's numbers. A CI check makes sure the boundaries between packages stay where they are.

Stack

TypeScript, Deno, Hono, React + Vite, Postgres, zod.

In numbers

Area Lines of TypeScript (tests excluded)
engine ≈ 16,600
format ≈ 10,900
contract ≈ 14,600
api ≈ 60,100
web ≈ 76,100
Total ≈ 178,000

Deploy

Coolify on my server: database, API and web. The development branch is the test environment with an invented demo campaign (the one behind the link) and updates by itself when CI is green. release is the table: I publish it myself, after a backup; database backups are automatic.

Licence and rights

The code is AGPL-3.0. The app, the engine and the format are public. The books are not: the text comes from 5etools and the rights belong to Wizards of the Coast. The book packages live in a private repository and never enter the public repository or the app's images. The mechanics in the packages are mine; this presentation shows only names and formulas, never the books' text.

What stays private

The books, and the campaign's and players' data.

Artysan.

Custom software, automation and integrations. From Rome.

© 2026 Samuel Tagliacozzo · Artysan