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

# Quickstart

> Compile and deploy your first XCL stack in five minutes.

## Prerequisites

* `ubx` installed (run `ubx version` to verify)
* AWS credentials in your environment (for the example below)
* Python 3.9+ and `pip` on your `PATH` (for `ubx ship`)

## 1. Create a stack directory

```sh theme={"theme":"css-variables"}
mkdir networking
cd networking
```

## 2. Declare your inputs

Create `input.xcl`:

```xcl theme={"theme":"css-variables"}
input "networking" {
    vpc_cidr: string       = "10.0.0.0/16"
    azs:      list(string)
    deploy_nat: bool       = false
}
```

Fields without a default are required at deploy time via `pulumi config set`.

## 3. Declare your resources

Create `stack.xcl`:

```xcl theme={"theme":"css-variables"}
stack "networking" {
    vpc = aws.ec2.Vpc {
        cidr_block = input.vpc_cidr
    }

    subnets = aws.ec2.Subnet * 3 {
        for idx in input.azs

        vpc_id     = vpc.id
        cidr_block = "10.0.0.0/16"
    }

    nat = aws.ec2.NatGateway when input.deploy_nat {
        subnet_id = subnets.id
    }
}
```

## 4. Declare your outputs

Create `output.xcl`:

```xcl theme={"theme":"css-variables"}
output "networking" {
    vpc_id     = vpc.id
    subnet_ids = subnets.id
}
```

## 5. Compile

```sh theme={"theme":"css-variables"}
ubx compile .
```

Expected output:

```
● Compile    . → .ubx/__main__.py
● Typecheck  3 file(s)
● IR         building…
● Output     .ubx/__main__.py

✓  compiled 3 file(s) → .ubx/__main__.py
```

The generated program is at `.ubx/__main__.py`. Inspect it before deploying.

## 6. Deploy

```sh theme={"theme":"css-variables"}
ubx ship .
```

`ubx ship` re-runs the full compile pipeline, then calls `pulumi up` via the Pulumi Automation API. State is stored in `.ubx/state/`.

## 7. Tear down

```sh theme={"theme":"css-variables"}
ubx terminate .
```

You will be prompted to confirm. Pass `--force` to skip the prompt.

## What was created

```
networking/
  input.xcl
  stack.xcl
  output.xcl
  .ubx/
    __main__.py       ← generated Pulumi Python program
    requirements.txt  ← pulumi + provider packages
    Pulumi.yaml       ← project metadata (stack name = directory name)
    state/            ← local Pulumi state (created by ubx ship)
```

## Next steps

* [Stack block](/v1/xcl/language/stack) — resource syntax, for/when/count
* [Types](/v1/xcl/language/types) — all supported type expressions
* [Multi-stack workspaces](/v1/xcl/guides/multi-stack-workspaces) — compile multiple stacks in dependency order
