How a project flows through Dryv
- Author. You describe schemas, operations, events, policies and apps with the author library, in TypeScript or Python.
- Compile. The client runs your project's compiler (
dryv-tsordryv-py). The compiler turns the declarations into Canonical Runtime IR, the single source of meaning. - 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. - Render. Template servers render each planned file. The engine returns the files and a trace that explains why each one exists.
- 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:
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
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
| Command | What it does | Writes files? |
|---|---|---|
dryv build | Compiles authored source and writes configured Runtime IR YAML/JSON/JSONL files | yes |
dryv validate | Compiles and validates against the engine | no |
dryv plan | Shows every planned file, its template and its path | no |
dryv generate --dry-run | Renders and shows the diff | no |
dryv generate | Renders, shows the diff and asks before writing | yes, after approval |
dryv generate --check | Fails when the generated files are out of date (for CI) | no |
Every command takes --api <url>, or reads DRYV_API_URL.