Skip to content

Commit 7fddb43

Browse files
authored
Merge pull request #3 from nanoapi-io/chore/readme
Add readme for release
2 parents 024757e + 318b92a commit 7fddb43

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

README.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,149 @@
11
# napi
2+
3+
Powerful CLI + UI for inspecting and refactoring an API codebase in any language and web framework.
4+
5+
> This project is under ongoing development. Check the [status section](#status) for more information on supported languages and frameworks.
6+
7+
![demo](https://nanoapi.io/images/video/demo.gif)
8+
9+
## Features
10+
11+
- **Inspect**: Analyze your codebase and understand the API endpoints, middleware, and other API-specific code
12+
- **Refactor**: Refactor your codebase into smaller, more manageable pieces through the UI or annotations
13+
- **Build**: Transform your codebase into smaller, more manageable pieces at build time
14+
15+
## Motivation
16+
17+
- Quickly refactor large/monolith codebases into smaller, more manageable pieces at build time
18+
- Increase robustness by reducing the downtime through isolating
19+
- Don't waste time with consultants or contractors to refactor your codebase
20+
- Better understand what your codebase is doing today
21+
- Create a new development paradigm (develop monolith, deploy microservice) for projects moving fast
22+
23+
To understand better what we mean by the above, please take a look at our [documentation](https://nanoapi.io/docs/nanoapi).
24+
25+
## Design goals
26+
27+
- Zero configuration
28+
- Support for all languages and web frameworks
29+
- Auto-detect endpoint definitions, middleware, and other API-specific code without manual annotations
30+
- Clean, simple, and easy to use UI
31+
32+
# Usage
33+
34+
### Installation
35+
36+
We are working on a binary release, but for now, you can install it via this github repository:
37+
38+
```bash
39+
$ git clone https://github.com/nanoapi-io/napi.git
40+
$ cd napi
41+
$ npm install
42+
```
43+
44+
### Usage
45+
46+
To open the UI and inspect your codebase, run the following command:
47+
48+
```bash
49+
$ napi ui /path/to/entrypoint
50+
```
51+
52+
### Commands:
53+
```
54+
ui [entrypoint] Inspect the codebase and understand the API endpoints, middleware, and other API-specific code
55+
split <entrypoint> Transform the codebase into smaller, more manageable pieces at build time
56+
```
57+
58+
## Using the UI
59+
60+
The easiest way to refactor your API endpoints is to do it through our UI. You can group endpoints and create builds from here.
61+
62+
## Building with Annotations
63+
64+
You can also refactor your codebase by adding annotations to your code. Here is an example of how you can do it:
65+
66+
```typescript
67+
// src/api.js
68+
69+
import * as express from 'express';
70+
71+
import * as service from './service.js';
72+
73+
const app = express();
74+
const port = 3000;
75+
76+
app.use(express.json());
77+
78+
// @nanoapi endpoint:/api/v2/maths/time method:GET group:Time
79+
app.get('/api/v2/maths/time', (req, res) => {
80+
const result = service.time();
81+
return res.json({
82+
result
83+
});
84+
});
85+
86+
// @nanoapi endpoint:/api/v2/maths/addition method:POST group:Maths
87+
app.post('/api/v2/maths/addition', (req, res) => {
88+
const { body } = req;
89+
const result = service.addition(body.a, body.b);
90+
return res.json({
91+
result
92+
});
93+
});
94+
95+
// @nanoapi endpoint:/api/v2/maths/subtraction method:POST group:Maths
96+
app.post('/api/v2/maths/subtraction', (req, res) => {
97+
const { body } = req;
98+
const result = service.subtraction(body.a, body.b);
99+
return res.json({
100+
result
101+
});
102+
});
103+
104+
app.listen(port, () => {
105+
console.log(`App listening on port: ${port}`);
106+
});
107+
```
108+
109+
## Output
110+
111+
From the exmaple above, you will get the following output from running a build:
112+
113+
```typescript
114+
// dist/Time/src/api.js
115+
116+
import * as express from 'express';
117+
118+
import * as service from './service.js';
119+
120+
const app = express();
121+
const port = 3000;
122+
123+
app.use(express.json());
124+
125+
app.get('/api/v2/maths/time', (req, res) => {
126+
const result = service.time();
127+
return res.json({
128+
result
129+
});
130+
});
131+
132+
app.listen(port, () => {
133+
console.log(`App listening on port: ${port}`);
134+
});
135+
```
136+
137+
## Status
138+
139+
This project is in the early stages of development. We are actively working on the project and will be releasing new features and improvements regularly, which may include a rewrite into a more efficient and generic language like Rust or Go. Please check our issues and project board for more information.
140+
141+
- [x] Support for NodeJS/Typescript and ExpressJS
142+
- [x] Simple UI
143+
- [ ] NestJS support
144+
- [ ] Python support with Flask
145+
- [ ] Django support
146+
- [ ] Full python support
147+
- [ ] PHP support
148+
- [ ] Java support
149+
- [ ] C# support

0 commit comments

Comments
 (0)