On this page

How a project flows through Dryv

  1. Author. You describe schemas, operations, events, policies and apps with the author library, in TypeScript or Python.
  2. Compile. The client runs your project's compiler (dryv-ts or dryv-py). The compiler turns the declarations into Canonical Runtime IR, the single source of meaning.
  3. Validate and plan. The client streams the IR to the engine. The engine validates it, loads the packs listed in dryv.yaml, and plans every file: which template, which subject, which path, and what it depends on.
  4. Render. Template servers render each planned file. The engine returns the files and a trace that explains why each one exists.
  5. Apply. The client shows the diff and writes files only when you approve.

Your source code never leaves your machine, only the compiled IR does. The engine never writes to your workspace. The client does.

1. Author

TypeScript, in dryv/contracts/index.ts:

ts
import { dryv, property } from "@dryvcode/author";

const shop = dryv.group({ name: "shop" });

export const shopProperties = shop.properties({
  Id: property.string.uuid(),
  Name: property.string(),
  Price: property.number.money({ minorUnits: true, currency: "USD" }),
});

export default dryv.app({ name: "shop" }).groups(shop);

Python uses the same concepts with Pythonic names: type: python and a Python entrypoint such as app.py.

2. Configure: dryv.yaml

yaml
version: dryv/v1alpha1

sources:
  authoring:
    main:
      type: typescript # or python
      path: dryv/contracts
      entrypoint: index.ts
  packs:
    official:
      repository: https://github.com/dryvcode/packs
      ref: <commit> # written for you by `dryv pack add`
      root: packs

packs:
  entities:
    source:
      $ref: "#/sources/packs/official"
      path: inject/persistence/typeorm-entities
    destination: { $ref: "#/destinations/entities" }

destinations:
  ir:
    main: { path: dryv/ir }
  entities:
    path: src/generated/entities

authoring:
  source: { $ref: "#/sources/authoring/main" }
  destination: { $ref: "#/destinations/ir/main" }

You rarely write the pack source by hand: dryv pack add <id> does it. See Find and use packs and dryv.yaml.

3. Run

CommandWhat it doesWrites files?
dryv buildCompiles authored source and writes configured Runtime IR YAML/JSON/JSONL filesyes
dryv validateCompiles and validates against the engineno
dryv planShows every planned file, its template and its pathno
dryv generate --dry-runRenders and shows the diffno
dryv generateRenders, shows the diff and asks before writingyes, after approval
dryv generate --checkFails when the generated files are out of date (for CI)no

Every command takes --api <url>, or reads DRYV_API_URL.

Where to go next

Search in