# Built-in templates

A template starts a sandbox that is ready to work in: a project already running behind a preview
URL, a code interpreter, a browser or a desktop. Hermitbox ships three kinds of built-in templates:

- **Runtime and tool plans** (`hermitbox template create <name>`): released container images for
  code interpreters, headless browsers, X11 desktops, SSH and bucket mounts, and Rivet's
  `sandbox-agent`.
- **Starter projects** (`hb.sandbox({ template: '<name>' })`): 54 pinned, tested container
  starters prepared on first use and forked per sandbox with a ready preview URL.
- **Git repositories** (`hermitbox template from <repo>`): inspects an HTTPS repository or local
  checkout, infers its runtime and start command, and prepares a template from it.

All built-in templates run on the `container` tier. The node's image policy must admit the
template's image, and built-in plans never weaken host policy.

## Runtime and tool plans

These give a sandbox a tool to drive: a kernel, a browser, a desktop, SSH or a bucket mount.
Create one with `hermitbox template create <name>`. Each uses Hermitbox's released image for its
version by default; `--image <image>` selects an operator-built one.

| Template | What it includes | How you use it | Guide |
| --- | --- | --- | --- |
| [`python-interpreter`](#python-interpreter) | CPython 3.12, prestarted IPython kernel, NumPy, pandas, Matplotlib, SciPy, scikit-learn, Requests, Pillow | `box.python()`, `hermitbox sandbox python` | [Code interpreters](https://docs.hermitbox.dev/v0.3.2/guides/code-interpreter.md) |
| [`node-interpreter`](#node-interpreter) | Node.js 24, prestarted IJavascript kernel, Chart.js | `box.javascript()` | [Code interpreters](https://docs.hermitbox.dev/v0.3.2/guides/code-interpreter.md) |
| [`browser`](#browser) | Headless Chromium shell, `playwright-core`, loopback CDP proxy | `box.browser()`, `box.browser.screenshot()` | [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) |
| [`desktop`](#desktop) | Xvfb, JWM, x11vnc, noVNC, `xdotool`, `scrot`, editable note preview | `box.desktop()`, `box.previewUrl` | [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) |
| [`tools`](#tools) | OpenSSH (`sshd`), `rclone`, FUSE mount support | `box.ssh()`, `mounts` at creation, `box.mounts()` | [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) |
| [`sandbox-agent`](#sandbox-agent) | Rivet's `sandbox-agent` server on private port 3000 | Rivet runner / private port `agent` | [Rivet agent harness](https://docs.hermitbox.dev/v0.3.2/integrations/rivet-harness.md) |

### `python-interpreter`

Prepares a container template from `ghcr.io/hermitbox/hermitbox-python-interpreter:<version>` with
a prestarted Python kernel (`ipykernel`) and scientific libraries (`numpy`, `pandas`, `matplotlib`,
`scipy`, `scikit-learn`, `requests` and `PIL`). Running `hermitbox sandbox python` without a
sandbox ID creates a container sandbox from this template.

```sh
hermitbox template create python-interpreter
```

See [Code interpreters](https://docs.hermitbox.dev/v0.3.2/guides/code-interpreter.md) for stateful execution, chart output,
process-tier kernels and package inventories.

### `node-interpreter`

Prepares a container template from `ghcr.io/hermitbox/hermitbox-node-interpreter:<version>` with
Node.js 24, a prestarted IJavascript kernel and Chart.js support. Use `box.javascript()` on a
sandbox created from it to evaluate persistent JavaScript contexts and capture charts.

```sh
hermitbox template create node-interpreter
```

See [Code interpreters](https://docs.hermitbox.dev/v0.3.2/guides/code-interpreter.md) for SDK examples and package notices.

### `browser`

Prepares a container template from `ghcr.io/hermitbox/hermitbox-browser:<version>` with three spare
ports and Chromium's headless shell (`playwright-core`) running with Chromium's sandbox enabled.
Sandboxes expose `box.browser.screenshot()` and expiring Chrome DevTools Protocol (CDP) URLs
through `box.browser()`.

```sh
hermitbox template create browser
```

On the `process` tier, the verified process tool bundle provides `box.browser()` without creating a
container template. See [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) for host seccomp
and namespace prerequisites.

### `desktop`

Provides a full X11 desktop (Xvfb, JWM, x11vnc, noVNC, `xdotool` and `scrot`) with three spare
ports, reached through `box.desktop()` as an expiring noVNC URL and computer-use actions.

- Calling `hb.sandbox({ template: 'desktop' })` or `hermitbox template create desktop` uses the
  pinned Debian GUI starter project, which also serves an editable `notes.txt` preview on port
  8000 alongside the graphical desktop.
- Passing `--image <image>` to `hermitbox template create desktop --image <image>` uses the
  operator-built or released `hermitbox-desktop` image directly.

See [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) for mouse, keyboard, screenshot and
process-tier desktop details.

### `tools`

Prepares a container template from `ghcr.io/hermitbox/hermitbox-tools:<version>` with three spare
ports, OpenSSH (`sshd`) and `rclone`. Use it for interactive SSH access (`box.ssh()`) and S3 or R2
object-store bucket mounts (`mounts` at creation, listed by `box.mounts()`). Bucket mounts
require explicit host opt-in.

```sh
hermitbox template create tools
```

See [Browser and desktop](https://docs.hermitbox.dev/v0.3.2/guides/browser-and-desktop.md) for SSH authentication, edge wake and
mount policy.

### `sandbox-agent`

Registers a template spec via `POST /v1/templates` and warms every active container node with
`ghcr.io/hermitbox/hermitbox-sandbox-agent:<version>`. Each sandbox starts `sandbox-agent server`
on private TCP port 3000 (`agent`) with `HOME` and XDG directories under `/data`, and no provider
credentials inside the image.

```sh
hermitbox template create sandbox-agent
```

See [Rivet agent harness](https://docs.hermitbox.dev/v0.3.2/integrations/rivet-harness.md) for connecting a Rivet runner.

## Starter projects

Ask for any starter by name on a host that runs containers, and you get a working project with
its preview URL. The first request prepares a warm project snapshot on an eligible node: it
installs the locked dependencies and runs the build and smoke tests. Requests that arrive meanwhile
share that preparation, and the fleet warms copies on other eligible nodes.

```ts
const box = await hb.sandbox({ template: 'nextjs' })
console.log(box.previewUrl)
```

```python
box = hb.sandbox(template='nextjs')
print(box.preview_url)
```

```rust
use hermitbox::SandboxOptions;

let sandbox = hb.create_sandbox(SandboxOptions::new().template("nextjs")).await?;
println!("{:?}", sandbox.preview_url().await);
```

Each sandbox forks its own copy, starts its development server and waits until it is ready, then
returns `box.previewUrl` (`box.preview_url` in Python, `sandbox.preview_url()` in Rust). If it never
gets ready, the error names the sandbox so you can read its logs or delete it.

Every starter has an `AGENTS.md` in its working directory listing its run, test and build commands,
so a coding agent knows how to work on it. To build a starter ahead of time or select a different
digest-pinned image, run `hermitbox template create <name> [--image <image>]`.

### Frontend and full-stack web

All ten web starters run on Hermitbox's pinned Node image, verify locked dependencies and
production builds during warm preparation, and hot-reload edits in each fork.

| Template | Stack | Port | Edit to update |
| --- | --- | --- | --- |
| `nextjs` | Next.js (App Router) | 3000 | `app/page.jsx` |
| `vite-react` | React with Vite | 5173 | `src/App.jsx` |
| `vue` | Vue with Vite | 5173 | `src/App.vue` |
| `sveltekit` | SvelteKit (Node adapter) | 5173 | `src/routes/+page.svelte` |
| `astro` | Astro static site | 4321 | `src/pages/index.astro` |
| `nuxt` | Nuxt (Nitro Node server) | 3000 | `app/app.vue` |
| `react-router` | React Router in framework mode | 5173 | `app/routes/home.jsx`, `app/routes.ts` |
| `angular` | Angular standalone with Vite | 5173 | `src/app.html`, `src/app.ts` |
| `solidstart` | SolidStart (Nitro Node server) | 5173 | `src/app.jsx` |
| `expo-web` | Expo SDK for web (Metro) | 8081 | `App.jsx` |

- **`nextjs`**: forks start the Next.js development server with hot reload on `app/page.jsx`.
- **`vite-react` and `vue`**: test the production Vite build during warming and serve Vite dev
  previews on port 5173.
- **`sveltekit`**: the warm build serves the production Node adapter's output over HTTP to check
  the home page; forks run Vite dev on port 5173. Use `npm run build` and `npm start` for
  production.
- **`astro`**: tests the production home page during warming and serves Astro dev on port 4321.
  Run `npm run build` to write `dist/` and `npm run preview` to serve it.
- **`nuxt`**: forks serve Vue hot reload on port 3000. Run `npm test` to build and exercise the
  Nitro server, or `npm run build` followed by `npm start`.
- **`react-router`**: server-rendered React Router with Fast Refresh; the build tests the
  production route handler. Run `npm start` to serve production output.
- **`angular`**: Angular standalone component served with Vite. Run `npm test` to compile and
  check, `npm run build` to write `dist/` and `npm run preview` to serve it.
- **`solidstart`**: server-rendered Solid application. Run `npm test` to build and exercise the
  Nitro server, or `npm run build` and `npm start` for production.
- **`expo-web`**: React Native Web components via Expo. Run `npm test` to check the Metro
  production export and `npm run build` to write the static site to `dist/`.

### JavaScript and TypeScript backends

| Template | Stack | Port | Edit to update |
| --- | --- | --- | --- |
| `node` | Node built-in HTTP server, test runner and watcher | 3000 | `store.mjs` |
| `express` | Express HTTP API | 3000 | `app.mjs` |
| `hono` | Hono HTTP API | 3000 | `app.mjs` |
| `fastify` | Fastify HTTP API | 3000 | `app.mjs` |
| `nestjs` | NestJS TypeScript API | 3000 | `src/app.controller.ts` |
| `bun` | Bun TypeScript HTTP server | 3000 | `app.ts` |
| `deno` | Deno TypeScript HTTP server | 3000 | `app.ts` |

- **`node`**: zero-dependency Node server using `node --watch` and `node --test`.
- **`express`, `hono` and `fastify`**: share the pinned Node image, install locked dependencies and
  test the root JSON route over HTTP. Run `npm test` for routes and `npm run build` to check entry
  points.
- **`nestjs`**: runs Nest in watch mode. Run `npm test` to check the API and `npm run build` to
  compile it.
- **`bun` and `deno`**: run all application code on the selected pinned runtime with native tests
  and a watched preview on port 3000.

### Python web

All four Python starters serve port 8000, include a runnable `unittest` suite, and reload edits.
Framework starters ship a preinstalled, hash-locked `.venv` in the warm snapshot.

| Template | Stack | Port | Edit to update |
| --- | --- | --- | --- |
| `python` | Python standard-library HTTP server | 8000 | `public/index.html` |
| `flask` | Flask with reloader | 8000 | `app.py` |
| `fastapi` | FastAPI with Uvicorn reload | 8000 | `app.py` |
| `django` | Django watched by `watchfiles` | 8000 | `app.py` |

### Native and compiled backends

Each runs on a digest-pinned Alpine language image (Rails on Debian Bookworm), serves port 3000,
and includes source tests and an `AGENTS.md` with its run and build commands.

| Template | Stack | Port | Edit to update |
| --- | --- | --- | --- |
| `go` | Go HTTP server (auto-rebuild) | 3000 | `main.go` |
| `ruby` | Ruby HTTP server | 3000 | `message.rb` |
| `rails` | Ruby on Rails MVC API | 3000 | `app/controllers/greetings_controller.rb` |
| `php` | PHP built-in HTTP server | 3000 | `public/index.php` |
| `laravel` | Laravel PHP API | 3000 | `app/Http/Controllers/GreetingController.php` |
| `rust` | Rust HTTP service (locked Cargo) | 3000 | `src/main.rs` |
| `axum` | Axum Rust API (locked Cargo) | 3000 | `src/main.rs` |
| `java` | JDK 21 HTTP server (watched rebuild) | 3000 | `Main.java` |
| `spring-boot` | Spring Boot MVC API (warmed Maven wrapper) | 3000 | `src/main/java/example/GreetingController.java` |
| `dotnet` | .NET 10 socket server (watched rebuild) | 3000 | `Program.cs` |
| `aspnet` | ASP.NET Core API (watched rebuild) | 3000 | `Program.cs` |
| `phoenix` | Elixir Phoenix web API | 3000 | `lib/hermitbox_web/greeting_controller.ex` |

- **`go`, `rust`, `axum`, `java`, `spring-boot`, `dotnet` and `aspnet`**: rebuild automatically on
  source edits through their watched development scripts.
- **`rails`**: reloads the greeting controller on the next request; its checksummed bundle covers
  both Linux architectures.
- **`laravel`**: run `php .hermitbox/composer.phar --no-plugins test` for project tests and
  `php artisan optimize` to build the production configuration.
- **`phoenix`**: recompiles edited modules on the next request. Run `mix test` for tests or
  `MIX_ENV=prod mix release --overwrite` to build a standalone OTP release.

### Databases and caches

Each database starter gives every fork its own persistent database files under `/data` and a live
HTTP preview for inspecting queries or data.

| Template | Engine and transport | Port | Edit or update |
| --- | --- | --- | --- |
| `sqlite` | Embedded SQLite file (`project.sqlite`) | 8000 | `query.sql` |
| `duckdb` | Embedded DuckDB file (`project.duckdb`) | 8000 | `query.sql` |
| `postgres` | Fork-local PostgreSQL on loopback (`DATABASE_URL`) | 3000 | Row 1 of `messages` via `psql` |
| `redis` | Fork-local Redis on loopback (`REDIS_URL`) | 3000 | `message` key via `redis-cli` |
| `mysql` | Fork-local MySQL on private Unix socket | 8000 | `query.sql` |
| `mongodb` | Fork-local MongoDB Community on private Unix socket | 8000 | `query.json` |
| `pgvector` | Fork-local PostgreSQL with `pgvector` extension | 3000 | `query.sql` |

- **`sqlite` and `duckdb`**: seed a database and serve a read-only JSON preview of up to 100 rows
  from `query.sql`. Local project scripts can open the same file for writing.
- **`postgres` and `redis`**: start a fork-local service on loopback with a JSON preview and a
  bundled client (`psql` or `redis-cli` documented in `AGENTS.md`). To attach PostgreSQL or Redis
  to another starter project instead, see [Composable services](#composable-services).
- **`mysql`**: serves up to 100 SQL result rows from `query.sql`; connect with the MySQL client
  over the private Unix socket listed in `AGENTS.md`.
- **`mongodb`**: runs on a self-hosted node pulling the pinned upstream MongoDB Community image.
  Edit `query.json` to filter, project or sort the fork's inventory documents.
- **`pgvector`**: executes `query.sql` against PostgreSQL's native vector extension to show the
  nearest point; connect with the bundled `psql` client to add data and indexes.

### Vector stores

Both starters run a persistent vector database inside the fork with an editable similarity-search
preview on port 8000 comparing three coordinates per point.

| Template | Vector store and native port | Preview port | Edit to update |
| --- | --- | --- | --- |
| `qdrant` | Qdrant on loopback port 6333 | 8000 | `vectors.json` |
| `typesense` | Typesense on loopback port 8108 | 8000 | `vectors.json` |

Edit `vectors.json` to update the seeded points on the next request, or talk directly to the native
database API from inside the fork. The preview returns a point's title when supplied and otherwise
its native ID.

### Notebooks, local search and AI

All eight starters run entirely inside the fork without external provider accounts or API keys.

| Template | Stack | Port | Edit to update |
| --- | --- | --- | --- |
| `jupyter` | JupyterLab with NumPy, pandas, Matplotlib, SciPy, scikit-learn | 8000 | `project/sales.csv`, `project/analysis.ipynb` |
| `langgraph` | Local search graph backed by SQLite FTS5 | 8000 | `documents.json`, `pipeline.py` |
| `llamaindex` | Local vector index with TF–IDF embeddings | 8000 | `documents.json`, `pipeline.py` |
| `llama-cpp` | Local CPU `llama.cpp` server (SmolLM2 105 MB GGUF) | 8080 | `public/index.html` |
| `ai-sdk-chat` | Vercel AI SDK chat on fork-local CPU model | 8000 | `instructions.txt`, `public/index.html` |
| `mastra` | Mastra chat on fork-local CPU model | 8000 | `instructions.txt`, `public/index.html` |
| `openai-agents` | OpenAI Agents SDK chat on fork-local CPU model | 8000 | `instructions.txt`, `public/index.html` |
| `crewai` | CrewAI Flow chat on fork-local CPU model | 8000 | `instructions.txt`, `flow.py`, `public/index.html` |

- **`jupyter`**: the warm build executes `project/analysis.ipynb` and checks both the total and the
  plot. Read each fork's login token with `await box.read('.hermitbox/jupyter/access-token')` and
  paste it into the preview's login form.
- **`langgraph` and `llamaindex`**: serve a search page and a JSON endpoint (`search?q=...`). Edit
  `documents.json` to update the corpus immediately, or `pipeline.py` to change retrieval.
- **`llama-cpp`**: initial preparation fetches and verifies the digest-pinned 105 MB SmolLM2 GGUF
  model. Forks start offline, serve a chat page and expose an OpenAI-compatible
  `v1/chat/completions` endpoint on CPU.
- **`ai-sdk-chat`, `mastra`, `openai-agents` and `crewai`**: bundle the verified local CPU model
  and the selected SDK in the same fork. Each reads `instructions.txt` for every message and serves
  edits to `public/index.html` on refresh.

### Browser automation and desktop

| Template | Stack | Port | Host requirement | Edit to update |
| --- | --- | --- | --- | --- |
| `playwright` | Playwright with sandboxed Chromium | 8000 | `browser-sandbox` | `page.html` |
| `puppeteer` | Puppeteer with sandboxed Chromium | 8000 | `browser-sandbox` | `page.html` |
| `browser-use` | Python `browser-use` with sandboxed Chromium | 8000 | `browser-sandbox` | `page.html`, `scenario.py` |
| `desktop` | X11 desktop (`box.desktop()`) with note editor and terminal | 8000 | Container tier | `notes.txt` |

- **`playwright`, `puppeteer` and `browser-use`**: run on a container node that reports the
  `browser-sandbox` guarantee. Edit `page.html` and select **Run browser test** in the preview to
  drive Chromium as an ordinary user, click the sample counter and return a screenshot.
- **`desktop`**: serves the contents of `notes.txt` in its port-8000 preview while `box.desktop()`
  opens the graphical X11 session with an expiring access URL. Edit `notes.txt` through the file
  API or save it from the graphical editor.

## Composable services

To run a database or cache next to your app, in the same sandbox, pass `services: ['postgres']` or
`services: ['redis']` when you create it from a compatible starter project or imported repository:

```ts
const box = await hb.sandbox({ template: 'nextjs', services: ['postgres'] })
```

```python
box = hb.sandbox(template='nextjs', services=['postgres'])
```

- **`postgres`**: runs a fork-local PostgreSQL under `/data` on container loopback and sets
  `DATABASE_URL`.
- **`redis`**: runs a fork-local Redis on container loopback with its append-only log under `/data`
  and sets `REDIS_URL`.

Each starter with a service warms its own snapshot, and the service starts and answers before the
application's entrypoint runs. Composable services work with the catalog's Node, Python and
Alpine language projects, `llama-cpp`, `desktop`, and Git repositories imported on those pinned
images. See [Databases and caches](https://docs.hermitbox.dev/v0.3.2/guides/templates-from-code.md#databases-and-caches) for
details.

## Git repositories and coding agents

- **Git repositories**: `hermitbox template from <repo>` builds a template from an HTTPS repository
  or local Git checkout, recognizing Node, Python, Go, Ruby (Rack), PHP, Rust (Cargo), Java (Maven
  or standalone), .NET, devcontainers and Dockerfiles. See
  [Start a Git repository](https://docs.hermitbox.dev/v0.3.2/guides/templates-from-code.md#start-a-git-repository).
- **Coding agents**: `hermitbox create <agent>` (`hermitbox create --list`) launches a coding agent
  such as Codex in a cached sandbox across VM, gVisor, container or process tiers. See
  [Coding agents](https://docs.hermitbox.dev/v0.3.2/guides/templates-from-code.md#coding-agents).

## Next steps

- [Templates](https://docs.hermitbox.dev/v0.3.2/concepts/templates.md): how templates, versions and snapshots work.
- [Templates from code](https://docs.hermitbox.dev/v0.3.2/guides/templates-from-code.md): build custom templates with
  `hb.template()`, compose services and import Git repositories.
- [CLI reference](https://docs.hermitbox.dev/v0.3.2/reference/cli.md#template): every `hermitbox template` subcommand and flag.
