# An open format for recipes

Source: https://savorum.app/sref/

> SREF 0.5.0 (Structured Recipe Exchange Format): an open JSON and ZIP recipe format with exact quantities, explicit units, original wording, and bundled photos.

SREF, the Structured Recipe Exchange Format, saves a recipe as plain JSON: its ingredients, method, original wording, and where it came from. Savorum uses SREF to export recipes. The specification is a separate, open project.

Keep exported recipes wherever you like. A recipe package can also hold photos and attachments, and any app that supports SREF can open it. Your books, tags, and history stay in your Savorum library.

[Read the specification](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/spec.md)

[Source on GitHub](https://github.com/savorum/sref)

## Current release

- **Format:** SREF 0.5.0
- **Unit registry:** 0.3.0
- **Encoding:** UTF-8 JSON
- **Licenses:** CC0 1.0, MIT for code
- **Repository:** [savorum/sref](https://github.com/savorum/sref)

## The recipe and its SREF document

One recipe, shown as readable content and portable JSON.

### Lemon yogurt dip

Makes 2 servings · Prep 5 min

#### Ingredients

- 150 g plain yogurt
- 1 teaspoon lemon juice
- a pinch of salt

#### To serve

- Raw vegetables, to serve

**Equipment:** mixing bowl · spoon · fine grater

#### Method

1. Stir the yogurt, lemon juice and salt together.
2. Taste, adjust the seasoning and serve with raw vegetables.

#### Recipe note

For a thicker dip, drain the yogurt in a fine sieve before mixing.

lemon-yogurt-dip.recipe.jsonComplete SREF 0.5.0

```
{
  "sref": {
    "version": "0.5.0",
    "unit_registry": "0.3.0"
  },
  "id": "lemon-yogurt-dip",
  "title": "Lemon yogurt dip",
  "ingredient_sections": [
    {
      "id": "ingredients",
      "ingredients": [
        {
          "id": "yogurt",
          "name": "plain yogurt",
          "source_text": "150 g plain yogurt",
          "quantity": {
            "kind": "simple",
            "amount": {
              "value": "150"
            },
            "unit": "mass.gram"
          },
          "normalization": {
            "method": "extracted"
          }
        },
        {
          "id": "lemon",
          "name": "lemon juice",
          "source_text": "1 teaspoon lemon juice"
        },
        {
          "id": "salt",
          "name": "salt",
          "source_text": "a pinch of salt"
        }
      ]
    },
    {
      "id": "to-serve",
      "title": "To serve",
      "ingredients": [
        {
          "id": "vegetables",
          "name": "raw vegetables",
          "source_text": "Raw vegetables, to serve"
        }
      ]
    }
  ],
  "instruction_sections": [
    {
      "id": "method",
      "steps": [
        {
          "id": "mix",
          "text": "Stir the yogurt, lemon juice and salt together.",
          "ingredient_uses": [
            {
              "ingredient_ref": "yogurt"
            },
            {
              "ingredient_ref": "lemon"
            },
            {
              "ingredient_ref": "salt"
            }
          ]
        },
        {
          "id": "serve",
          "text": "Taste, adjust the seasoning and serve with raw vegetables.",
          "ingredient_uses": [
            {
              "ingredient_ref": "vegetables"
            }
          ]
        }
      ]
    }
  ],
  "notes": [
    "For a thicker dip, drain the yogurt in a fine sieve before mixing."
  ],
  "yields": [
    {
      "text": "2 servings",
      "quantity": {
        "kind": "simple",
        "amount": {
          "value": "2"
        },
        "unit": "count.serving"
      },
      "label": "servings"
    }
  ],
  "times": {
    "prep": {
      "value": "PT5M"
    }
  },
  "equipment": [
    {
      "name": "Mixing bowl"
    },
    {
      "name": "Spoon"
    },
    {
      "name": "Fine grater"
    }
  ]
}
```

- **The words the recipe used:** `source_text` retains “150 g plain yogurt” and “a pinch of salt”. A reader can keep that wording even when no structured amount is recorded.
- **A quantity a program can use:** The yogurt also has the exact value `"150"` and unit `mass.gram`. The pinch has no invented numerical equivalent.
- **The author’s note:** `notes` travels with the recipe. It is different from a private note saved in an application’s library.

## When the recipe includes files

A plain `.recipe.json` file is enough for the small example above. A `.sref` package is a ZIP archive that keeps a recipe together with its declared photographs or other assets.

The Baba Ganoush package from Savorum’s actual export includes one source photograph. Open it with a ZIP tool to inspect these three files.

[Download Baba Ganoush (.sref)](https://savorum.app/downloads/baba-ganoush.sref)

Recipe: [Wikibooks](https://en.wikibooks.org/w/index.php?title=Cookbook:Baba_Ganoush&oldid=4629606) ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)).

Photograph: [Breville USA](https://commons.wikimedia.org/w/index.php?title=File:Baba_Ganoush_05of05_(8735238183).jpg&oldid=876048791) ([CC BY 2.0](https://creativecommons.org/licenses/by/2.0/)).

### baba-ganoush.sref

- **`recipe.json`:** The complete structured recipe, including its asset reference.
- **`manifest.json`:** The package inventory, with sizes and hashes used to check its files.
- **`assets/rc-000175-image`:** The declared recipe photograph, stored as image/jpeg.

A `.srefbundle` keeps multiple complete recipe packages in one ordered archive.

## Specification and tools

These examples target released SREF **0.5.0**. Read the specification first, then use the schema and validator when building or checking a recipe file.

### [Read the specification](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/spec.md)

The complete definition of the format and its rules.

### [Check the JSON structure](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/snapshots/0.5.0/schema/recipe.schema.json)

The canonical schema defines fields and their types.

### [Validate the recipe](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/conformance/validate.py)

The reference validator also checks semantic constraints, with [conformance examples](https://github.com/savorum/sref/tree/d179e04734574d864c80252bb8d6ec02f2ca1b2d/tests).

### For implementers

- [SREF repository](https://github.com/savorum/sref) with the specification, schemas, and conformance tests
- [Download the matching schema](https://savorum.app/downloads/sref-0.5.0.recipe.schema.json)
- [Unit registry](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/snapshots/0.5.0/registry/units.json) for structured measurements
- [Python reader](https://github.com/savorum/sref-reader) and [writer](https://github.com/savorum/sref-writer) libraries

### Export is not a backup

SREF carries recipe content. Whole-instance recovery also needs the application’s library organization, history, database, and original assets. Use Savorum’s [export and backup guide](https://docs.savorum.app/guide/export-and-backup/) to choose the right copy.

A structured file can be inspected with a text editor. A cooking interface or a transfer to another application still needs compatible software. SREF is not the [Savorum API](https://api.savorum.app/).

### Licenses have different scopes

The SREF specification, schema, registry, and canonical examples use **CC0 1.0**; reference code uses **MIT**. Savorum itself uses **AGPL-3.0-only**. The format does not change rights in a recipe or photograph.

See the [SREF license map](https://github.com/savorum/sref/blob/d179e04734574d864c80252bb8d6ec02f2ca1b2d/LICENSE.md). This page’s original lemon yogurt example is also dedicated under [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/).
