react-runtime-config

Inject environment-specific values into React apps at container startup.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/tassosgomes/poc-iam-service --skill react-runtime-config
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-runtime-config
Source: https://github.com/tassosgomes/poc-iam-service/tree/main/.github/skills/react/react-runtime-config
Command: npx skills add https://github.com/tassosgomes/poc-iam-service --skill react-runtime-config

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This document outlines runtime configuration and containerization patterns for React frontends, enabling 12-factor style configs and avoiding rebuilds when environments change.

Core Features & Use Cases

  • Centralized runtime-config governance with runtime-env.template.js, runtimeConfig.ts, and a startup script to generate runtime-env.js.
  • Env-driven deployment across environments (prod, staging, dev) without rebuilding images.
  • Clear architecture guidance for using Docker multi-stage builds with Nginx at runtime.

Quick Start

Configure and run a containerized frontend using runtime-env.template.js to generate runtime-env.js at startup.

Frequently Asked Questions about react-runtime-config

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inject runtime configuration into a React app without rebuilding the Docker image?

Runtime configuration injection replaces environment-specific values at container startup. A startup script uses envsubst to generate runtime-env.js from a template, injecting API endpoints and feature flags into the React app without requiring a rebuild.

What is the 12-factor approach for managing environment variables in containerized React frontends?

The 12-factor approach separates config from code by externalizing environment variables. For containerized React frontends, a runtimeConfig.ts module validates required variables and consumes a generated runtime-env.js file to apply environment-specific settings dynamically.

How do I configure different API endpoints for React deployments across staging and production environments?

Configuring different API endpoints across environments uses a runtime-env.template.js file processed at container startup. The startup script validates required variables and generates runtime-env.js with environment-specific endpoints for the React application.

Does this runtime config approach work with Docker multi-stage builds and Nginx?

This runtime config approach is designed for Docker multi-stage builds using Nginx at runtime. The build stage compiles the React app, while the startup script generates runtime-env.js with environment variables before Nginx serves the application.

Why do I need envsubst to generate runtime-env.js for my React application?

Envsubst generates runtime-env.js by substituting environment variable values into a runtime-env.template.js file at container startup. This mechanism allows the React application to read environment-specific configurations dynamically without embedding them during the build stage.

What happens if required environment variables are missing when starting a containerized React frontend?

The startup script validates required environment variables before generating runtime-env.js. If required variables are missing, the validation process fails, preventing the containerized React frontend from starting with incomplete or invalid runtime configurations.