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

# Template Ready Checks

> Utilities for checking template readiness before use in the HopX JavaScript/TypeScript SDK. Verify templates are available and ready before creating sandboxes, check template status, and handle template availability errors. Essential for robust sandbox creation workflows. Includes TypeScript examples and error handling.

**Version:** 0.1.22\
**Last Verified:** 2025-01-27\
**Package:** `@hopx-ai/sdk` on [npm](https://www.npmjs.com/package/@hopx-ai/sdk)

## Overview

Ready checks are utilities used in template building to verify that a template is ready before it's considered complete.

## Import

```typescript theme={null}
import {
    waitForPort,
    waitForUrl,
    waitForFile,
    waitForProcess,
    waitForCommand
} from '@hopx-ai/sdk';
```

## Available Ready Checks

### `waitForPort`

Wait for a port to be listening.

```typescript theme={null}
waitForPort(port: number, timeout?: number): ReadyCheck
```

***

### `waitForUrl`

Wait for a URL to be accessible.

```typescript theme={null}
waitForUrl(url: string, timeout?: number): ReadyCheck
```

***

### `waitForFile`

Wait for a file to exist.

```typescript theme={null}
waitForFile(path: string, timeout?: number): ReadyCheck
```

***

### `waitForProcess`

Wait for a process to be running.

```typescript theme={null}
waitForProcess(processName: string, timeout?: number): ReadyCheck
```

***

### `waitForCommand`

Wait for a command to succeed.

```typescript theme={null}
waitForCommand(command: string, timeout?: number): ReadyCheck
```

***

## Example

```typescript theme={null}
import { Template, waitForPort } from '@hopx-ai/sdk';

const template = new Template()
    .fromNodeImage('20')
    .run('npm install express')
    .expose(3000)
    .startCmd('node server.js')
    .readyCheck(waitForPort(3000, 120000));

const result = await template.build();
console.log(`Template ready: ${result.templateId}`);
```

***

## Related Classes

* **[Template Builder](/sdk/javascript/template-builder)** - Use ready checks in templates
* **[Sandbox](/sdk/javascript/sandbox)** - Create sandboxes from templates

## See Also

* [Template Builder](/sdk/javascript/template-builder) - Learn about building templates
* [Core Concepts: Templates](/core-concepts/templates) - Learn about templates

## Next Steps

Now that you understand ready checks, explore:

* [Template Builder](/sdk/javascript/template-builder) - Use ready checks in template building
* [Building Templates](/core-concepts/templates/building) - Learn template building concepts
* [Template Configuration](/core-concepts/templates/configuration) - Configure templates
* **[CLI Reference](/cli/introduction)** - Use HopX from the command line
* [Custom Templates](/cookbooks/advanced/custom-templates) - Build custom templates
