Skip to content

Commit

Permalink
Customized README and package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
christroutner committed Nov 25, 2020
1 parent c2088b3 commit 71ec030
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 165 deletions.
115 changes: 3 additions & 112 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,116 +1,7 @@
# koa-api-boilerplate
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com) [![Coverage Status](https://coveralls.io/repos/github/christroutner/babel-free-koa2-api-boilerplate/badge.svg?branch=unstable)](https://coveralls.io/github/christroutner/babel-free-koa2-api-boilerplate?branch=unstable) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Greenkeeper badge](https://badges.greenkeeper.io/christroutner/koa-api-boilerplate.svg)](https://greenkeeper.io/)
# VIP Bot
This repository is forked from [koa-api-boilerplate](https://github.com/christroutner/koa-api-boilerplate). It creates a REST API server that also functions as Telegram bot. The purpose of the bot is to manage a Telegram channel. The purpose of the channel is to be a VIP (very important person) room, which is publically viewable, but anyone who wants to speak must prove that they own a certain number of [PSF tokens](https://psfoundation.cash).


This repository is a boilerplate for building APIs with
[koa2](https://github.com/koajs/koa/tree/v2.x) and Mongo DB.
This repository was originally forked from Adrian Obelmejias'
[koa-api-boilerplate repository](https://github.com/adrianObel/koa2-api-boilerplate).
It makes the following modifications:

- Removes babel as a dependency. This repository is now naively compatible with
node v8.9 or higher.

- Replaced `bcrypt` dependency with `bcryptjs`. This improves compatibility across
versions of node.js and across OSs.

- Configured for Jenkins (continuous integration), Coveralls (code coverage), Green Keeper (automated dependency management), and Semantic Release (automated versioning).

- 'Production' environment is targeted for packaging as a Docker container.

- 'admin' user type added in addition to standard 'user' type. Allows the creation
of private vs public APIs that only be accessed by an admin. Useful for privileged
commands like updating and deleting other users.

- Winston logging integrated for daily rotated logs and a maximum size of
1 megabyte.

- Linting enforced with [Husky](https://github.com/typicode/husky) and [JavaScript Standard Style rules](https://www.npmjs.com/package/standard).

## Features
This project covers basic necessities of most APIs.
* Authentication (passport & jwt)
* Database (mongoose)
* Testing (mocha)
* Doc generation with apidoc
* Linting using standard
* Packaged as a Docker container



## Requirements
* node __^10.15.1__
* npm __^6.7.0__

## Installation
```bash
git clone https://github.com/christroutner/koa-api-boilerplate
cd koa-api-boilerplate
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](http://apidocjs.com/).

Visit `http://localhost:5000/docs/` to view docs


## Dependencies
* [koa2](https://github.com/koajs/koa/tree/v2.x)
* [koa-router](https://github.com/alexmingoia/koa-router)
* [koa-bodyparser](https://github.com/koajs/bodyparser)
* [koa-generic-session](https://github.com/koajs/generic-session)
* [koa-logger](https://github.com/koajs/logger)
* [MongoDB](http://mongodb.org/)
* [Mongoose](http://mongoosejs.com/)
* [Passport](http://passportjs.org/)
* [Nodemon](http://nodemon.io/)
* [Mocha](https://mochajs.org/)
* [apidoc](http://apidocjs.com/)
* [ESLint](http://eslint.org/)

## IPFS
v2.3.0 uploaded to IPFS:

- Get it: `ipfs get QmUz4b2KwNLNvHZRTYcgrPCuKAhMB73XWN8vY8LLVVEYV1`
- Pin it: `ipfs pin add -r QmUz4b2KwNLNvHZRTYcgrPCuKAhMB73XWN8vY8LLVVEYV1`
If you don't prove to the bot that you own the tokens by signing a message, then any message you write will be immediately deleted. Once you've certified with the bot, you'll be allowed to talk in the channel.

## License
MIT

test
2 changes: 1 addition & 1 deletion config/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const common = require('./env/common')

const env = process.env.KOA_ENV || 'development'
const env = process.env.BOT_ENV || 'development'
const config = require(`./env/${env}`)

module.exports = Object.assign({}, common, config)
82 changes: 47 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
{
"name": "koa-api-boilerplate",
"version": "3.0.0",
"description": "Koa2 boilerplate covering essentials for REST API and auth.",
"name": "vip-bot",
"version": "1.0.0",
"description": "A Telegram bot for a VIP room using SLP tokens",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "export KOA_ENV=test && npm run prep-test && nyc --reporter=text mocha --exit --timeout 15000 test/unit/",
"test": "export BOT_ENV=test && npm run prep-test && nyc --reporter=text mocha --exit --timeout 15000 test/unit/",
"lint": "standard --env mocha --fix",
"docs": "./node_modules/.bin/apidoc -i src/ -o docs",
"coverage": "export KOA_ENV=test && npm run prep-test && nyc report --reporter=text-lcov | coveralls",
"coverage:report": "export KOA_ENV=test && npm run prep-test && nyc --reporter=html mocha --exit --timeout 15000 test/unit/",
"coverage": "export BOT_ENV=test && npm run prep-test && nyc report --reporter=text-lcov | coveralls",
"coverage:report": "export BOT_ENV=test && npm run prep-test && nyc --reporter=html mocha --exit --timeout 15000 test/unit/",
"prep-test": "node util/users/delete-all-test-users.js"
},
"keywords": [
"koa-api-boilerplate",
"api",
"koa",
"koa2",
"boilerplate",
"es6",
"mongoose",
"passportjs",
"apidoc"
"telegram",
"bot",
"Bitcoin Cash",
"BCH",
"SLP",
"tokens"
],
"author": "Chris Troutner <[email protected]>",
"license": "MIT",
"apidoc": {
"title": "koa-api-boilerplate",
"title": "vip-bot",
"url": "localhost:5000"
},
"repository": "christroutner/koa-api-boilerplate",
"repository": "christroutner/vip-bot",
"dependencies": {
"apidoc": "^0.23.0",
"axios": "^0.19.2",
Expand Down

0 comments on commit 71ec030

Please sign in to comment.