@layeron/loader
v0.1.0
Published
Project loader and bundler for Layeron backend apps.
Maintainers
Readme
@layeron/loader
@layeron/loader loads user backend apps for development, compilation, and
runtime generation.
The loader returns the app declaration protocol and the in-memory handler registry:
project directory
-> conventional backend entry
-> bundled ESM module
-> default exported backend app
-> AppSpec + HandlerRegistryThe project root must contain layeron.config.ts or an equivalent
layeron.config.{mts,js,mjs} file. The config points to the backend app entry:
import { project } from "@layeron/core"
export default project({
app: "./src/app.ts",
})Non-secret runtime config belongs in layeron.config.ts under env. Defaults
apply to every environment, and a selected environment overrides them:
export default project({
app: "./src/app.ts",
env: {
defaults: {
API_BASE_URL: "https://api.example.com",
FEATURE_CHECKOUT: false,
},
prod: {
FEATURE_CHECKOUT: true,
},
},
})The loader resolves env for the active environment and stores the result in
AppSpec.metadata.env, making it available to app code and Product Workers
through the runtime env helper.
The loader validates the app export shape instead of relying on class identity, which lets bundled user code and Layeron internals stay decoupled.
