Rest API generator for the Convector Framework
Last updated 7 months ago by dianjuar .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @apexsupplychain/asc-conv-rest-api 
SYNC missed versions from official npm registry.


This project is under development and will soon be integrated into the Convector CLI.

This project aims to provide an easy way for generating automatically client API for Convector projects.

How to use

To generate an API, you first need a Convector CLI generated project. Since the conv-rest-api is based on the Convector CLI standards and conventions, so manually projects generated may not work with it.

In the root of your project create a json file called api.json. This structure will map the smart contract to the Express API.

        "function": "<function-name>",
        "controller": "<controller-class-name>",
        "verb": "get|post|put|delete"


If your smart contract project has the following structure:

  • ./packages/participants/src/participant.controller.ts
  • ./packages/person/src/person.controller.ts

And the controller files look like this:


export class ParticipantController extends ConvectorController {
  get fullIdentity(): ClientIdentity {
    const stub = (BaseStorage.current as any).stubHelper;
    return new ClientIdentity(stub.getStub());

  public async register(
    id: string,
    name: string,
  ) {


export class PersonController extends ConvectorController<ChaincodeTx> {
  public async getone(
    id: string) {
        // ...
  public async create(
    person: Person
  ) {
      // ...

Then your api.json

        "function": "register",
        "controller": "ParticipantController"
        "function": "create",
        "verb": "post",
        "controller": "PersonController"
        "function": "getone",
        "verb": "get",
        "controller": "PersonController"

Once that's ready, globally install the conv-rest-api util and generate your API!

Beware that it will remove and recreate a folder in your root ./packages/ folder called server.

npm i -g @worldsibu/conv-rest-api

# Inside your Convector CLI generated project's root
conv-rest-api generate api -c <chaincode-project-name> -f ./<chaincode-config-file>
# I.e.: conv-rest-api generate api -c person -f ./org1.person.config.json

# Compile everything
[npx] lerna bootstrap

# Start the server
[npx] lerna run start --scope server --stream


  • For recommendations, feature requests, or bugs go to our issues section.
  • News on Convector, subscribe to our Newsletter.
  • Need support? Chat directly with our team and the growing community, join our Discord.


Special thanks to Luca Tamburrano for starting this amazingly useful project for the community.

Current Tags

  • 0.1.5-next.0                                ...           latest (7 months ago)
  • 0.1.5-next.1                                ...           next (7 months ago)

2 Versions

  • 0.1.5-next.1                                ...           7 months ago
  • 0.1.5-next.0                                ...           7 months ago
Maintainers (2)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 4
Dependencies (20)
Dev Dependencies (10)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |