Skip to content

ECS architecture maps: analysis, viewer and Vite plugin; ecs 0.8.0 - #289

Merged
krisnye merged 71 commits into
mainfrom
krisnye/architecture-map
Nov 30, 2026
Merged

krisnye merged 71 commits into
mainfrom
krisnye/architecture-map

Conversation

@krisnye

@krisnye krisnye commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Architecture maps for apps built on @adobe/ecs: an analysis in @adobe/ecs-architecture that writes a normalized document of an app's architecture, a new viewer app, @adobe/ecs-architecture-viewer, that draws it, and one Vite plugin that keeps an app's map current in dev and writes it with every build.

Includes @adobe/ecs 0.8.0's query refactor (also in #287), which this work builds on; #287's entity-generations commits to @adobe/data are not included.

Using it

import { Architecture } from "@adobe/ecs-architecture/vite";
plugins: [Architecture.plugin()]   // in place of Compiler.plugin()
  • Dev: the app's dev server shows the map at /architecture/, regenerated as source changes; the open map reloads, keeping its view (which lives in the URL).
  • Build: after the app's output, dist/architecture/ holds the viewer and the app's map; publish it with the app. Source links point to the file and line on GitHub at the built commit (from package.json's repository); in dev they open VS Code.
  • CLI: ecs-architecture map [--out <folder>] [--json [<file>]] [--web].

The map

  • Features left to right in dependency order; each feature's layers (model, ports, elements, view) stacked; sub-features collapsed until expanded; layer toggles; focus on any folder; every view state in the URL.
  • Each module lists headed, striped groups: components, archetypes, resources, indexes, systems (rows name(input)), elements (properties and events), plugins with their connect (defined elements, connected plugins, listeners event → system({ fields })).
  • Links: reads, writes, adds, removes, deletes, indexes, index lookups and watches, events firing listeners, listeners calling systems; inputs on the left, outputs on the right; ports on module borders; 90° routing with fewest bends, clearances from every outline, separate tracks for lines sharing a corridor, and fewer crossings.
  • Hover: related things outlined, the hovered thing's links in front with dashes marching from source to target, link tooltips naming each connection; tips with doc comments; click pins the doc and highlighted source with a link to the line.
  • Named types shown by name, expanded on hover; private data a module's systems use, muted; the public trait's violations in red.

@adobe/ecs-architecture

  • architectureOf(...): the document (nodes for folders, components, resources, indexes, archetypes, systems, elements, properties, events, fields, plugins, connects, definitions, listeners), each system's accesses from the build's own inference.
  • New checks: public-access (the new public trait on components and resources: true | false | "read" | "write"), connect-layer, run-in-connect, elements-defined (views define elements by their elements layer's constant).
  • Architecture.plugin() in @adobe/ecs-architecture/vite.

@adobe/ecs

  • The public trait (meta; the build leaves it out of registration, ecs-architecture checks it).

Samples

Elements layers export their elements by tag (<feature>Elements); views define them with it. All standard samples depend on the viewer and have an architecture script; the todo sample uses Architecture.plugin().

Versions

@adobe/ecs 0.8.0, @adobe/ecs-architecture 0.7.0, @adobe/ecs-persistence 0.3.0, @adobe/ecs-gpu 0.0.5, @adobe/ecs-architecture-viewer 0.1.0 (new).

Tests

The ECS workspace builds, typechecks and lints; every package's tests pass (ecs 2076, ecs-architecture 156, viewer 147, guide 136, samples), and check:workspace passes. The viewer's browser tests check routing invariants (directions, clearances, tracks, crossings, zoom exactness) over the todo, particles, voxel editor and self maps.

Follow-ups are in ecs/packages/ecs-architecture/FOLLOWUPS.md and ecs/packages/ecs-architecture-viewer/FOLLOWUPS.md (notably a public Compiler.describe before the map's analysis is published, and publishing the samples' maps on the site).

krisnye and others added 30 commits November 29, 2026 21:50
…m.exited; derived components removed

- Query.create and Query.and make archetype queries (with, not, shared values) and row queries (any value, comparisons, partial structs); every matching site takes one: systems, lookups, render systems, indexes, tables, despawnWhere, entered and exited systems, ecs-persistence selections
- Shared-value predicates are a system's filter
- System.removed is System.exited; System.entered runs for entities that start matching
- Component.derive and the derived trait are removed; within stays
- The build follows queries through module-scope consts and imports
- ecs-persistence 0.3.0, ecs-architecture 0.7.0 (query file kind)

Co-Authored-By: OpenCode <noreply@opencode.ai>
… exported symbol; particles sample gets the architecture script
…s, and links systems to what they read, write, add and remove
…cks each feature's model, elements and view, and keeps links outside modules until they turn in to a port
…a declaration, system or link brings its links to the front, thicker
…p layer, following the pointer, finding stacked links as wide as a link's hover area
…resource, which ecs-architecture checks and the map draws; the map shows inputs without readonly
…, and each plugin with its systems, linked to the element properties they set
…component's, resource's or element property's doc and declaration, beside it
…ight, linked to the systems their handlers run
…which set, and links view systems to the element properties they read
…lers run systems only from a connect; the map shows each plugin's connect, its listeners between the events and the systems they run
…f their elements layer, which ecs-architecture checks; the map shows the constant a connect defines
…r, its source on click, and bolds the elements it names
krisnye and others added 28 commits November 29, 2026 21:50
- Used carries despawns, from the build's commands
- a despawning system's deletes are the components its entities are found by: despawnWhere's query; for despawn, the lookup whose rows it despawns, its query or its index's, through the constants holding them, else the system's own query
- tests: despawn by row, by an index lookup, despawnWhere in place and named, and the build's inference
…rows striped

- a link's tip: a moment after the pointer is on a link, or a stacked spot or a port, a small translucent tip beside it lists each connection there once: toggleTodo writes done, todo-add fires → todosView todo-add listener, todosView todo-add listener calls addTodo
- a system's deletes are links of their own, red, from its output into the deleted component's input, related and hot as the rest
- every other row of a component, resource, element or outside box is striped across the box, reading across to its port
… keys and queries, and the systems' lookups on them
…what they're built from to the systems looking them up or watching them
…s listed, exported: false, and shown muted in its module
…ut; hovered links march their dashes from source to target
…again as the map's geometry changes, from unrounded positions
…acks, a net to a track, widening gaps too narrow to hold them
… across; order tracks and trade them to cross less over the whole drawing
…d writes it with every build; link templates replace the source path
Co-Authored-By: OpenCode <noreply@opencode.ai>
Co-Authored-By: OpenCode <noreply@opencode.ai>
…aries do, so the viewer typechecks before the build

Co-Authored-By: OpenCode <noreply@opencode.ai>
…as a watcher may still be starting

Co-Authored-By: OpenCode <noreply@opencode.ai>
…s its Linux browser fails; a follow-up to fix them

Co-Authored-By: OpenCode <noreply@opencode.ai>
@krisnye
krisnye merged commit 21f3ba1 into main Nov 30, 2026
4 checks passed
@krisnye
krisnye deleted the krisnye/architecture-map branch November 30, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant