Files
nym/documentation/docs/pages/developers/mix-dns/get-started.mdx
T
mfahampshire 7c890ea0c5 TS SDK docs (#6840)
* First sweep packages + some minor tweaking

* Second sweep

* Regenerate lockfile + package.json mods

* Regenerate lockfile again

* Fix CI

* Fix CI again

* All building properly

* unblock

* Tweak examples

* Comments + readme + fix rotten unit test

* First pass docs

* Big pass

* Massive pass on new docs

* Update integrations.md w mobile

* Partial overhaul review

* new playground + big pass

* new fix lychee err

* IPR notice tweak
2026-06-09 13:31:08 +00:00

35 lines
1.1 KiB
Plaintext

---
title: "Get started with mix-dns"
description: "Install @nymproject/mix-dns and resolve a hostname through the Nym mixnet."
schemaType: "TechArticle"
section: "Developers"
lastUpdated: "2026-06-05"
---
# Get started
## Installation
```bash
npm install @nymproject/mix-dns
```
ESM only, with the worker and WASM inlined via [`mix-tunnel`](/developers/mix-tunnel/get-started#installation); no bundler config needed.
## Quick start
```ts
import { setupMixTunnel, mixDNS, disconnectMixTunnel } from '@nymproject/mix-dns';
await setupMixTunnel();
const ip = await mixDNS('example.com');
console.log(ip); // e.g. an IPv4 address string
await disconnectMixTunnel();
```
`mixDNS` returns the first resolved address as a string: an IPv4 A record when available, otherwise IPv6. It rejects if the hostname cannot be resolved. To resolve and immediately use the result via `mixFetch`, the simpler path is to skip `mixDNS` entirely and call `mixFetch('https://example.com')`, which handles resolution itself.
Resolve hostnames live in the [mixnet playground](/developers/playground), with a tunnel-vs-clearnet (DoH) comparison.