Code frameworks
What is a code framework?
Learn what a code project is, how its files map to Frameworks, Elements, Frames and the ledger, and what stays in The Forge.
The idea
A code framework is a game system that you write as a small project of files, instead of building it from nodes. You can use your own editor and your own tools. The Forge checks the project with the same compiler that builds your game.
The project format is called native-game-v1. Rules are written in a restricted subset of TypeScript. The subset has no imports, no network and no randomness, so a rule always gives the same result for the same input.
Dice happen on the sheet, not in the rules. A player clicks a dice roll in the Frame, reads the result, and types it into an action as an input. The rule checks the number and writes the outcome. The Roll against a skill recipe builds a percentile check this way.
How files map to Fabled
Each kind of file becomes something you already know from Fabled.
| File | Becomes | What it does |
|---|---|---|
| manifest/project.json | The Game | Names the project and lists its Frameworks and scenarios. |
| schemas/*.json | A Framework | Declares inputs, actions, Frames and content for one kind of Element. |
| rules/*.ts | Logic | Builds an Element, changes its values and calculates derived values. |
| layouts/*.json | A Frame | Draws the sheet or card and wires its buttons to actions. |
| scenarios/*.json | Tests | Builds an Element, runs actions and checks every value and write. |
An Element is a live instance of a Framework, such as one character. Every change to an Element is a write in its ledger. Actions never edit values in place. They ask the ledger to set or add a value, and your scenarios check those writes.
What a project looks like
This is the whole tree of the example game used in this guide. Lantern Keepers has one character with hit points, two actions, one sheet and two scenarios.
manifest/project.json
schemas/keeper.json
rules/keeper.ts
rules/hurt.ts
rules/heal.ts
layouts/keeper.json
scenarios/new-keeper.json
scenarios/heal.jsonWhat stays in The Forge
- You write and check the project. The compiler tells you what is wrong and where.
- You apply, prepare and release in The Forge. The server checks your project again, and its verdict is the one that counts.
- Rules cannot import packages or reach outside the project.

