Skip to content
Back to skills

Config

ASecurity

Per-env values a forge frontend reads at runtime — config_gen.ts and window.__FORGE_CONFIG__ from <basePath>/config.js, which runtime_config keys a bundle accepts (config_schema_gen.json, did-you-mean on a typo), required and required_when keys, the mode selector, and a frontend whose code lives in another repo (FORGE_RUNTIME_CONFIG_FILE, forgeRuntimeConfig()).

  • 10 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 13, 2026
developmentapifrontend

Works with

  • api

Security analysis

A100/100

Scanned November 18, 2026

npx -y skills add reliant-labs/forge --skill config --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Config?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Config
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reliant-labs-config/badge)](https://www.skillsdirectory.com/skills/reliant-labs-config)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: frontend-runtime/config
description: Per-env values a forge frontend reads at runtime — config_gen.ts and window.__FORGE_CONFIG__ from <basePath>/config.js, which runtime_config keys a bundle accepts (config_schema_gen.json, did-you-mean on a typo), required and required_when keys, the mode selector, and a frontend whose code lives in another repo (FORGE_RUNTIME_CONFIG_FILE, forgeRuntimeConfig()).
---

# Runtime config

Per-env VALUES (API origin, feature flags) are not part of this package. They
come from the generated `src/lib/config_gen.ts`, which reads
`window.__FORGE_CONFIG__` from `<basePath>/config.js`. Dev, Firebase, own-bucket
and hosted deploys all serve the same `{KEY: "value"}` shape, so the
bundle cannot tell them apart. See `frontend/runtime-config`.

Every `runtime_config` key must be one the bundle reads: a field of the
frontend's config message, or a forge runtime key (`API_URL`, `ENVIRONMENT`,
`OTEL_ENDPOINT`, `CONSOLE_CAPTURE`, `OTEL_REPLAY`, `REPLAY_SAMPLE_RATE`,
`PAGE_VIEWS`, `IDENTIFY_USER`, `RPC_FORENSICS`, `ANALYTICS_MODE`). `forge generate`
lists them in `src/lib/config_schema_gen.json` beside `config_gen.ts`, and every
render checks the env's `runtime_config` against the frontend directory's copy
— so a project declaring a frontend from ANOTHER repo gets a did-you-mean on a
typo instead of a field silently left on its default. No schema file (no config
message) means no check.

The schema also says which keys a document MUST carry, and the render refuses a
foreign frontend's `runtime_config` that lacks one (for an in-tree frontend the
typed KCL schema checks it). A field `required: true` with no default is
required in every mode. A field required only in one MODE says so with
`required_when`, a condition on a sibling string field:

```protobuf
string hosting = 6 [(forge.v1.config) = {env_var: "HOSTING", allowed_values: ["cloud", "self-hosted"]}];
string api_url = 1 [(forge.v1.config) = {
  env_var: "API_URL"
  required_when: [{field: "hosting", equals: "cloud"}]
}];
```

In the mode it names, the document must carry the key with a value other than
its default (the default is the other mode's value). `config_gen.ts`'s
`loadConfig()` throws on a miss, and exports `missingRequiredConfig()` for an app
that renders its own boot error. It is for frontend configs only: `forge
generate` refuses it on a binary config, alongside `required: true`, or naming a
field that is not a sibling string field.

A field a condition names (`hosting` above) is the document's MODE SELECTOR, and
a foreign frontend's `runtime_config` must state it, with a value, even for the
default mode. Without that rule the document that lost every key reads as a
valid default-mode one, since no condition holds, and the bundle boots in the
wrong mode with nothing failing. So give the default mode its own spelling in
`allowed_values` (`"self-hosted"` above) and have each env set it.

A frontend whose code is in ANOTHER repo (a sibling `path = "../other/web"` in
dev, or a source pin) never has a file written into that repo: forge renders its
`config.js` to `.forge/runtime-config/<frontend>/config.js` in the declaring
project, and `forge env up` hands the path to its dev server as
`FORGE_RUNTIME_CONFIG_FILE`. `forgeRuntimeConfig()` from
`@reliantlabs/forge-web-runtime/vite` serves it at `<base>config.js` (the
vite-spa scaffold includes it; it does nothing when the variable is unset).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.