Skip to content

Namespaces

Namespaces form a stable identity with name for named capability instances.

Terminal window
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.

Use a namespace when the same project has separate app areas, module families, tenant boundaries, or product-owned resources that need clear ownership.

Terminal window
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.

  • Use default for a single main instance.
  • Use short app-area names such as billing, admin, storefront, or webhooks.
  • Keep namespace and name stable after deployment.
  • Use the same namespace across related capabilities when that makes filtering, ownership, logs, or resource records easier to read.
  • layeron is 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.

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.