---
title: ":hostname()"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/selectors/pseudo-classes/hostname"
image: "https://docs.vlt.io/og/client/selectors/pseudo-classes/hostname"
lang: "en"
---

# :hostname()

The `:hostname()` pseudo-class matches packages based on the hostname of the registry or git remote they were fetched from.

## Syntax

```
:hostname(<domain>)
```

### Parameters

| Parameter | Description                                               |
| --------- | --------------------------------------------------------- |
| `domain`  | The hostname to match against (e.g. `npm.pkg.github.com`) |

## How it works

The selector extracts the hostname from each package's source:

- **Registry packages**: hostname from the registry URL
- **Git packages**: hostname from the git remote (supports named hosts like `github` → `github.com`)
- **Remote packages**: hostname from the tarball URL
- **File/workspace packages**: never match (no hostname)

## Examples

Find all packages served from the public npm registry:

```bash title="Terminal"
$ vlt query ':hostname(registry.npmjs.org)'
```

Note that registry nodes are matched against the resolved registry URL. Packages from vlt's built-in `npm` alias (its [public npm mirror](https://docs.vlt.io/registry/public-mirror.md)) match `:hostname(registry.vlt.io)`. A registry alias with no URL leaves its nodes with no hostname to compare, so they will not match.

Find packages from GitHub's package registry:

```bash title="Terminal"
$ vlt query ':hostname(npm.pkg.github.com)'
```

Find git dependencies hosted on GitHub:

```bash title="Terminal"
$ vlt query ':hostname(github.com)'
```

Find packages from a custom registry:

```bash title="Terminal"
$ vlt query ':hostname(registry.example.com)'
```

## See also

- [`:registry()`](https://docs.vlt.io/client/selectors/pseudo-classes/registry.md) — match by registry configuration name
- [`:type()`](https://docs.vlt.io/client/selectors/pseudo-classes/type.md) — match by package type (registry, git, file, etc.)
