2019-02-07 17:26:37 -08:00
2021-04-07 18:42:27 -07:00
2019-05-20 20:45:01 -07:00
2021-04-08 09:31:38 -07:00
2021-02-04 15:44:12 -08:00
2016-02-11 14:28:00 -05:00
2021-02-04 17:29:02 -08:00
2021-03-30 09:49:17 -07:00

ipfs-service-provider

js-standard-style semantic-release

This is a 'boilerplate' repository. It's intended to be forked to start new projects. This repository has been forked from the koa-api-boilerplate. It has all the same features as that boilerplate:

  • Koa framework for REST APIs
  • User management
  • Access control using JWT tokens.

This boilerplate extends that code to provide the basic features required to be a 'service provider' on the IPFS network. See this article if you're new to the concept of service provides on IPFS. These basic features include:

  • ipfs-coord for coordinating service providers and consumers across the IPFS network.
  • JSON RPC for creating an API between providers and consumers.

If you are interested in creating your own service provider on the IPFS network, fork this repository and start building.

Features

This project covers basic necessities of most APIs.

  • Koa framework for REST APIs
  • Authentication (passport & jwt)
  • Database (mongoose)
  • Testing (mocha)
  • Doc generation with apidoc
  • Linting using standard
  • Packaged as a Docker container
  • ipfs-coord
  • JSON RPC for mirroring the REST API over IPFS

Requirements

  • node ^10.15.1
  • npm ^6.7.0

Installation

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
|   ├── rpc                  # JSON RPC over IPFS
│   ├── 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:5000/docs/ to view docs

Dependencies

IPFS

Snapshots pinned to IPFS will be listed here.

License

MIT

Languages
JavaScript 97.6%
Dockerfile 1.2%
Shell 0.7%
HTML 0.5%