Skip to content
/ niko-gateway Public template

A lightweight gateway server written by node.js

License

Notifications You must be signed in to change notification settings

legends-killer/niko-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Niko-Gateway

example workflow codebeat badge GitHub license GitHub issues GitHub stars

avatar

  • A lightweight, easy to use, and open source, gateway by node.js.
  • English | 中文

Features

  • 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
  • User
    • ✅ Auth logs
    • ✅ Easy to access apps authorized by gateway

What's Next

  • 🧑‍💻 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)

Example

Here is an example of Niko-Gateway based on GitHub oAuth App.

Example Instructions

Work with Niko-Gateway FE

You can implement your own front-end by using the repository Niko-Gateway FE

Quick Start

Requirement

Clone the repository

git clone --depth 1 https://github.com/legends-killer/niko-gateway.git

Install Node.js

note: please use node.js 14.x (16.x or higher are not supported)

nvm install v14.17.5
// or nvm use v14.x

Install dependencies

yarn install

Initialize the database

yarn niko // init
yarn stop // stop the server after initializing the database

For Development

  • 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

For Production

  • 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 to js:
    yarn ci
  • Start the server:
    yarn start
    note: if you havn't initialized the database in your production environment, please run yarn niko first.

Use Dcoker And Docker-compose

note: It's suggested to use dcoker and docker-compose together.

Customize Niko-Gateway Dcoker Image

  • update ./Dockerfile
    • server port
    • log directory
    • etc.

Customize Docker-compose

  • update ./docker-compose.yml
    • mysql & redis configs
    • persistent volumes
    • niko-gateway log directory & port
    • http proxy when building
    • etc.

Config Niko-Gateway

See Production Build

Compile TS to JS (important)

  • yarn ci

Build & Run

  • Build the image:
    docker-compose build
  • Run the images in order:
    docker-compose up -d

Clean up JS Files

  • yarn clean

Issue

You can report issues here

License

MIT

About

A lightweight gateway server written by node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages