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
Before you can begin, make sure you have the following installed on your machine
-
NodeJS (>=22.x) and npm
-
Git (optional)
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.
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 NPM Package
npm install -g @nanoapi.io/napi
And with that, you’re done! You now have the superpowers of a software architect.
Next, let’s get a project running with it.
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 audit view
Next, we’ll show the audit view.
napi audit 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.