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, and on Windows via WSL.

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.

  • Windows: 7+ on WSL, or via powershell with our install script

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 login command

napi login

This assumes you have created an account on https://app.nanoapi.io. It will ask for your email address and then send you a code you can use to login to the CLI.

2. Run the init command

cd /path/to/your/project
napi init

This will prompt you several questions to get the project setup, including the option to create or select an existing project from your account. 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",
  "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.

3. Generate a manifest

Manifests are how NanoAPI understand your codebase. It is a representation needed to build a graph which stores to actual code from your system.

This command will automatically upload the manifest to the project selected or created in the above step.

napi manifest generate

The output of this command will be a link to the NanoAPI app to view your new manifest.

4. View the manifest

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