ReviewOS

stacks/stx

feat(config): support reusable application layers with deterministic resource overrides

#1969
Closed glennmichael123 opened this 10 days ago ·
10 days ago

Problem

stx plugins can contribute resources, but sharing a whole application foundation—configuration, layouts, pages, components, and composables—needs a defined inheritance and override model.

This would let related apps share an application shell or design-system foundation while replacing selected resources locally.

Existing foundation

Reviewed at 7d93c4c: config.ts and plugin-system.ts. Build on existing plugin/resource resolution rather than replacing it.

Scope and acceptance criteria

  • Support explicitly configured local and installed-package layers.
  • Define deterministic precedence between the app, its layers, and nested layers.
  • Resolve paths relative to the layer that declares them.
  • Specify merging rules for config objects, arrays, hooks, and resource collisions.
  • Support local overrides for shared components, layouts, and pages.
  • Detect cycles and provide useful conflict diagnostics.
  • Track layer dependencies for development invalidation and reproducible builds.
  • Include a two-app example demonstrating reuse and local overrides.

Remote Git fetching and a layer marketplace are outside the initial scope.

Prior art: Nuxt layers.

10 days ago

Implemented in 840659a, with host-isolation follow-up 1fbb3a0. Added explicit local/installed-package layers, deterministic app-first depth-first precedence, anchored resource paths, documented config/hook merging, shared pages/layouts/components/partials/composables with local overrides, cycle/route-conflict diagnostics, live dependency invalidation, and build provenance. Includes a working two-app example. Regression tests cover live external-resource edits, newly added pages, unchanged plugin setup on resource edits, and shared component caches/runtime config remaining isolated between applications. Public assets and server API trees are intentionally not merged; startup-setting changes still require restart. CI all jobs green on final head: https://github.com/stacksjs/stx/actions/runs/36016382789

Sign in to comment on this issue.