Namespaces
Namespaces form a stable identity with name for named capability instances.
const database = db({ namespace: "billing", name: "main",})
const appLog = log({ namespace: "billing", name: "app",})The examples above have the identities billing/main and billing/app.
Omit namespace to use default.
When to use a namespace
Section titled “When to use a namespace”Use a namespace when the same project has separate app areas, module families, tenant boundaries, or product-owned resources that need clear ownership.
const publicApi = cache({ namespace: "storefront", name: "public-api",})
const adminApi = cache({ namespace: "admin", name: "public-api",})Both cache instances can use the same name because their namespaces are
different.
Naming rules
Section titled “Naming rules”- Use
defaultfor a single main instance. - Use short app-area names such as
billing,admin,storefront, orwebhooks. - Keep
namespaceandnamestable after deployment. - Use the same namespace across related capabilities when that makes filtering, ownership, logs, or resource records easier to read.
layeronis reserved for Layeron internal dependencies.
Changing a namespace changes the platform identity. Layeron treats the renamed instance as a different capability instance during compile, planning, and deployment.
Where namespaces appear
Section titled “Where namespaces appear”Layeron records namespaces in app specs, module metadata, generated resource metadata, product manifests, runtime payloads, logs, observability records, secret metadata, and deployment state.
This gives Layeron one consistent way to connect user code, generated Cloudflare resources, runtime behavior, and dashboard records.