# @leumas/config-registry

The Imperium config engine — the app-config schema, per-mode data contracts, the site route contract and the JSX authoring format that let Web & Studio render and manage config-driven sites.


The Imperium config engine: an app-config schema + a registry/loader so **one config = one subdomain
app**. Web renders/previews config-driven apps; Studio manages and routes domains → apps.

**Absorbs (DRY-consolidated from):** `z.Domains2/core/src/Imperium/Main/ConfigLoader.jsx` + `RuntimeConfigLoader.secure.jsx` + the config structure in `Imperium.jsx`.

## Usage

Configs live in the `configs` collection and are served by `@leumas/hosting` (host → published
config). There is no build-time file loader: a `createRegistry()`/`loadFromGlob()` pair existed here
and was deleted in the Imperium catch-up program — it had zero consumers and would have been a
*second, competing* config source alongside the database.

```js
import { defineConfig, validateData, normalizeSiteRoutes } from '@leumas/config-registry';

const config = defineConfig(doc);        // safe defaults over a raw doc
validateData(config.mode, config.data);  // the mode's data contract
normalizeSiteRoutes(config);             // the four route buckets → one flat runtime table
```

A config carries `{ id, appName, mode, data, theme, baseApiUrl, header, footer, routes, redirects,
components, stores, accounts, databases, paths, seo, hosting }`. See `src/routes.js` for the route
record contract and `src/dataSchemas.js` for the per-mode data contracts.


---
Source: shared/packages/config-registry/README.md
Canonical: https://docs.leumas.tech/p/packages/config-registry
