Architecture
============

# 1. Overview
![ArchOverview](./images/ArchOverview.png)

# 2. Ecosystem
## 2.1 SASDN
A framework based on gRPC & Protobuf.

Developers define Models & Apis using protobuf. SASDN provides a CLI tool to generate service stub codes from protobuf files.
Generated codes can work with gRPC server as Microservices, also can work with Koa framework as ApiGateway.

## 2.2 SPM
This tool is a standalone repo: [SPM](https://github.com/agreatfool/SPM).

Actually it's `SASDN package manager`. This tool is used to manage protobuf definitions generated by all microservices. 
Any microservice can publish it's protobuf definition into the SPM system. And others could install(download) the protobuf to build a complex application.

## 2.3 ApiGateway
Koa application acts as HTTP web server to handle client requests. Developers define RESTful Apis using protobuf, and use CLI tool translate it to swagger json file.
Then use CLI tool generate koa application middleware stub codes for developers to use.

## 2.4 MicroService
gRPC server application acts as Microservice. Multi microservices can get other protobuf definitions using SPM, then build complex application.