The CLI
Vantris ships a single binary, vantris, with three commands. The CLI's only job is to parse arguments and route to a command — all behaviour lives in the command modules. This keeps the surface tiny and predictable.
vantris <command> [options]Run it through your package manager (npm run dev), directly with npx vantris dev, or from a package.json script.
Commands
| Command | Description |
|---|---|
vantris dev | Start the development server with HMR. |
vantris build | Produce an optimised production build in outDir. |
vantris build --watch | Rebuild on every change (no dev server). |
vantris preview | Serve the built outDir locally (no compilation). |
Each command is documented in depth:
vantris dev— the dev server.vantris build— the production build.vantris preview— the preview server.
Global flags
| Flag | Applies to | Description |
|---|---|---|
--mode <mode> | all | Set the mode (development, production, custom). |
--watch, -w | build | Rebuild on every change. |
--host [host] | dev | Bind to a host; bare --host means 0.0.0.0. |
--help, -h | — | Show help. |
--version, -v | — | Show the version number. |
--verbose, --debug | all | Verbose logging. |
--mode
Every command runs in a mode. The mode selects which .env files load and what import.meta.env.MODE resolves to.
devdefaults todevelopment.buildandpreviewdefault toproduction.
Override it explicitly:
vantris dev --mode staging
vantris build --mode production
vantris preview --mode localSee Env Variables & Modes for how the mode drives environment loading.
--host
dev only. Binds the server so other devices on your network can reach it. Overrides dev.host from the config.
vantris dev --host # all interfaces (0.0.0.0)
vantris dev --host 0.0.0.0 # explicit
vantris dev --host 192.168.1.42When bound to a non-localhost address, the dev server prints both the Local and Network URLs on start.
--watch / -w
build only. Rebuilds on every change, debounced. It does not start a dev server — it only rebuilds — and a failed build never stops the watcher.
vantris build --watch
vantris build -w--help and --version
vantris --help # or -h
vantris --version # or -v--help prints the styled command list; --version prints the current version.
Exit codes & errors
Everything Vantris does intentionally throws a VantrisError subclass, rendered cleanly by the CLI with a clear message. A failed command exits with a non-zero status, so it fails your CI as expected. Common cases:
vantris previewbeforevantris build→ a clear "run build first" error.- A port already in use → a clear address-in-use error.
- An invalid config value → the property path, expected type, and value received.
Programmatic use
Everything the CLI does is also exported from the vantris package, so you can embed it in custom tooling:
import { run } from "vantris";
await run(["build", "--mode", "production"]);Or call the lower-level functions (runBuild, startDevServer, startPreviewServer) directly. See the JavaScript API.