- A lightweight, easy to use, and open source, gateway by node.js.
- English | 中文
- Basic
- ✅ oAuth2.0
- ✅ JWT token
- ✅ User, user group, permission management
- ✅ Configurable schedule work
- ✅ Easy to use log search and analysis system
- ✅ Hot reload for production environment
- ✅ System status monitor
- ✅ API monitor (biz, service)
- ✅ Cache monitor
- ✅ Threshold alarm
- Gateway Admin
- ✅ Configurable microservice, HTTP RESTful API
- ✅ Microservice, API router management
- ✅ HTTP proxy
- ✅ Configurable HTTP request header
- ✅ Traffic monitor
- ✅ Configurable AB test
- ✅ Traffic shifting ratio, time, and strategy
- ✅ AB Test monitor
- ✅ Configurable inner service API
- ✅ Configurable microservice, HTTP RESTful API
- User
- ✅ Auth logs
- ✅ Easy to access apps authorized by gateway
- 🧑💻 Unit test
- ✅ Docker & docker-compose Support
- 🧑💻 Enhance accessToken management (for security)
- 🧑💻 Enhance system monitor
- Request response time
- Traffic visualization
- 🧑💻 Enhance gateway
- protocol conversion
- HTTP to gRPC
- HTTP to Dubbo
- SLB (may be)
- protocol conversion
Here is an example of Niko-Gateway based on GitHub oAuth App.
You can implement your own front-end by using the repository Niko-Gateway FE
- Node.js 14.x
- Typescript 4.5+
- MySQL5.7+
- Redis
- An oAuth service
- GitHub oAuth
- Google oAuth
- etc.
git clone --depth 1 https://github.com/legends-killer/niko-gateway.git
note: please use node.js 14.x (16.x or higher are not supported)
nvm install v14.17.5
// or nvm use v14.x
yarn install
yarn niko // init
yarn stop // stop the server after initializing the database
- Copy
./config/config.base.js
to./config/config.local.js
- Follow the instructions in
./config/config.local.js
to configure your development environment - Start the development server
yarn dev
- App will be ready on http://localhost:7001
- Copy
./config/config.base.js
to./config/config.prod.js
- Follow the instructions in
./config/config.prod.js
to configure your production environment - Compile
ts
tojs
:yarn ci
- Start the server:
note: if you havn't initialized the database in your production environment, please run
yarn start
yarn niko
first.
note: It's suggested to use dcoker and docker-compose together.
- update
./Dockerfile
- server port
- log directory
- etc.
- update
./docker-compose.yml
- mysql & redis configs
- persistent volumes
- niko-gateway log directory & port
- http proxy when building
- etc.
See Production Build
yarn ci
- Build the image:
docker-compose build
- Run the images in order:
docker-compose up -d
yarn clean
You can report issues here