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.
- 🔍 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.
- 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.
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.
Comprehensive documentation is available on our documentation website.
Ensure you have Node.js (>=18) and npm installed.
npm install -g @nanoapi.io/napi
napi init
napi ui
This will initialize a new NanoAPI project and open the UI for inspecting and refactoring your codebase.
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.
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.
The UI provides an interactive interface to:
- Group and organize endpoints.
- Preview the generated microservices.
- Export refactored code for deployment.
napi
works seamlessly with CI/CD platforms like GitHub Actions, GitLab CI/CD, and Jenkins. For setup instructions, refer to our CLI guide.
- Automating the Strangler Pattern with Microlithic Development
- Rise of the "Microlith": Rethinking Microservices for Modern Developers
We welcome contributions from the community. Please read our contributing guide for details on how to get involved.
napi
is licensed under the Sustainable Use License.
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.