On this page

Layouts and units

Proposed layout contract

The runtime layout is deliberately small.

Inject is the default and normally omitted:

yaml
# no layout key

Unit:

yaml
layout: unit

The value is scalar. Do not use layout.kind.

This belongs to the runtime pack contract, not only catalogue metadata.

The current discovery-only catalog.layout: inject | standalone is too coarse because standalone mixes reusable packages and editable applications.

Inject

An inject pack contributes artifacts into a destination/unit it does not own.

Examples:

  • TypeORM entities;
  • Zod schemas;
  • class-validator DTOs;
  • Flutter JSON models;
  • generated controllers added to an existing backend;
  • documentation fragments.

An inject pack may target:

  1. a unit established by a unit pack; or
  2. a handwritten existing project with no Dryv root-owning pack.

Unit

A unit pack establishes a generated unit root.

Runtime package identity is separate from layout and intentionally minimal:

yaml
layout: unit

package:
  name:
    $ref: "#/inputs/package_name"
  import_root: lib

Do not add an ecosystem field simply to make the Engine understand npm, Dart, Python or another package manager. Languages/frameworks remain discovery metadata.

Examples:

  • Dart API package;
  • npm API SDK;
  • Python client package;
  • Rust crate;
  • generated shared contracts library.

Typical result:

text
packages/api_client/
├── package manifest
├── configuration
├── generated public entrypoint
└── generated implementation

The package can contain static/global templates and dynamic templates in one pack.

It may also accept inject packs in the same unit when modular composition is useful.

Project

A project pack establishes an editable runnable/deployable project.

Examples:

  • Flutter application;
  • Next.js application;
  • NestJS application;
  • FastAPI application;
  • CLI project.

Typical result:

text
apps/mobile/
├── project manifest
├── user-editable scaffold files
└── Dryv-managed generated files

A project pack can be substantial. It does not need private internal packs merely because it generates many kinds of files.

Split functionality into additional packs only when independent reuse or composition has real value.

Unit ownership

Proposed validation:

  • one package or project pack may establish a given destination root;
  • any number of compatible inject packs may contribute to that unit;
  • two root-owning packs targeting the same unit are an error;
  • inject-only generation into a handwritten destination remains valid.

Example:

text
apps/backend/
  owner: unit/backend/nestjs
  contributors:
    inject/persistence/typeorm
    inject/validation/class-validator

packages/api_client/
  owner: package/clients/typescript-api-client

apps/web/
  owner: project/frontend/nextjs-app

Package identity versus workspace path

A generated package has at least two different identities:

text
workspace path
packages/api_client

consumer identity
@riderescue/api-client

or:

text
workspace path
packages/riderescue_api

consumer identity
riderescue_api

Do not conflate these.

A consuming pack must be able to learn generic package/unit facts from a bound provider while still deciding target-language import syntax itself.

Dryv should not generate framework/language import syntax.

Cross-unit dependencies

A frontend may consume operation.client from a generated package unit.

Conceptually the planner needs enough information to expose:

text
provider unit
provider package identity
producer artifact
producer symbol
package-relative artifact path
workspace-relative unit path

The consuming template decides whether that becomes:

text
import { createOrder } from "@riderescue/api-client"

or:

text
import 'package:riderescue_api/riderescue_api.dart';

or another target-specific form.

Unit as command-policy boundary

A generated unit maps to a destinations.code entry in the proposed Usage redesign. IR serialization destinations live separately under destinations.ir and are not generated-code units.

The generated unit is also the boundary for action resolution and project environment choices.

All packs targeting the same destination contribute to one unit-level set of:

text
dependencies
choice groups
actions
generated files

Usage configures the real environment on that destination:

yaml
destinations:
  backend:
    path: apps/backend
    choose: { js.package_manager: pnpm }

This is intentionally not pack-activation configuration. TypeORM, validation and a backend project pack contributing to the backend application must see the same package-manager choice because their commands execute in the same project.

Different destinations remain independent:

text
apps/backend            -> pnpm
packages/api_client     -> dart
apps/mobile             -> flutter

An inject-only handwritten destination is still a generated unit for this purpose even when no project or package pack owns its root.

Search in