Prerequisites
Prerequisites
- A Fjall application created with
fjall create app(orfjall apps create), so aninfrastructure.tsfile exists. - At least one declared resource to remove. Run
fjall list -a <app>to see what the application currently declares. - Node 22 or later.
Remove a resource from infrastructure.ts
fjall remove deletes a resource declaration from an application’s infrastructure.ts using the codemod engine. Pass the resource <type> as a positional argument and the resource name with -n.
<type> values: database, storage, compute, messaging, cdn, network, pattern, vpc-peer, vpc-peer-accepter, cross-plan-connection.
Resource names are PascalCase, matching the name used when the resource was added.
Examples
What Happens
Runningfjall remove interactively shows a dry-run preview first, then asks for confirmation before writing:
- Locate the resource declaration in
infrastructure.tsby type and name. - Reference check scans the source for other declarations that reference the resource. If references remain, the removal stops unless you pass
--force. - Dry-run preview shows the lines that will change before any write.
- Backup writes a
.baksidecar and a timestamped snapshot under the application’s.fjall/historydirectory. - Write removes the declaration from
infrastructure.ts.
fjall undo (restores the most recent .bak) or fjall history --restore <timestamp>.
Force removal
--force removes the resource even when other declarations still reference it. The resulting infrastructure.ts can fail type-checking until you fix the dangling references. Run fjall validate -a <app> --deep afterwards to surface any type errors.
Agent mode
Pass--agent to emit structured output for AI agent tooling. In agent mode, add --yes to skip the dry-run and execute the removal in one step. Agent flags --budget, --fields, and --full tune the structured response.
Options
| Option | Description | Default |
|---|---|---|
<type> | Resource type to remove (positional, required) | None |
-a, --app <name> | Application to remove the resource from | None |
-n, --name <name> | Resource name (PascalCase) | None |
-f, --force | Remove even if references to the resource remain in the source | false |
-v, --verbose | Enable verbose logging | false |
--non-interactive | Force plain CLI output (no interactive UI) | false |
--yes | Skip the dry-run and execute the full operation (agent mode) | false |
--agent | Emit structured output for AI agent tooling | false |
--budget <level> | Detail budget for agent output | None |
--fields <fields> | Restrict agent output to specific fields | None |
--full | Emit the full agent output payload | false |
Next Steps
fjall add
Add a resource to infrastructure.ts with the codemod engine.
fjall list
Inspect the resources an application declares.
fjall deploy
Apply infrastructure.ts changes to AWS.
Add resources
Learn the resource-editing workflow end to end.