Skip to content

Latest commit

 

History

History
151 lines (103 loc) · 6.15 KB

README.md

File metadata and controls

151 lines (103 loc) · 6.15 KB

NanoAPI Banner

napi - Next-Level Visual Tooling For API Codebases

napi is a versatile tool built by NanoAPI and designed to automatically refactor large microlith codebases into smaller, more manageable microservices. With both a powerful CLI and an intuitive UI, napi is compatible with all major CI/CD platforms, allowing seamless integration into your development and deployment pipelines.

NanoAPI UI Overview

Features

  • 🔍 Inspect: Analyze your codebase to identify API endpoints, middleware, and other API-specific components.
  • 📝 Refactor: Split your monolith into microservices using the UI or annotations in the code.
  • 🏗️ Build: Generate modular microservices ready for deployment.
  • ⚙️ Integrate: Use CLI commands compatible with all CI/CD workflows for automation.

Why napi?

  • Simplifies the process of breaking down monoliths into microservices.
  • Improves understanding, maintainability, and robustness at both the architecture and code level.
  • Reduces dependency on consultants or contractors for complex refactoring tasks.
  • Accelerates development with a "develop monolith, deploy microservice" approach.

Supported Languages and Frameworks

napi aims to support all major programming languages and web frameworks. Here is the current status:

Language/Framework Status Related Issues
JavaScript ✅ Supported Early Core Feature
TypeScript ✅ Supported Early Core Feature
Python ✅ Supported #28
PHP 🚧 In Progress #30
C# 🚧 In Progress #31
Java 🚧 In Progress #32
C 🚧 In Progress Not Tracked Yet
C++ 🚧 In Progress Not Tracked Yet

For the latest updates, visit our project board.

Documentation

Comprehensive documentation is available on our documentation website.

Quick Start

Ensure you have Node.js (>=18) and npm installed.

Installation

npm install -g @nanoapi.io/napi

Getting Started

napi init
napi ui

This will initialize a new NanoAPI project and open the UI for inspecting and refactoring your codebase.

CLI Usage

napi provides the following commands:

init                  Initialize the NanoAPI project
ui [entrypoint]       Open the UI to inspect and refactor the codebase
split <entrypoint>    Transform the codebase into microservices
napi <platform> annotate <entrypoint> [--token=<key>] Automatically generate annotations for the codebase via OpenAI

For more detailed information about the CLI and what each command does, refer to our CLI guide.

Refactoring with Annotations

You can use annotations to specify how to split your code. Here’s an example:

// src/api.js

// @nanoapi endpoint:/api/v1/users method:GET group:Users
app.get("/api/v1/users", (req, res) => {
  res.send("User data");
});

// @nanoapi endpoint:/api/v1/orders method:POST group:Orders
app.post("/api/v1/orders", (req, res) => {
  res.send("Order created");
});

Running napi split will generate modular services based on these annotations. You'll have a Users service and an Orders service, each containing the respective endpoint.

Using the UI

The UI provides an interactive interface to:

  • Group and organize endpoints.
  • Preview the generated microservices.
  • Export refactored code for deployment.

NanoAPI UI Preview

CI/CD Integration

napi works seamlessly with CI/CD platforms like GitHub Actions, GitLab CI/CD, and Jenkins. For setup instructions, refer to our CLI guide.

Further Reading

Contributing

We welcome contributions from the community. Please read our contributing guide for details on how to get involved.

License

napi is licensed under the Sustainable Use License.

Support

For questions or issues, feel free to open an issue on GitHub or join us on our server on Discord.

GitHub Logo Discord Logo

Donations

NanoAPI is a fair-source project. Because of this, we feel it would be unethical to keep any donations to ourselves. Instead, here is how we will handle donations:

  • Donations go into a pool
  • Money from the pool will be distributed to contributors
  • At the end of the year, any remaining money will be donated to a charity of the community's choice

We will post regular updates on how much money is in the pool and how it is being distributed.