Monorepo
Zero-config workspace discovery and per-workspace CLI.
Confkit includes lightweight, zero‑config monorepo support focused on developer experience and CI.
What you get:
- Automatic workspace discovery using
package.json#workspaces(with a fallback topackages/*andapps/*). - Per‑workspace execution with proper
cwd, so.env*and relative files resolve inside each package. - One command to validate all packages or generate types across the repo.
Quick Start
# Validate all workspaces (uses NODE_ENV if provided)
npx confkit ws check --env production --strict
# Generate client types per workspace
npx confkit ws types
# Generate server-side types per workspace
npx confkit ws types --serverConfkit will include only workspaces that contain conf/config.(ts|tsx|mjs|js).
Commands
ws check— Validate every matching workspace and print a table. Respects per‑workspace.env*files and your schema/policy.ws types— Generate env typing files per workspace.- Client modules:
confkit-env.d.tswith concrete keys forconfkit:clientand@confkit/next/client. - Server interface:
confkit-env-server.d.tswith aConfkitEnvinterface inferred from the schema.
- Client modules:
Flags
--root <path>— Override monorepo root (auto‑detected by walking up to the nearestpackage.json).--only <substring>— Filter workspaces by name.--fail-fast— Stopws checkon the first failure.--server— Forws types, generate server‑side interface instead of client modules.--out <file>— Custom output filename for types (written in each workspace).
Matching and CWD rules
- Workspaces are discovered from
package.json#workspaces(array orworkspaces.packages). If not present, Confkit triespackages/*andapps/*. - Only workspaces containing
conf/config.(ts|tsx|mjs|js)are included. - Each workspace runs with
process.cwd()set to that package directory, so:source().env()resolves.env,.env.local, and.env.${NODE_ENV}from that package.source().file('config.json')resolves relative to that package.
CI Example
jobs:
confkit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: npm ci
- run: npx confkit ws check --env production --strictSingle‑repo convenience
When you run npx confkit without --file, Confkit searches upward for the nearest conf/config.(ts|tsx|mjs|js). This lets you run commands inside subfolders without typing --file.