Superseded by 0126: every library package has
one entries-first shape; the domain, platform and lib archetypes are retired.
Context
A package’s internal shape decides every later structural question. Left open, each new package re-litigates it and review has nothing objective to cite. Three source shapes existed: four layers (core, application, infrastructure, presentation), entry folders per host (contracts, core, react, node), and a minimal flatsrc/. A standard that
describes packages which do not exist yet teaches people that standards are aspirational, so each archetype is marked
binding or reference.
Decision
-
A package names its archetype once, when created, on an
Archetype:line in itsAGENTS.md. -
The archetype set:
-
The domain archetype has four layers under
src/:coreis domain meaning. It imports no other layer and no host library (React, Encore, ORM,pg).applicationimportscoreonly and owns the ports it needs (application/ports/).infrastructureimplements those ports.presentationtranslates for application and core and never reachesinfrastructure. Its delivery surfaces (api,react,web,native) nest inside it.nativecomposesreact, neverweb.resources/andconfig/sit besidesrc/and are not layers.
-
Directories exist only when something real lives in them. No speculative
utils/orhelpers/. -
Subpath exports are deliberate (
./core,./application,./infrastructure,./presentation/api) so a dependency on an adapter or a surface is visible in the importing file. - A reference shape becomes binding when the first package of that archetype is merged, and the check for it lands in the same change.
Consequences
- Reviewers block on a layer violation by citing the lint rule, not by taste.
- The scaffold templates under
tools/scaffold/templates/packagesgenerate the canonical shape, so a new package starts green. /standards/packagesis the operating form of this decision.
Enforcement
packages/tooling/oxlint/src/boundaries.jsonc:no-restricted-importsoverrides keyed onsrc/core,src/application,src/presentationandsrc/presentation/native.validate-repository.mjschecksexportspoint at./srcand the preset and tier tags.- Planned: an
Archetype:field check and a barrel and deep-import check in the validator (shape check ported from academorixcheck-package-shape.mjs).
Supersedes and sources
Supersedes: none. Sources: basaltadr/0004, 0012 to 0018, 0029, 0036 and std/package-archetypes; figentra adr/0026-package-archetypes-and-host-entries.