Getting Started

5 minutes to better software

Quick Start

This guide will get you setup and navigating your codebases using our CLI.

For on-premise production deployments, drop us a line.

Prerequisites

napi works out of the box on both mac and linux systems.

The guide shown below is for the production version of the tool. If you want to run the development version of the tool locally then you will need to follow the steps outlined in our contributing guide.

Supported Environments

napi is a binary, and as such works right away without the need to install specific language tooling.

napi works out of the box on both mac and linux systems. To use this tool on Windows, you will need to install WSL (Windows Subsystem for Linux) and run the commands from there.

Currently our tool is supported on:

  • Mac: All versions and chipsets.

  • Linux: All distros.

If there is another environment you’d like us to support, please let us know.

Installing the CLI

NanoAPI offers a powerful CLI that allows you to navigate your codebases, collect information on their structural quality, and select symbols to extract into smaller units of functionality. To begin:

1. Install the binary with the install script

curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash

And with that, you’re done! You now have the superpowers of a software architect.

Next, let’s get a project running with it.

For more ways to install or build the project, check out our repo.

If you have the old version of the NPM package installed, make sure to uninstall that first: napi uninstall -g @nanoapi.io/napi

Running it on a local project - Apache Airflow

For this section, we will be running the project on Apache Airflow. Feel free to follow along by checking out that repo, or use one of your own projects.

With the CLI installed, we need to initialize the config for our repo.

Make sure to check the Supported Languages page to see if your language/project is supported. We are regularly adding support for new languages, so check back often.

napi allows you to configure your project as needed to correctly generate the manifest.

1. Run the init command

cd /path/to/your/project
napi init

This will prompt you several questions to get the project setup. After it’s done, you will have a shiny new .napirc file at the root of your project. The contents should look something like the following:

{
  "language": "python",
  "project": {
    "include": [
      "airflow-core/src/**/*"
    ],
    "exclude": [
      ".git/**",
      "**/dist/**",
      "**/build/**",
      "**/__pycache__/**",
      "**/*.pyc",
      "**/.pytest_cache/**",
      "**/venv/**",
      "**/.env/**",
      "**/*.egg-info/**",
      "**/.tox/**",
      "**/.coverage",
      "**/htmlcov/**",
      "**/.mypy_cache/**"
    ]
  },
  "outDir": "napi_out",
  "metrics": {
    "file": {
      "maxChar": 5000,
      "maxLine": 2000,
      "maxDep": 10
    },
    "symbol": {
      "maxChar": 50000,
      "maxLine": 200,
      "maxDep": 5
    }
  },
  "python": {
    "version": "3.11"
  }
}

You can edit this file as you would a tsconfig.json or similar configuration. This file should be committed along with your codebase to make maximum use of the tool later on in your CI/CD pipeline.

You can read up on the various parameters in the .napirc file reference page. For now, let’s run the tool.

2. Show the manifest view

Next, we’ll show the manifest view.

napi manifest generate && napi manifest view

This command will open a browser window and begin scanning your codebase to build the manifest. Larger projects can take more time, so please wait until processing is done.

The processing can be seen in the terminal window where the command was run.

Once the command is complete, your browser will show a view like the following:

3. Audit your codebase

The audit view is a powerful way to explore and explain your codebase while doing refactoring tasks that would normally take months or years. To dive into the available features, continue on to the Audit Tool documentation.

Appendix: Updating the CLI

The CLI can be updated to the latest version using the same command as used to install. This will handle removing the old binaries as well:

curl -fsSL https://raw.githubusercontent.com/nanoapi-io/napi/refs/heads/main/install_scripts/install.sh | bash
Updated on