CLI

AxilJS CLI Configuration and Project Setup

Configure and use the AxilJS CLI within an AxilJS project, including project context, entry points, package management, diagnostics, version management, and development commands.

4 min readDocumentationEdit this page

AxilJS CLI Configuration

The AxilJS CLI is designed to operate within an AxilJS project and use the project's existing source structure, dependencies, and application configuration.

CLI configuration is primarily project-oriented. Application-level configuration, including environment variables and typed configuration, is handled separately in the Environment and Typed Config documentation.

Project Context

Run AxilJS CLI commands from the root directory of your project.

Terminal
cd my-api
axil run

The CLI operates against the current project context, including its source files, installed dependencies, and application configuration.

Running commands from the project root ensures that the CLI can work with the expected AxilJS project structure.

Entry Point

The run command can use the project's default application entry point:

Terminal
axil run

You can also provide a custom entry point:

Terminal
axil run src/mvc/main.ts

A custom entry point is useful when your application uses a different source structure or entry module.

Package Management

Install project dependencies from the project root using npm:

Terminal
npm install

AxilJS packages can also be installed through the CLI:

Terminal
axil install <package>

For example:

Terminal
axil install @axiljs/decorator

Standard npm package installation remains available:

Terminal
npm install <package>

Use npm install when you need the standard npm package-management workflow.

Check the CLI Version

Use --version to check the currently installed AxilJS CLI version:

Terminal
axil --version

Checking the version is useful when troubleshooting differences between development environments or verifying that the expected CLI release is installed.

Update the CLI

For a globally installed AxilJS CLI, update to the latest published version with:

Terminal
npm install -g @axiljs/cli@latest

After updating, verify the installed version:

Terminal
axil --version

This provides a simple way to confirm that the CLI update completed successfully.

Project Environment

Application environment configuration is managed at the project level.

Environment variables and typed application configuration should follow the configuration structure used by the project.

See the dedicated configuration documentation:

Diagnose Project Issues

Use the built-in doctor command to inspect the project environment:

Terminal
axil doctor

If you encounter an unexpected CLI or project issue, run:

Terminal
axil doctor

before investigating individual configuration files.

The diagnostic command provides a first step for checking the project environment and identifying potential configuration or setup problems.

CLI Help

Display the complete AxilJS CLI command reference with:

Terminal
axil --help

You can also request help for a specific command.

For the run command:

Terminal
axil run --help

For the build command:

Terminal
axil build --help

For decorator-related commands:

Terminal
axil decorator --help

Command-specific help is useful when you need to inspect the available options without leaving the terminal.

A typical AxilJS project workflow starts by creating the project, installing dependencies, checking the environment, and starting the application:

Terminal
axil create my-api
cd my-api
npm install
axil doctor
axil run

The sequence provides a straightforward development setup:

text
Create Project
      │
      ▼
   npm install
      │
      ▼
   axil doctor
      │
      ▼
    axil run

Production Build and Deployment

When the application is ready for production, use the AxilJS build and deployment commands:

Terminal
axil build
axil deploy

The build command prepares the application for production, while the deploy command handles the deployment workflow supported by the AxilJS CLI.

CLI Configuration Model

AxilJS keeps project configuration close to the application while providing CLI commands for common development and deployment tasks.

The main CLI workflow can be summarized as:

text
AxilJS Project
      │
      ├── Source Files
      ├── Dependencies
      └── Application Configuration
                │
                ▼
           AxilJS CLI
                │
       ┌────────┼─────────┐
       ▼        ▼         ▼
      run     build     doctor
                         │
                         ▼
                       deploy

This project-oriented approach allows the CLI to work with the application's existing source structure and configuration while providing commands for development, diagnostics, building, and deployment.

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY