Skip to main content
Ant is designed to be a drop-in runtime for the npm ecosystem. It resolves packages from https://registry.npmjs.org, reads the standard package.json format without any special configuration, and provides Node-compatible built-in modules so packages that import node:fs, node:path, or node:crypto work without shims. Most packages you already use will run in Ant without modification.

Registry and resolution

When you run ant add hono or ant install, Ant contacts the npm registry directly to resolve package metadata and download tarballs. No npm client, no Bun, no separate package manager binary is required. The resolved dependency tree is written to ant.lockb, a binary lockfile that records the exact version, tarball URL, and integrity hash for every package. Commit ant.lockb to version control so every developer and CI environment installs byte-for-byte identical packages.
ant.lockb is written and read by Ant automatically. You do not need to interact with it directly. Run ant update to re-resolve and refresh it.

Supported package.json fields

Ant reads the following fields from package.json:
FieldPurpose
namePackage identifier
versionSemver version string
type"module" (ESM) or "commonjs"
mainCommonJS entry point
moduleESM entry point (preferred over main for ESM consumers)
exportsSubpath exports map — Ant resolves conditions including import, require, and default
scriptsCommands runnable with ant run
dependenciesRuntime dependencies
devDependenciesDevelopment-only dependencies

Module format compatibility

Ant natively runs ESM. Use import and export syntax freely in .js, .mjs, and .ts files. Set "type": "module" in package.json to treat all .js files as ESM.
package.json
{
  "type": "module"
}
src/index.ts
import { Hono } from 'hono';

const app = new Hono();
app.get('/', c => c.text('hello'));

export default app;

Node-compatible built-ins

Ant provides built-in implementations of the standard Node.js modules. Any npm package that imports these modules will resolve them correctly — no polyfills or bundler configuration needed.
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { createHash } from 'node:crypto';
import { EventEmitter } from 'node:events';
The following Node built-ins are available under both the node: prefix and the bare name (for example import fs from 'fs' and import fs from 'node:fs' both work):
fs              fs/promises
path            path/posix  path/win32
crypto
os
net
dns
url
events
buffer
stream          stream/promises  stream/web
process
child_process
worker_threads
async_hooks
readline        readline/promises
tty
util            util/types
zlib
string_decoder
assert
module
v8
timers          timers/promises
perf_hooks
console
constants

Ant-specific modules

Ant exposes several runtime modules under the ant: prefix. These are Ant-only — they are not available in Node.js or Bun, and no npm package will accidentally import them.
ModuleDescription
ant:ffiForeign function interface for calling native C libraries
ant:shellShell command execution utilities
ant:lmdbEmbedded LMDB key-value database
import { open } from 'ant:lmdb';
import { $ } from 'ant:shell';
Code that imports ant: modules will not run in Node.js or Bun. Keep ant:-specific imports in separate files if you need your project to be portable across runtimes.

Real-world example: Hono web server

The following example is taken directly from examples/npm/hono in the Ant repository. It shows a minimal HTTP server using the Hono framework, a popular ESM-first web framework that publishes to the npm registry.
1

Initialize and install

ant init
ant add hono
2

Write the server

src/index.ts
import { Hono } from 'hono';
import { logger } from 'hono/logger';

const app = new Hono();

app.use(logger());
app.get('/', c => c.text(`hello hono!!\n\n🐜 ${Ant.version}\n`));

console.log('started on http://localhost:3000');

export default app;
3

Configure package.json

package.json
{
  "name": "hono",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "ant src/index.ts"
  },
  "dependencies": {
    "hono": "^4.12.9"
  },
  "devDependencies": {}
}
4

Run the server

ant run start

Packages known to work

The Ant repository includes integration examples for the following npm packages. All resolve and run from the npm registry without modification:

hono

Lightweight, ultrafast web framework with full middleware support.

elysia

TypeScript-first, end-to-end type-safe web framework.

express

The classic Node.js HTTP framework.

esbuild

Extremely fast JavaScript/TypeScript bundler and minifier.

preact

Fast 3kB React-compatible UI library.

react

The React library and related packages.

rolldown

Fast Rust-based JavaScript bundler.

undici

Low-level HTTP/1.1 client for Node-compatible runtimes.

ky

Tiny and elegant HTTP client based on the Fetch API.
If a package relies on lifecycle scripts (for example esbuild downloads a platform-specific binary in postinstall), you need to run ant trust <package> after the initial install. See Commands for details.