ConfigHub · Durable config for coding agents
Docs / docs/journeys/existing-app.md Source on GitHub →

Bring your own app: change settings safely, preview live, and deploy anywhere

Connect an app you already have without rewriting its config files, fighting fiddly env variables, or changing how it deploys. ConfigHub keeps separate base, staging, and live (production) copies in a local hub so your agent can make changes without breaking things, you can deploy to any service easily, and you can always go back cleanly (Learn step by step · Going back).


Run a preview of my app

To see staging and production in the app as it already runs, step by step with a small Python app, follow the walkthrough.

You choose the app, ask for a change and open the address. Your agent changes the preview setting, checks the response and leaves it running. Your working files and both staging and production settings stay as they were.

Prerequisites: The Claude Code plugin or Codex setup, an app that reads a setting from .env, .env.local or .env.development, and lsof installed. The preview runs your app the way it already runs: the dev or start script in package.json, the web: line of a Procfile, or a command you give. Next.js, Vite and Python apps work this way, and your files are not changed. The app has to listen on 127.0.0.1 or take the address and port it is given; a command that listens on every network address is refused, and you can give it after -- with an option that keeps it on this machine. No app yet? Ask your agent to make a small sample app first.

  1. In the app folder, ask for the change you want:

    Try “Evening collection” as the heading. Keep the usual board as it is. I’d like to open the preview again tomorrow.

    Pick a setting your app already reads. Say yes when your agent offers to attach the app locally. The first download can take a minute (package size); it runs two local 127.0.0.1 processes (ConfigHub and PostgreSQL, no Docker), and cub local uninstall --delete-data removes them and their data cleanly.

  2. Open the address your agent gives you in this chat. It has checked the page with the app’s preview settings. Codex may ask for permission to run the setup command or read the local address.
  3. Later, open a fresh chat in the same app folder and ask “Where’s the preview, and what does it say?” Your agent checks the running process and reads the page. You can ask it to stop the preview when you’re finished.

You can try a change you care about the same way. For example, ask a queue app to try a larger batch before a busy weekend. With 360 sample jobs, our usual app returned three batches of 120. The preview returned one batch of 240 and one of 120. What we checked.

See what Claude Code and Codex returned.

Compare with last Friday

Once the hub has saved production settings from Friday or earlier, ask “Open Friday’s production settings as a new preview.” Your agent runs the current checkout with the settings the hub held for production at the end of the most recent completed Friday in your timezone. If you attached the app on Saturday, its history starts on Saturday. You can still preview a change to today’s settings. Otherwise, open the historical preview and compare it with your usual app. In a fresh chat in the same folder, ask “Where’s the preview I left running, and what does it show?” What the two-starter app served.


What you do

Works with any .env, Compose, Terraform, or Kustomize repository:

  1. Install the plugin (README).
  2. Open Claude Code in your app’s repository and ask:

    Attach ConfigHub to this existing app: keep my staging and production values as they are, and require my approval before production changes.
  3. Review production’s starting settings when you want to use them. Paste the exact approval command the agent gives you into your own terminal. Check the named order and values before you confirm. With a Kustomize overlay that defines every production value, there may be no pending change.
  4. Commit .confighub-app (the pointer linking your repo to the hub).

Supported configuration files

Your app keeps settings inShared basestaging overrideslive (production) overrides
Env / Compose.env.local, .env.development, .env, app.env, compose.yaml, or .env.example.env.staging.env.production (non-secret values only)
Terraformcommon.tfvarsstaging.tfvarsprod.tfvars
Kustomizebase/overlays/stagingoverlays/prod, production, live, or Argo CD target
Helm chart valuesUse cub helm install instead of adopt (see Helm values)——

Never put secrets or passwords in .env.production. Values that look like credentials are automatically skipped. Store secrets in your host (Vercel, Fly, Vault) or via cub secret set in your own terminal so no agent key can read them (secrets guide).

What it takes

Changing the app later

Edit files with your agent as usual. Your agent uploads changes with cub repo upload APP-FOLDER --component APP --change-desc "WHY":

What you have now & what to try next

You have unchanged source files, base / staging / live copies in your local hub, a scoped APP-agent key that can propose but never approve production, and a local prompt history record.

Try next in the same repo:

  1. Ask the agent to raise a limit for production → run cub inbox list in your terminal to approve or refuse it.
  2. Type /confighub:why SETTING_NAME in Claude Code to see every change and prompt behind it.
  3. Run cub repo receipts APP --setup to inspect copies, keys, rules, and overrides.

More walkthroughs: Your first hour · Staging-only memory bump · Web starter · Argo CD · Flux · Going back / uninstall · Glossary.


Under the hood & edge cases

What the agent runs during setup (adopt --dry-run & pattern-web)

The agent starts the local hub if none is running (auto-start in other folders stays off unless you opt in: details). It previews with cub repo adopt --dry-run before writing anything:

Nothing was changed. Without --dry-run, ConfigHub would keep app's settings, from common.tfvars, with staging.tfvars for staging and prod.tfvars for production:
  It would keep three copies of them: app-base, the shared settings that staging and production start from; app-staging; and app-live, for production.
  First it would make a starter pattern, pattern-web: default settings for a small web service, and rules that each change must pass (replicas-limit, not-public, log-level, no-secret-values).
  Your settings that differ from the defaults in pattern-web/web-service: cpu=512, log_retention_days=14, memory_mb=2048. A new version of those defaults will not overwrite them.
  Staging would have the shared settings at once, with its own settings from staging.tfvars: desired_count=1, env=staging.
  Production would have its own settings from prod.tfvars at once: desired_count=3, env=prod. It would take the shared settings only after you approve them.

It then runs cub repo adopt and cub agent require-approval APP --variant live --agent APP-agent. pattern-web provides baseline rules (like blocking secret-shaped values) without overwriting any value you already set; it is separate from optional starters.

What adopt refuses in a Kustomize repository

Supported vs. refused Kustomize overlay fields

Each hub copy holds base/ resources with overlay value overrides. Overlays that alter resource structure rather than values are refused cleanly before anything is written:

  • Carried: namespace, labels, annotations, images, replicas, scalar/element value patches, namePrefix/nameSuffix (including references), fractional values (cpu: 0.5), and type changes.
  • Refused (with exact file and field named): Adding or omitting resources (resources, components, configMapGenerator), deleting fields, changing list lengths, adding empty maps, helmCharts, generators, transformers, validators, and remote URL bases.

adopt renders each overlay with kustomize and verifies byte-level parity with the hub copy, rolling back cleanly if anything differs.

Helm values

Managing third-party or custom Helm charts

cub repo adopt does not import Helm values.yaml directly. Use cub-helm (cub helm install NAME CHART --version V --values my-values.yaml) in your terminal to preserve custom values and reasons across upstream chart upgrades (your own Helm chart · Story 7 walkthrough).

If something goes wrong

Troubleshooting common messages
  • reads no settings adopt can find: Your env file uses a custom name (like api.env). Either rename it to .env or run cub repo upload FOLDER --variant live --target none.
  • A secret-looking value was skipped: Keep secrets out of .env and set them with cub secret set in your own terminal.
  • Values in the hub don't match files: Re-run cub repo adopt APP-FOLDER --dry-run or export hub copies with cub repo copies APP --to DIR.
  • Agent asks for production write access or your login: Say no—that would bypass the approval gate. Paste the CLAUDE.md / AGENTS.md instructions printed by cub agent require-approval so the agent proposes via change orders instead.
  • Undo everything: Your original files were never modified. Run confighub mini undo to revert only config edits, or follow going back to export plain files and delete .confighub-app.

Deploy to any service next

Ready to deliver approved settings 1:1 to your live host (or move between services keeping your config)? Pick your platform: Vercel · Fly.io · Heroku · Unikraft · Daytona sandbox · Argo CD / Flux · Starters.