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
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.