Skip to main content
  • A Fjall application created with fjall create app (or fjall apps create), so an infrastructure.ts file exists.
  • At least one declared resource to remove. Run fjall list -a <app> to see what the application currently declares.
  • Node 22 or later.
fjall remove edits source code. It does not delete deployed AWS resources. To tear down deployed infrastructure, use fjall destroy. To apply a removal to the cloud, run fjall deploy after editing.

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.
fjall remove <type> -a <app> -n <ResourceName>
Valid <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

# Remove a database named ApiDb from the api application
fjall remove database -a api -n ApiDb

# Remove a storage bucket from the web application
fjall remove storage -a web -n WebAssets

# Remove a compute service, forcing through remaining references
fjall remove compute -a api -n WorkerService --force

# Remove with detailed logging
fjall remove messaging -a api -n EventsQueue --verbose

What Happens

Running fjall remove interactively shows a dry-run preview first, then asks for confirmation before writing:
  1. Locate the resource declaration in infrastructure.ts by type and name.
  2. Reference check scans the source for other declarations that reference the resource. If references remain, the removal stops unless you pass --force.
  3. Dry-run preview shows the lines that will change before any write.
  4. Backup writes a .bak sidecar and a timestamped snapshot under the application’s .fjall/history directory.
  5. Write removes the declaration from infrastructure.ts.
Recover a previous state with 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.
fjall remove database -a api -n ApiDb --agent --yes

Options

OptionDescriptionDefault
<type>Resource type to remove (positional, required)None
-a, --app <name>Application to remove the resource fromNone
-n, --name <name>Resource name (PascalCase)None
-f, --forceRemove even if references to the resource remain in the sourcefalse
-v, --verboseEnable verbose loggingfalse
--non-interactiveForce plain CLI output (no interactive UI)false
--yesSkip the dry-run and execute the full operation (agent mode)false
--agentEmit structured output for AI agent toolingfalse
--budget <level>Detail budget for agent outputNone
--fields <fields>Restrict agent output to specific fieldsNone
--fullEmit the full agent output payloadfalse

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.