Skip to main content
Build custom templates with pre-configured environments, dependencies, and settings. Templates allow you to create reusable sandbox configurations.

Prerequisites

Before you begin, make sure you have:
  • HopX API key - Get one from console.hopx.dev or see [API key Management](/API key)
  • Understanding of templates - Familiarity with Listing Templates is helpful
  • Base image or template - Decide on a base image (Python, Node.js, Ubuntu, etc.)
  • Dependencies list - Know what packages or tools you want pre-installed

Overview

Building templates enables you to:
  • Pre-install packages and dependencies
  • Configure environment variables
  • Set up working directories and users
  • Create reusable sandbox configurations
  • Optimize sandbox creation time
Template building is an async operation that can take several minutes. The build process includes uploading files, executing build steps, and waiting for template activation.

Basic Template Building

Create a simple template from a base image:

Using Base Image Helpers

Use convenient base image helpers:

Complete Template Example

Build a complete template with multiple steps:

Build Options

Configure build options:

Build Result and Logs

Access build results and logs:

Best Practices

1

1. Start with Base Images

Use base image helpers (from_python_image, from_node_image) for common environments.
2

2. Chain Operations

Use fluent API to chain operations for readable template definitions.
3

3. Set Resources Appropriately

Configure CPU, memory, and disk based on your application needs.
4

4. Use Ready Checks

Set ready checks for services that need to be ready before sandbox is usable.
5

5. Monitor Build Progress

Use progress and log callbacks to monitor long-running builds.

Next Steps