2021-04-09 08:39:53 -07:00
# ipfs-service-provider
2021-07-13 10:00:39 -07:00
2021-04-09 08:39:53 -07:00
[](http://standardjs.com) [](https://github.com/semantic-release/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 ](https://github.com/christroutner/koa-api-boilerplate ). It has all the same features as that boilerplate:
- [Koa ](https://koajs.com/ ) framework for REST APIs
- User management
2021-07-13 10:04:34 -07:00
- Access and rate-limit control using [JWT tokens ](https://jwt.io/ ).
2021-04-09 08:39:53 -07:00
2021-07-13 10:04:34 -07:00
This boilerplate extends that code to provide the basic features required to be a 'service provider' on the [IPFS ](https://ipfs.io ) network. See [this article ](https://troutsblog.com/blog/ipfs-api ) if you're new to the concept of service providers on IPFS. These basic features include:
2021-04-09 08:39:53 -07:00
- [ipfs-coord ](https://www.npmjs.com/package/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
2021-07-13 10:00:39 -07:00
This project covers basic necessities of most APIs.
2021-04-09 08:39:53 -07:00
2021-07-13 10:00:39 -07:00
- [Koa ](https://koajs.com/ ) framework for REST APIs
- Authentication (passport & jwt)
- Database (mongoose)
- Testing (mocha)
- Doc generation with apidoc
2021-07-13 10:04:34 -07:00
- Linting using [Standard ](https://github.com/standard/standard )
- Packaged for production environment as a Docker container
- [ipfs-coord ](https://www.npmjs.com/package/ipfs-coord ) for coordinating peers over IPFS
2021-07-13 10:00:39 -07:00
- JSON RPC for mirroring the REST API over IPFS
2021-04-09 08:39:53 -07:00
## Requirements
2021-07-13 10:00:39 -07:00
- node ** ^14.17.0**
- npm ** ^7.13.0**
2021-04-09 08:39:53 -07:00
## Installation
2021-07-13 10:00:39 -07:00
2021-04-09 08:39:53 -07:00
```bash
2021-07-13 10:00:39 -07:00
git clone https://github.com/Permissionless-Software-Foundation/ipfs-service-provider
cd ipfs-service-provider
2021-08-19 07:56:55 -07:00
sudo npm install -g node-pre-gyp
2021-04-09 08:39:53 -07:00
npm install
npm start
```
## Structure
2021-07-13 10:00:39 -07:00
The file layout of this repository differs from the koa-api-boilerplate. Instead, it follows the file layout of [Clean Architecture ](troutsblog.com/blog/clean-architecture ).
2021-04-09 08:39:53 -07:00
## Usage
2021-07-13 10:00:39 -07:00
- `npm start` Start server on live mode
- `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
2021-04-09 08:39:53 -07:00
## Documentation
2021-07-13 10:00:39 -07:00
2021-04-09 08:39:53 -07:00
API documentation is written inline and generated by [apidoc ](http://apidocjs.com/ ).
Visit `http://localhost:5000/docs/` to view docs
## Dependencies
2021-07-13 10:00:39 -07:00
- [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-coord ](https://www.npmjs.com/package/ipfs-coord )
2021-04-09 08:39:53 -07:00
## IPFS
2021-07-13 10:00:39 -07:00
2021-04-09 08:39:53 -07:00
Snapshots pinned to IPFS will be listed here.
## License
2021-07-13 10:00:39 -07:00
[MIT ](./LICENSE.md )