Installation
Get AXON up and running in your project
What You'll Learn
- How to install the AXON core library via npm, yarn, or pnpm
- Setting up the CLI tool for command-line usage
- Verifying your installation and system requirements
NPM Package
Install the core AXON library for your JavaScript/TypeScript project:
npm install @axon-format/core Or using yarn:
yarn add @axon-format/core Or using pnpm:
pnpm add @axon-format/core CLI Tool
For command-line usage, install the CLI globally:
npm install -g @axon-format/cli This provides the axon command for:
- Converting JSON files to AXON format
- Decoding AXON back to JSON
- Analyzing token savings
- Validating AXON syntax
Verify Installation
Test that AXON is installed correctly:
import { encode } from '@axon-format/core';
console.log(encode({ test: "Hello AXON!" }));
// Should output AXON-encoded string Requirements
- Node.js: Version 18 or higher
- TypeScript: 5.0+ (optional, but recommended)
Troubleshooting
Module not found
If you see Cannot find module '@axon-format/core', verify the package installed correctly:
npm ls @axon-format/core If it is not listed, reinstall it. If you are using a monorepo, make sure you are installing in the correct workspace.
TypeScript type errors
AXON ships with built-in TypeScript declarations. If types are not resolving, check that your tsconfig.json includes "moduleResolution": "node" or "bundler":
{
"compilerOptions": {
"moduleResolution": "bundler",
"esModuleInterop": true
}
} Node.js version mismatch
AXON requires Node.js 18 or higher. Check your version:
node --version If you are on an older version, use nvm to upgrade:
nvm install 18
nvm use 18 ESM vs CommonJS
AXON is distributed as an ES module. If your project uses CommonJS (require()), either:
- Add
"type": "module"to yourpackage.json, or - Use dynamic
import()instead ofrequire()
// CommonJS workaround
const axon = await import('@axon-format/core');
const encoded = axon.encode({ test: "data" }); Ready to Code?
Encode your first data structure with AXON