NanoAPI Docs
Intro to Nano APIWhat is a Nanoservice?How Does Nano API Work?What it DoesWhy Use Nano API?What Are Some Use-Cases?What's Next? How Do I Get Setup?Getting StartedAutomatic BuildsFAQs

What is Nano API?

Nano API is a novel SaaS tool used for converting a backend web API from a single service to a swarm of Nanoservices.

What is a Nanoservice?

A Nanoservice is a backend service that is responsible for a single API endpoint. This is in contrast to a monolithic webserver, which is responsible for all endpoints.

How Does Nano API Work?

Nano API works by taking a server codebase and converting it into a series of Nanoservices at deploy time. These Nanoservices are small, efficient, highly-scalable, and energy-efficient [Source: NanoAPI Whitepaper].

What it Does

Still confused? We don't blame you. Let's say that you have the following NodeJS Express server:

// ./src/math.service.js
export function addition(a, b) {
return a + b;
}
export function subtraction(a, b) {
return a - b;
}
// ./src/api.js
import * as express from 'express';
import * as service from './service.js';
const app = express();
const port = 3000;
const urlBase = '/api/v2/maths';
app.use(express.json());
app.get(urlBase + '/addition', (req, res) => {
const { body } = req;
const result = service.addition(body.a, body.b);
return res.json({
result
});
});
app.get(urlBase + '/subtraction', (req, res) => {
const { body } = req;
const result = service.subtraction(body.a, body.b);
return res.json({
result
});
});
app.listen(port, () => {
console.log(`App listening on port: ${port}`);
});

If you were to take the above code and run it, you would get a webserver that provides two endpoints: /addition and /subtraction.

This is where Nano API's build functionality comes in.

Running the above code through our tool will result in 2 Nanoservices-compatible files containing everything needed to deploy this functionality to the cloud.

Not only does the tool perform the transpilation for the backend code, it will also deploy the functions for you on to NanoAPIs cloud!

Why Use Nano API?

The answer is twofold: performance and sustainability. Nanoservices use less energy than a normal horizontally-scaled webserver on an EC2 or other similar environment.

What Are Some Use-Cases?

We've thought a lot about the current state of serverless computing, and we've recognized that there is a lack of a real road to adoption for existing projects, alongside some other issues serverless brings. If you've ever come across any of the following cases, Nano API is the tool for you:

Aggregate Simple Services

Many companies nowadays have integrations with service providers like Slack, GitHub, Gitlab, and others. Often, these tools are written as one-off codebases that get stuck in a corner somewhere and lose developer focus.

With Nano API you could bundle these integrations together as a single Web Framework codebase, and deploy them separately.

Hire Devs with Industry-Standard Knowledge

As in the above case, having lambda (or other serverless functions) in one codebase simplifies maintenance for all of your separate functions. As an added benefit, this means you can hire developers with industry-standard knowledge in a given Web Framework, and use that framework to write and support your infrastructure. No more need to find AWS specialists or hire contractors to setup your AWS account and functions.

Break Apart Expensive Monoliths

Anyone involved in hosting a large NodeJS, Python, or other runtime-language backend application knows that, as the codebase grows in size and complexity, so too does the cost of running enough instances to meet customer needs.

For instance, in both NodeJS and Python applications, they actually suffer a decrease in performance as the codebase size increases. This is why tree-shaking is so important for these languages, and why Nano API gives it to you out of the box!

What's Next? How Do I Get Setup?

Check out the Getting Started Guide to learn how to use Nano API in your project, or start directly with the Simple Math API tutorial. We're excited to see what you build with it!