# Generated Config From TOML

## Generated Config From TOML

**Files:** `src/config/config.toml`, `scripts/toml-watcher.mjs` · **Skill level:** Beginner

One of the biggest beginner pain points in Lumio is that `src/config/config.toml` is not read directly everywhere.

Instead, Lumio converts it into a generated JSON file:

- source: `src/config/config.toml`
- generated output: `.astro/config.generated.json`

### Why This Exists

A lot of Lumio code imports config like this:

```ts

```

This makes the config easy to consume from Astro components, utilities, and scripts without reparsing TOML everywhere.

### How It Gets Generated

The build helper is:

- `scripts/toml-watcher.mjs`

It:

1. reads `src/config/config.toml`
2. parses it with `toml`
3. writes `.astro/config.generated.json`
4. watches the TOML file in dev mode

The `dev` script in `package.json` differs by edition:

| Edition | `dev` script |
| ------- | ------------ |
| Astro, Sanity | `node scripts/dev.mjs` |
| Tina | `node scripts/tina/run.mjs dev` |

The other two scripts on this page:

```json
"build": "npm run toml:watch && astro build && npm run remove-draft-from-sitemap",
"toml:watch": "node scripts/toml-watcher.mjs"
```

That is the `build` script in the Astro and Sanity editions. In the Tina edition, `build` is `node scripts/tina/run.mjs build`, which does the same steps and adds Tina's own when your Tina Cloud keys are set.

### What This Means In Practice

#### In development

`npm run dev` generates the JSON, watches `config.toml` for changes, and starts the site, so changes to `config.toml` regenerate the JSON automatically. In the Tina edition, it also starts the editor. The watcher stops when the dev server stops.

#### In production build

`npm run build` regenerates the JSON first, then runs Astro build.

### Building For Another Address

`SITE_URL` is an environment variable that overrides `baseUrl` for a build.

### Common Confusion

If you edit `config.toml` but don’t see the expected change:

1. make sure you started the project with `npm run dev`
2. check that `.astro/config.generated.json` was regenerated
3. restart dev if the watcher or editor replacement behavior got interrupted

### Rule Of Thumb

- Edit `src/config/config.toml`
- Never manually edit `.astro/config.generated.json`

The generated JSON is an output artifact, not the source of truth.