Skip to main content
Ant ships with a fully integrated package manager — there is no separate binary to install or configure. You run ant add, ant install, and ant run directly, using the same package.json format you already know from the npm ecosystem. Packages are resolved from the public npm registry at https://registry.npmjs.org, and every install produces a binary lockfile (ant.lockb) so your dependencies are reproducible across machines.

Project structure

A standard Ant project contains two files at its root:
my-project/
├── package.json
├── ant.lockb
├── node_modules/
└── src/
    └── index.ts
FilePurpose
package.jsonStandard npm-format manifest: name, version, scripts, dependencies
ant.lockbBinary lockfile for reproducible installs — commit this to version control
node_modules/Installed packages, populated by ant install or ant add

Starting a new project

1

Initialize package.json

Run ant init in an empty directory. Ant prompts you for a package name, version, and entry point, then writes a package.json with a start script pre-configured.
ant init
The generated file looks like this:
package.json
{
  "name": "my-project",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "ant index.js"
  },
  "dependencies": {},
  "devDependencies": {}
}
2

Add dependencies

Use ant add to install a package and save it to dependencies. Ant resolves the package from the npm registry, writes node_modules/, and updates both package.json and ant.lockb.
ant add hono
To save a package as a development dependency only, pass -D:
ant add -D typescript
3

Install from lockfile

On a fresh clone, run ant install (or ant i) to restore the exact package versions recorded in ant.lockb.
ant install
If no lockfile exists yet, Ant resolves all versions from package.json and creates one.
4

Run a script

Execute any script defined in the scripts field of package.json:
ant run start
Ant also recognizes script names as direct subcommands, so ant start works as a shorthand when start is defined in scripts.

The lockfile

ant.lockb is a binary lockfile that records the exact resolved version, integrity hash, and download URL for every package in your dependency tree. Commit this file to version control so every developer and CI environment installs identical packages.
You should never need to edit ant.lockb by hand. Run ant update to re-resolve and refresh the lockfile when you want to pull in newer versions.

The antx binary

antx is a convenience binary that is equivalent to ant x. It lets you run executables from node_modules/.bin without typing the full ant x prefix:
# These two commands are identical
ant x tsc --version
antx tsc --version
If the requested binary is not installed locally, Ant will temporarily download it from the registry and execute it — similar to npx.

Command overview

All package management commands live under the ant binary. See the Commands reference for full syntax and options.
CommandAliasDescription
ant initCreate a new package.json
ant installant iInstall all dependencies from the lockfile
ant updateant upRe-resolve dependencies and refresh the lockfile
ant add <pkg>ant a <pkg>Add a package to dependencies
ant remove <pkg>ant rm <pkg>Remove a package
ant trustRun lifecycle scripts for packages
ant run <script>Run a script from package.json
ant exec <cmd>ant x <cmd>Run a binary from node_modules/.bin
ant why <pkg>ant explain <pkg>Show why a package is installed
ant info <pkg>Show package information from the registry
ant lsant listList installed packages
ant cacheManage the package cache
ant create <template>Scaffold a project from a template