foundry init

Initialize or refresh a Foundry platform project.

Usage

foundry init [OPTIONS]

Options

FlagDescription
--regenerate-runtimeForce-regenerate .foundry/runtime.yml from the manifest
--helpShow help message

Behaviour

foundry init detects the current project state and takes the appropriate action:

Fresh Directory (no foundry.json)

Launches the interactive init wizard — name your platform, choose a template, define services. Generates foundry.json and .foundry/.

Existing Manifest (foundry.json exists)

If .foundry/ already exists, reports the current state. Use --regenerate-runtime to rebuild runtime.yml from the manifest.

If .foundry/ is missing (legacy project), creates it and generates the runtime and state files.

Structure Enforcement

Init validates the directory layout matches the structure block in the manifest:

"structure": {
  "appsDir": "apps",
  "ciDir": "ci",
  "packagesDir": "packages"
}

Services must live under apps/backend/ or apps/frontend/as declared by their kind.

Prefix Derivation

The platform prefix is derived from the first letter of each word in the name:

"An Average Platform" → prefix "aap"
"My Cool Service"     → prefix "mcs"

Users can override this in ecosystem.prefix, but it must be at least 2 characters.