vinarmani / jwt-bch-api

A REST API for user management and paying for JWT tokens to access other REST APIs

Home Page:https://psfoundation.cash

Repository from Github https://github.comvinarmani/jwt-bch-apiRepository from Github https://github.comvinarmani/jwt-bch-api

jwt-bch-api

This repository is forked from jwt-bch-api in the PSF repository. It was forked so the Developer Services team can play with the code and evaluate if it's a good fit for our product plan.

This is a prototype REST API webserver written in node.js and using this koa webserver boilerplate app. This prototype back end is intended to be paired with this front end.

This very lightweight API server acts as an auth server. It allows:

  • The creation and management of users.
  • The persistance of user data (models) in a Mongo Database.
  • Users can pay BCH to recieve a JWT token to access a REST API or other web service.
  • REST APIs and web services can quickly query this web server to validate JWT tokens.

Requirements

  • node ^10.15.1
  • npm ^6.7.0

Installation

git clone https://github.com/Permissionless-Software-Foundation/jwt-bch-api
cd jwt-bch-api
npm install
npm start

Structure

├── bin
│   └── server.js            # Bootstrapping and entry point
├── config                   # Server configuration settings
│   ├── env                  # Environment specific config
│   │   ├── common.js
│   │   ├── development.js
│   │   ├── production.js
│   │   └── test.js
│   ├── index.js             # Config entrypoint - exports config according to envionrment and commons
│   └── passport.js          # Passportjs config of strategies
|
├── production               # Dockerfile for build production container
|
├── src                      # Source code
│   ├── lib                  # Business logic libraries
│   ├── modules
│   │   ├── controller.js    # Module-specific controllers
│   │   └── router.js        # Router definitions for module
│   ├── models               # Mongoose models
│   └── middleware           # Custom middleware
│       └── validators       # Validation middleware
└── test                     # Unit tests

Usage

  • npm start Start server on live mode
  • npm run dev Start server on dev mode with nodemon
  • npm run docs Generate API documentation
  • npm test Run mocha tests
  • docker-compose build Build a 'production' Docker container
  • docker-compose up Run the docker container

Documentation

API documentation is written inline and generated by apidoc.

Visit http://localhost:5001/docs/ to view docs

Dependencies

License

MIT

About

A REST API for user management and paying for JWT tokens to access other REST APIs

https://psfoundation.cash

License:MIT License


Languages

Language:JavaScript 97.7%Language:Dockerfile 1.5%Language:Shell 0.7%