> ## Documentation Index
> Fetch the complete documentation index at: https://tfts.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# tfts synth

> Synthesize Terraform JSON configuration

Synthesize your TypeScript infrastructure code into Terraform JSON configuration.

## Usage

```bash theme={null}
npx tfts synth [options]
```

## Aliases

* `synthesize`

## Description

The `synth` command executes your tfts application and generates Terraform JSON configuration files. The output is written to the specified output directory (default: `cdktf.out`).

## Options

| Option     | Type   | Description                            | Default         |
| ---------- | ------ | -------------------------------------- | --------------- |
| `--app`    | string | Command to run the tfts app            | From cdktf.json |
| `--output` | string | Output directory for synthesized files | `cdktf.out`     |

## Examples

### Basic Usage

```bash theme={null}
npx tfts synth
```

Runs the app command from `cdktf.json` and outputs to `cdktf.out/`.

### Custom App Command

```bash theme={null}
npx tfts synth --app "npx ts-node main.ts"
```

### Custom Output Directory

```bash theme={null}
npx tfts synth --output terraform-out
```

## Output Structure

After synthesis, the output directory contains:

```
cdktf.out/
├── manifest.json           # Stack metadata
└── stacks/
    └── my-stack/
        └── cdk.tf.json     # Terraform configuration
```

## Using with Terraform

After synthesis, navigate to the stack directory and run Terraform:

```bash theme={null}
cd cdktf.out/stacks/my-stack
terraform init
terraform plan
terraform apply
```

## Environment Variables

| Variable                | Description                      |
| ----------------------- | -------------------------------- |
| `CDKTF_OUTDIR`          | Override output directory        |
| `CDKTF_TARGET_STACK_ID` | Synthesize only a specific stack |
