---
title: "Packages"
description: "Create a Hew project, install an official package, and keep dependency versions repeatable."
source: "https://hew.sh/docs/packages"
---

# Packages

Start a project and add code from the Hew ecosystem.

## Create a project

[Install Hew](/docs/getting-started), then create a project with `hew init`. The package manager is part of `hew`; there is no separate executable to install.

Create and run a project

```bash
hew init myproject
cd myproject
hew check
hew run
```

The project contains `hew.toml`, `main.hew` and `.gitignore`. With no file argument, `hew check`, `hew build` and `hew run` use the enclosing manifest's entry point, which defaults to `main.hew`.

## Install an official package

Start with `hew.template` from the [official ecosystem repository](https://github.com/hew-lang/ecosystem). Package version `0.6.0` is published in the registry, works with Hew `v0.9.3` and needs no external service.

Create a project and install the package

```bash
hew init hello-template
cd hello-template
hew add hew.template --version 0.6.0
hew install
```

Save this as `main.hew`:

main.hew

```hew
import hew.template;
 
fn main() {
    let context = "name\n<Ada & Co>\nbody\n<strong>Welcome</strong>";
    let page = template.render(
        "<h1>Hello, {{name}}!</h1><main>{{{body}}}</main>",
        context,
    );
    println(page);
}
```

Check and run

```bash
hew check
hew run
```

Output

```plaintext
<h1>Hello, &lt;Ada &amp; Co&gt;!</h1><main><strong>Welcome</strong></main>
```

Double braces escape HTML in the supplied value. Triple braces insert the value unchanged, as the `body` field does with the trusted markup above. Other ecosystem packages may require services or native dependencies named in their README.

## Registry packages and compatibility

The registry API is at `https://registry.hewpkg.com/api/v1`. You can [inspect the published template versions](https://registry.hewpkg.com/api/v1/packages/hew/template) without signing in. This is a JSON API, not a browser package catalogue.

Use the `0.6.0` package with Hew `v0.9.3`. Older `0.2.0` ecosystem archives use syntax removed in Hew 0.6.

Lock dependencies for repeatable builds

`hew add PACKAGE --version VERSION` adds a dependency to `hew.toml`. `hew install` resolves and installs dependencies and writes `hew.lock`. `hew install --locked` uses that lock file without changing the pinned resolution. Commit `hew.lock` with your project so other developers and CI use the same package versions.

Package names in source use dots, such as `hew.template`; the API uses slash-separated paths. Follow the [ecosystem toolchain guidance](https://github.com/hew-lang/ecosystem/blob/main/docs/toolchain.md) for current compatibility, and the [package CLI reference](https://github.com/hew-lang/hew/blob/v0.9.3/hew-pkg/README.md) for manifests, version requirements and registry configuration.
