Documentation Index
Fetch the complete documentation index at: https://docs.insforge.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
insforge.toml is a declarative, version-controlled snapshot of a subset of your project’s config: auth policy, allowed redirect URLs, password rules, SMTP, and the deployment subdomain. The CLI provides three commands that work against this file:
config plan: diffinsforge.tomlagainst the linked project. Shows what would change.config apply: push the diff to the live project. Per-change capability gating, env-resolved secrets, dry-run mode.config export: pull current project state and write a freshinsforge.toml. Useful for bootstrapping from an existing project.
insforge.toml in your repo. To apply it to a different environment (staging, prod, a teammate’s local backend, or a self-hosted instance), point the CLI at a different project (re-link or use --project-id). Secrets are read from environment variables via env(...) references, so the file itself stays free of credentials and can be committed safely.
This works the same way on InsForge Cloud projects and on self-hosted OSS deployments.
All examples use
npx @insforge/cli. Do not install the CLI globally.Command summary
| Command | Purpose |
|---|---|
config plan | Show diff between insforge.toml and live project state |
config apply | Apply insforge.toml to the live project |
config apply --dry-run | Print the plan without applying |
config apply --auto-approve | Skip the interactive confirmation prompt (required in --json mode) |
config export | Pull live config and write insforge.toml |
config export --force | Overwrite an existing insforge.toml without confirmation |
config plan and config apply read insforge.toml; pass --file <path> if it lives somewhere other than ./insforge.toml. config export writes the file; pass --out <path> to write it to a custom location.
Recommended workflow
Bootstrap from an existing project
If you already configured the project through the dashboard, export it once to get a working file:This writes
insforge.toml reflecting the current backend state.Commit it
Check
insforge.toml into version control. Secrets are referenced via env(...), so the file is safe to commit.What insforge.toml covers
The file mirrors a curated subset of project config, the parts that are useful to manage declaratively. Anything not in this list still lives on the dashboard and the API.
| Section | Keys |
|---|---|
[auth] | allowed_redirect_urls, require_email_verification, verify_email_method, reset_password_method |
[auth.password] | min_length, max_length, require_uppercase, require_lowercase, require_number, require_special |
[auth.smtp] | enabled, host, port, username, password, sender_email, sender_name, min_interval_seconds |
[deployments] | subdomain |
config plan
plan reads insforge.toml, fetches live state via /api/metadata, and prints a rendered diff. It also tags any section the live backend doesn’t expose yet (older self-hosted versions, etc.). Apply will skip those instead of failing the whole run.
Use plan before every apply in interactive sessions, and as a CI gate to catch unintended drift.
config apply
apply runs the same diff as plan, then walks the change set:
- Per-change capability gate. Each change is checked against the backend’s metadata. If the backend doesn’t support a section (e.g. an older self-hosted instance without SMTP exposed), that section is skipped with a named warning, and the rest of the changes still apply.
- Secret resolution.
env(...)references in the TOML are resolved at apply time from the local environment. If a referenced variable is missing, the command aborts before sending any update, so the backend isn’t left half-configured. - Per-section dispatch. Each change is sent to the appropriate backend endpoint (
/api/auth/config,/api/auth/smtp-config,/api/deployments/slug, etc.). Changes are independent, so a failure on one section won’t roll back earlier successful sections.
--dry-runprints the plan and exits without applying.--auto-approveskips the interactive confirmation. Required when--jsonis set, since there’s no TTY for the prompt.--file <path>overrides the default./insforge.tomllocation.
config export
export pulls the live project’s configurable surface and writes it to a TOML file. Use it to:
- Bootstrap an
insforge.tomlfrom a project you’ve been configuring through the dashboard. - Diff hand-edits against current backend state by exporting to a temporary file and comparing.
- Snapshot config before a risky change so you can re-apply the snapshot if you need to roll back.
export is the same shape the CLI expects from apply, so round-tripping is supported.
Without --force, export refuses to overwrite an existing file in interactive mode and surfaces an OUTPUT_EXISTS error in --json mode.
Secret references
auth.smtp.password and any other sensitive field can be expressed as env(VAR_NAME) instead of a literal value:
SENDGRID_API_KEY from the local environment, validates it’s present, and sends the resolved value to the backend. The TOML itself never contains the secret, so it can be committed.
This is what lets one insforge.toml apply cleanly to multiple environments: the dev and prod backends differ only in which SENDGRID_API_KEY is in scope when you run apply.
env(...) refs in a TOML that’s the target of apply re-send the resolved password on every run. That is the only way the CLI can tell the backend “the secret may have rotated, please update.” Fields without an env(...) ref are treated as preserve-existing.
When to use this
- Version control for auth. Redirect URLs, password policy, and email verification mode (all the things you’d otherwise change through the dashboard or curl) live in a file your team reviews via PR.
- Multi-environment parity. One TOML, applied to dev, staging, and prod, guarantees the same auth shape everywhere. Environment-specific values (subdomain, SMTP credentials) flow through
--project-idoverrides andenv(...)refs. - CI-driven config changes. Run
config apply --auto-approve --jsonfrom your deploy pipeline. Combine withconfig planas a PR check so reviewers see what the merge will change in prod. - Disaster recovery. A committed
insforge.tomlis a known-good config snapshot. Re-apply it after restoring a project to bring auth/SMTP back to the expected shape in seconds. - Self-hosted and local OSS development. Run
npx @insforge/cli link --api-base-url http://localhost:7130 --api-key <local-key>against a docker-compose stack, then point the CLI’s config commands at your local OSS instance the same way you’d point at cloud.
Troubleshooting
Refusing to apply in --json mode without --auto-approve or --yes. The CLI never silently applies changes in non-interactive runs. Pass --auto-approve (or -y) explicitly.
your backend doesn't expose <section>. The linked backend is on a version that doesn’t have the relevant API yet. The rest of your changes still applied. Upgrade the backend (or wait for the next release) to apply that section.
env(...) reference resolves to nothing. The CLI aborts before any API call when a referenced env var is missing. Set the variable in your shell or your CI’s secret store and re-run.
Slug is already taken. deployments.subdomain conflicts with another project’s subdomain on the same backend. Pick a different value.
Related
- CLI harness: the full command surface an agent drives
- Deployment security guide: hardening a self-hosted backend after deploy