Project config
Create one config file at the project root:
layeron.config.tslayeron.config.mtslayeron.config.jslayeron.config.mjs
import { project } from "@layeron/core"
export default project({ app: "./src/app.ts",})Use backends when one Layeron project has several backend entry files:
import { project } from "@layeron/core"
export default project({ backends: { api: "./src/api.ts", admin: "./src/admin.ts", jobs: "./src/jobs.ts", },})All backend entries in the same project compile into one project resource graph
for the selected environment. Equal module declarations such as db({ name: "main", ... }) or storage.bucket({ name: "images" }) share the same logical
resource. Routes and handlers from every backend entry run in the same generated
app Worker.
Each backend entry must use the same backend({ project }) slug. Use app for
one backend entry or backends for named backend entries.
See Multiple backends for the compile model, shared resource rules, and split guidance.
project(options)
Section titled “project(options)”Create a Layeron project config.
project(options: ProjectOptions): LayeronProjectproject(...) parameters
Section titled “project(...) parameters”Options accepted by project(…) in layeron.config.ts.
| Field | Type | Required | Description |
|---|---|---|---|
app | string | undefined | no | Path to the backend app entry, relative to the project root. |
backends | Record<string> | undefined | no | Named backend app entries, relative to the project root. All entries compile into one project resource graph. |
env | LayeronProjectEnvConfig | undefined | no | Non-secret runtime values by environment. |
env shape
Section titled “env shape”env: { defaults?: Record<string, string | number | boolean> [environment: string]: Record<string, string | number | boolean> | undefined}Example:
export default project({ app: "./src/app.ts", env: { defaults: { API_BASE_URL: "https://api.example.com", FEATURE_CHECKOUT: false, }, prod: { FEATURE_CHECKOUT: true, }, },})Use Env for runtime value behavior.