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

# Construct

> The basic building block of tfts applications.

`Construct` is the base class for all elements in the tfts construct tree.

## Constructor

```typescript theme={null}
new Construct(scope: Construct, id: string)
```

## Properties

### node

`readonly node: Node`
The tree node for this construct.

## Node Class Methods

The `node` property provides access to the following methods:

### setContext()

```typescript theme={null}
setContext(key: string, value: any): void
```

Sets a context value for this node and its children.

### getContext()

```typescript theme={null}
getContext(key: string): any
```

Gets a context value from this node or its parents.

### tryGetContext()

```typescript theme={null}
tryGetContext(key: string): any
```

Tries to get a context value, returning `undefined` if not found.

### findAll()

```typescript theme={null}
findAll(): IConstruct[]
```

Returns all children of this node.

### findChild()

```typescript theme={null}
findChild(id: string): IConstruct
```

Finds a child by its ID. Throws if not found.

### tryFindChild()

```typescript theme={null}
tryFindChild(id: string): IConstruct | undefined
```

Tries to find a child by its ID.

### addMetadata()

```typescript theme={null}
addMetadata(type: string, data: any): void
```

Adds metadata to the construct.

### addValidation()

```typescript theme={null}
addValidation(validation: IValidation): void
```

Adds a validation to the construct.

### validate()

```typescript theme={null}
validate(): string[]
```

Runs all validations on the construct and returns a list of errors.
