Ensemble
Concepts

Workspace layout

Ensemble's core idea is that a project's folder structure should tell you where to find something without you needing to remember a convention. Every concern — app source, packaging, build output, shared code, deployment — gets its own top-level home, and nothing crosses those lines implicitly.

source/
  apps/<name>/               # app source, one folder per buildable unit
  core/<name>/               # shared code that speaks your project's domain
  libs/<name>/               # generic, cross-project-reusable code
  integrations/<kit>/<app>/  # an app wired for one deploy kit's platform (optional)
  ship/<name>/               # packaging inputs (Dockerfile, compile.yml, …) per ship
  envs/build/<app>.env       # default build vars for an app
  envs/pack/<ship>.env       # default pack vars for a ship
  artifacts/<name>/          # build output (gitignored), one folder per app
  artifacts/packages/        # pack output
.ensemble/
  kits/<role>/<kit>/         # kits: build, pack, deploy, lib, ecosystem
  ecosystems/<language>/     # each language's workspace root and lockfile
  config.yaml                # shared: app → build kit, ship → pack kit, workload → deploy kit, publish, hooks
  config.local.yaml          # gitignored, per-developer: personal var defaults
  vendor.lock.yml            # where each vendored kit/library came from
  deploy/<name>/             # gitignored: render cache, operation snapshot, secrets.env
  release/                   # secrets.env (publish credentials) and release state, gitignored
ci/<name>/
  delivery.yml               # the workload's delivery manifest (release, deploy, launch, operations)
  dev.env                    # development values `ens develop` loads
  <kit>/operations/               # per deploy kit: the scripts of its operations
docs/                        # the project's documentation

apps/<name> and ship/<name> both support nesting — a multi-process app made of several independently built/packed units lives as apps/my_app/server and apps/my_app/client (mirrored under ship/my_app/server, ship/my_app/client if both get packed). <name> throughout the CLI (ens build <app>, ens config set-build-kit <app> <kit>, ...) means that full path relative to apps/, not just the top-level folder.

Where a language's files go

A package's folder under source/ holds its code and its own manifest, such as deno.json or Cargo.toml. What usually sits at a monorepo's root, such as a workspace root or a lockfile, lives under .ensemble/ecosystems/<language> instead, so neither the repository's root nor source/ fills up with tool files. See Ecosystem kits.

The principles behind the layout

  • Each app is self-contained. Everything an app needs to build lives under its own source/apps/<name>. Every app is potentially a separate deployable artifact, so it should build and run independently of the others.

  • Concerns live in their own top-level folder. Source (source/apps), packaging (source/ship), and build output (source/artifacts) are kept apart, so you can focus on the layer you're changing without wading through the others.

  • Shared code is explicit and intentional. Cross-cutting logic lives in source/core and source/libs, pulled in deliberately instead of apps reaching into each other's folders. core speaks your project's own domain; libs is generic enough to be reused across projects — see Managing libraries for how a lib gets shared out.

  • Kits carry the mess so app folders don't have to. Build, pack, and deploy logic lives in .ensemble/kits, behind a common contract. An app folder only ever states which kit it uses, never how that kit builds, packages, or deploys it. See Kits.

Integrations

What a deploy runs for an app: explicit steps in green, conventions in amber

An app can stay free of every platform: its code takes the resources it needs as ports — a table, a bucket — and leaves where they come from to an integration, source/integrations/<kit>/<app>. An integration is the app's wiring for the platform one deploy kit deploys to: it builds the ports from that platform's resources (DynamoDB on aws, D1 on cloudflare), owns the dependencies that takes, and exports what the kit runs — for a function, a main.js default-exporting { fetch(request, env) }, with env as the kit documents it.

An app is built one of two ways, never both. A program on its own is build.<app>.kit, run as it is by whichever kit deploys it. A library is build.<app>.integrations, one entry per deploy kit it's wired for, each naming the build kit for that platform's runtime:

build:
  server:
    integrations:
      aws:
        kit: deno.bundle
      cloudflare:
        kit: deno.bundle

Each integration is built like an app, under the name integrations/<kit>/<app> — its source at source/integrations/<kit>/<app>, its output at source/artifacts/integrations/<kit>/<app> — and ens build <app> builds every one of them. Wherever the manifest names the app — a release's ship, a development.sync rule — the kit deploying runs that app's integration for it, so one delivery manifest deploys to every platform an app is wired for, and a release carries one bundle per integration. Deploying with a kit the library has no integration for is an error: there is no main to run.

A build kit builds the entry of the folder it's given, main.ts, into main.js; both names are Ensemble's (KitSdk.Entry), so no kit spells them out for itself, and deploy kits run main.js. ens app create <build kit> <app> --integration <deploy kit> scaffolds an integration for an existing app and registers it under build.<app>.integrations. The integrations/ prefix is reserved: no app is named under it.

Nothing here is an Ensemble API: the kit and the integration meet on a module shape and a documented env, and the ports are the project's own.

.ensemble/config.yaml vs .ensemble/config.local.yaml

Two files hold configuration, split by what should be shared with the team versus what's a personal convenience:

  • config.yaml — shared, git-tracked. Which build kit each app uses (ens config set-build-kit), and which deploy kit a workload deploys with when the command names none (deploy.<name>.kit, for a workload only one kit can deploy).
  • config.local.yaml — gitignored, per-developer. Default build/pack vars you don't want to type on every invocation (ens config set-build-var, ens config set-pack-var).

Defaults every developer shares belong in source/envs/build/<app>.env and source/envs/pack/<ship>.env instead. config.local.yaml wins over those files, and a -v KEY=VALUE on the command line wins over both.

Next

  • Kits — what a kit is and the roles it can play.
  • Delivery manifests — how a workload is declared and brought up.