CLI
Validate, print, and watch configuration in dev and CI.
The confkit
CLI validates, prints, watches, scaffolds, and explains your configuration.
Quick Reference
npx confkit help
npx confkit check --file conf/config.ts --env production
npx confkit print --file conf/config.ts --json
npx confkit diff --from-env development --to-env production
npx confkit diff --from-source env --to-source file:config.yaml --matrix
npx confkit dev --file conf/config.ts
npx confkit init
npx confkit explain --key DATABASE_URL
npx confkit types --out confkit-env.d.ts
npx confkit types --server --out confkit-env-server.d.ts
npx confkit types --watch
npx confkit scan --dir src --allow NODE_ENV,VERCEL_ENV
Commands
check
— Validate and print a summary table; exits non‑zero on failure--strict
— also fail if unknown keys (not in the schema) are present
print
— Print values (redacted by default)--json
— print raw JSON--no-redact
— disable redaction (dangerous; avoid committing)
diff
— Compare two environments or two sources- Environments:
--from-env <a> --to-env <b>
(respects.env*
resolution perNODE_ENV
) - Sources:
--from-source <name> --to-source <name>
(matches by substring of source name; e.g.env
,file:config.yaml
) --matrix
— print a matrixKey | A | B | Status
--json
— output structured diff{ added, removed, changed }
--no-redact
— disable redaction (env‑diff only; source‑diff shows raw source values)
- Environments:
dev
— Watch sources and diff on change- Controls:
r
reload,s
toggle redaction,c
copy invalid paths to clipboard --watch a,b,c
— add additional globs/paths to watch
- Controls:
init
— Scaffoldconf/config.ts
, generate.env.example
from your schema, and add a GitHub Action workflow (includesconfkit check
andconfkit scan
)explain
— Show where values come from; use--key <name>
to filterdoctor
— Basic environment checks and production warningstypes
— Generate aconfkit-env.d.ts
declaring client modules with concrete keys as strings (@confkit/next/client
andconfkit:client
)--server
— generate a server-sideConfkitEnv
interface inferred from your schema--watch
— regenerate on changes to config/env files
scan
— Scan your code forprocess.env.*
/import.meta.env.*
usages and compare to the schema- prints unknown keys used in code (not declared) and schema keys unused in code
--dir <path>
— root directory to scan (default CWD)--allow <keys>
— comma-separated keys to ignore (e.g.NODE_ENV
)
Common Flags
--file <path>
— config file (defaultconf/config.ts
)--env <name>
— setNODE_ENV
before loading
+---------------------------+---------------------------+
| Key | Value |
+---------------------------+---------------------------+
| DATABASE_URL | ••• |
| FEATURES.abTestVariant | "A" |
| NODE_ENV | "development" |
| PORT | 3000 |
+---------------------------+---------------------------+