foundry init
Initialize or refresh a Foundry platform in the current directory.
Usage
foundry init [OPTIONS]Options
| Flag | Description |
|---|---|
--name, -n | Platform name (kebab-case). Defaults to the current directory name. |
--template, -t | Template to scaffold from. ue5-game turns the Unreal C++ project in the current folder into a Foundry game project (below). Any other value falls back to the default platform scaffold. |
--dry-run | Show what would be created without writing any files. |
--force, -f | Force regeneration of .foundry/workspace.yml even if it already exists. |
--publisher | (ue5-game) Your publisher handle, written to .foundry/config.yml. |
--game | (ue5-game) Game slug. Default: derived from the project name (GooCrew → goo-crew). |
--ue-root | (ue5-game) Path to your UE 5.7 source build. Default: resolved from the .uproject's EngineAssociation (Windows registry). |
--plugin-version | (ue5-game) FoundryFSDK release to install. Default: latest. |
--no-plugin | (ue5-game) Skip the plugin download (offline). FOUNDRY_FSDK_ZIP=<path> installs from a local zip instead. |
The ue5-game template
Run it once from the folder that holds your .uproject, right after the editor's New Project wizard (Games → Blank → C++, on an engine built from source — a dedicated-server target needs one):
foundry init --template ue5-game --publisher my-handleIt performs the install steps of the FoundryFSDK README:
- Downloads the latest FoundryFSDK release into
Plugins/FoundryFSDK/. - Adds the plugin entry to the
.uproject. - Writes
Source/<Game>Server.Target.cs(the dedicated-server target). - Adds
"FoundryFSDK"to the game module'sPrivateDependencyModuleNames. - Pins the network protocol version in the primary game module (
FNetworkVersion::GetLocalNetworkVersionOverride) — without it, clients and servers from different releases refuse each other. - Writes
.foundry/config.yml(kind: game-publisher, with thebuildandserverblocksfoundry packagereads) and a self-containedDocker/Dockerfile.
Every step is idempotent and nothing you already have is overwritten. The edits to wizard-generated files are anchored on the exact lines the UE 5.7 Blank template writes; a customized Build.cs or module .cpp is left alone and the step is printed under By hand. After it runs: regenerate project files, build<Game>Editor, foundry login, and register the game with foundry games create --name "…".
Behavior
foundry init detects the project state and acts accordingly:
Fresh directory (no foundry.json)
Runs the interactive wizard: scans the filesystem for components, lists what it found (with detected runtime), and offers to add them to the manifest. Discovered services are written with a stack block, an inferred scope, and a deploy.strategy (service for backends, static for frontends; packages get no deploy block). It then prompts for the cloud provider and IaC tool and writes foundry.json (schemaVersion 0.5.0), .foundry/, and updates .gitignore.
Existing manifest, no .foundry/ (upgrade)
Creates the .foundry/ directory, generates workspace.yml, and updates the .gitignore — bringing a manifest-only project up to date.
Already initialized
Prints a project summary (name, schema version, services) and regenerates .foundry/workspace.yml. If it already exists, use --force (or run foundry sync) to rewrite it. Drift between the manifest and the filesystem is reported.
What it writes
foundry.json # the manifest (schemaVersion 0.5.0)
.foundry/
workspace.yml # committed — service path map + drift
config.yml # gitignored — personal config (only when created)
.gitignore # managed — ignores config.yml
.gitignore # legacy blanket .foundry/ ignore is removedPrefix derivation
The platform prefix is derived from the first letter of each word in the name:
"My Platform" → prefix "mp"
"My Cool Service" → prefix "mcs"Override it with a top-level prefix (minimum 2 characters).
Structure
A monorepo service lives at apps/{type}/{name} (or packages/{name}). The top-level structure block can rename the top directories (appsDir, ciDir, packagesDir). Services in other repos use repository / path instead.