Docs

The recipe format.

A recipe is one JSON file in recipes/. The format is small. The rules behind it are what make a recipe trustworthy, so they come first.

The rules that matter more than the format

  1. Never invent an amount. An amount is the creator's own words: 4, 1 can, about 1 cup, a good amount. If nothing was said, the amount is null and its basis is unstated. The dashboard then shows amount not given. Vague filler such as some counts as unstated.
  2. Steps come from the video. A method the creator kept back is not filled in with general cooking knowledge. The recipe is marked partial and says what is missing under gaps.
  3. The key is what you would shop and filter by. Lowercase and singular: chicken, not skin-on chicken thighs. Things you buy separately stay separate, so chicken stock is its own key. Reuse the keys that already exist.
  4. Add a timestamp to each step where you can. On a YouTube recipe the dashboard turns it into a play from here button. Other platforms show the time as text, because their players cannot start at a given moment.
  5. Validate before you commit. Run npm run validate. When the recipe file exists, remove the matching entry from data/queue.json.
  6. Captured material stays out of the repository. Transcripts, captions and frames are the creators' own content. Only the finished recipe, written in your own words with the creator credited, goes in recipes/.

The file

One file per recipe, named after its id: recipes/gochujang-chicken-thighs.json holds the recipe with the id gochujang-chicken-thighs. The shape, with comments that are not part of a real file:

recipes/<id>.json
{
  "id": "gochujang-chicken-thighs",          // kebab-case, equals the file name
  "title": "…",
  "status": "analyzed",                       // or "partial": then gaps is required
  "video": { "platform": "youtube", "id": "…", "url": "…" },
  "creator": { "name": "…", "handle": "@…", "url": "…" },
  "uploaded": "YYYY-MM-DD",
  "analyzed": "YYYY-MM-DD",
  "summary": "1 or 2 plain sentences",
  "serves": "as stated, or null",
  "tags": ["lowercase", "…"],
  "components": [                              // for example Chicken, Pan sauce, To serve
    {
      "name": "…",
      "ingredients": [
        { "item": "Skin-on chicken thighs", "key": "chicken",
          "amount": "2 per person", "basis": "spoken", "note": "optional" }
      ],
      "steps": [
        { "text": "…", "t": 17 }              // t: seconds into the video, optional
      ]
    }
  ],
  "nutrition": { "per": "sub", "basis": "description", "calories": 517,
                 "protein_g": 43, "carbs_g": 39, "fat_g": 21, "note": "…" },
  "notes": ["…"],
  "gaps": ["what the video does not say"],
  "source": { "evidence": "what was checked", "quantity_basis": "…" }
}

Real files to read: recipes/ on GitHub. The one-page version of this page is the cheat sheet.

Fields

FieldRequiredWhat it holds
idYesA kebab-case slug. It must equal the file name without .json.
titleYesThe name of the dish.
statusYesanalyzed or partial.
videoYesplatform, id and url. The link must be one the project can parse, and platform and id must agree with it.
creatorYesname is required. handle and url credit and link the creator.
analyzedYesThe date the recipe was written, as YYYY-MM-DD.
uploadedNoThe date the video was published, as YYYY-MM-DD. Leave it out when it is not known.
summaryYesOne or two plain sentences.
servesNoAs the creator stated it, or null.
tagsYesA list of lowercase strings. It may be empty.
componentsYesAt least one part of the dish, each with a name, a list of ingredients and a list of steps.
nutritionNoOnly what the creator states: what it is per, its basis, and the numbers given.
notesNoA list of strings: tips and remarks from the video.
gapsFor partialA list of strings: what the video does not say. An analyzed recipe may have gaps too.
sourceNoevidence: what was checked. quantity_basis: where the amounts came from.

Ingredients and amounts

FieldWhat it holds
itemThe ingredient as you would read it in a recipe: Skin-on chicken thighs.
keyThe filter key, lowercase: chicken.
amountThe creator's words, or null.
basisWhere the amount came from. One of the four values below.
noteOptional. A remark about this ingredient.
BasisMeaningAmount
spokenThe creator says it in the video.Required
on-screenIt is shown as text in the video.Required
descriptionIt is written in the video description.Required
unstatedThe video does not give it.Must be null

To see the keys that already exist, start the dashboard and read the chip list, or run this in the repository:

Terminal
grep -h '"key"' recipes/*.json | sort -u

Steps and timestamps

A step has a text and, where the video supports it, a t: the number of seconds into the video where the step happens. Steps are written in your own words, not copied from captions. A timestamp is never guessed.

Partial recipes and gaps

Use status: "partial" when the creator withheld the method, or part of it, so the video itself does not give it. A partial recipe must list at least one gap. Say what is missing in plain words: the oven temperature for the chicken is not given. The dashboard shows the gaps on the recipe page.

Material you could not reach, such as captions behind a login or a failed download, is not a reason for partial. Record that limit in source.evidence. If nothing useful can be reached, write no recipe and mark the queue entry failed with a reason.

An analyzed recipe can have gaps as well. A complete method with an unnamed cut of meat is still analyzed; the unnamed cut is a gap.

What the validator enforces

npm run validate runs validateRecipe from lib/recipe.mjs over every file in recipes/ and exits with an error when one fails. The module is the source of truth. It checks that:

  • id is a kebab-case slug and equals the file name;
  • title and summary are not empty, and status is one of the two values;
  • analyzed is a date, and uploaded is a date when present;
  • video.url is a supported link, and video.platform and video.id match what the link says;
  • creator.name is not empty, and every tag is a lowercase string;
  • there is at least one component, each with a name, an ingredient list and a step list;
  • every ingredient has an item, a lowercase key and a known basis, with an amount exactly when the basis is not unstated;
  • every step has a text, and t is a number of seconds at or above zero when present;
  • notes and gaps are lists of strings, and a partial recipe has at least one gap.

The validator cannot tell whether an amount was really said. That part is the rules at the top of this page.

Shipped This is on the main branch today.

The note above is about the versioned contract: a schema version that a file may state in schema, a migration command (npm run migrate) and a JSON Schema export of the format.

The queue file

data/queue.json lists the videos that wait for analysis. An entry is queued, then analyzing, and is removed once its recipe file exists. It is marked failed when analysis is impossible. The dashboard hides a queue entry whose video is already a recipe, and the validator checks the queue too.

NextHow the analysis works