Hiding sub-categories or categories with no dapps (Update to /api/v1/dapp/categories response)

Issue

A common feedback we have got is that there are few sub categories which don’t have any dApps. Showing such sub categories lead to a poor user experience.

Example of such a situation from Meroku Explorer

Solution

In order to fix this, we are updating the response of /api/v1/dapp/categories that does following

  1. Show only categories/sub categories that have at least 1 app
  2. This is configurable on a global or per store level.

The update is backwards compatible, and will not break any existing dApp Store implementation.

The current response of /api/v1/dapp/categories is in a format below

{
  "message": "string",
  "data": [
    {
      "category": "string",
      "subcategory": [
        "string"
      ]
    }
  ]
}

The Updates includes

  1. Adding a storekey param to the API. Passing your dAppStore name will return the response specific to your app store context
  2. Adding new fields

Updated response schema

{
  "message": "string",
  "data": [
    {
      "category": "string",
      "count": 0,
      "subcategory": [
        "string"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "string",
          "count": 0
        }
      ]
    }
  ]
}

The response will only include those categories and sub categories which have at least 1 app in them.

Example the current response for global will be

The updated response is

{
  "status": 200,
  "message": [
    "success"
  ],
  "total": 3644,
  "data": [
    {
      "category": "finance",
      "count": 1026,
      "subCategory": [
        "defi",
        "others",
        "exchanges",
        "ramp",
        "payments",
        "tooling",
        "airdrop-tool",
        "insurance",
        "lending-and-borrowing",
        "liquid-staking",
        "price-aggregator"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "defi",
          "count": 463
        },
        {
          "subCategory": "others",
          "count": 60
        },
        {
          "subCategory": "exchanges",
          "count": 28
        },
        {
          "subCategory": "ramp",
          "count": 9
        },
        {
          "subCategory": "payments",
          "count": 6
        },
        {
          "subCategory": "tooling",
          "count": 2
        },
        {
          "subCategory": "airdrop-tool",
          "count": 1
        },
        {
          "subCategory": "insurance",
          "count": 1
        },
        {
          "subCategory": "lending-and-borrowing",
          "count": 1
        },
        {
          "subCategory": "liquid-staking",
          "count": 1
        },
        {
          "subCategory": "price-aggregator",
          "count": 1
        }
      ]
    },
    {
      "category": "games",
      "count": 594,
      "subCategory": [
        "metaverse",
        "strategy",
        "action",
        "studios",
        "simulation"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "metaverse",
          "count": 54
        },
        {
          "subCategory": "strategy",
          "count": 6
        },
        {
          "subCategory": "action",
          "count": 4
        },
        {
          "subCategory": "studios",
          "count": 3
        },
        {
          "subCategory": "simulation",
          "count": 1
        }
      ]
    },
    {
      "category": "lifestyle",
      "count": 524,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "utilities",
      "count": 493,
      "subCategory": [
        "wallets",
        "browsers"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "wallets",
          "count": 87
        },
        {
          "subCategory": "browsers",
          "count": 4
        }
      ]
    },
    {
      "category": "nft",
      "count": 472,
      "subCategory": [
        "nft-marketplaces",
        "domain-names",
        "tooling",
        "art",
        "pfps"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "nft-marketplaces",
          "count": 44
        },
        {
          "subCategory": "domain-names",
          "count": 3
        },
        {
          "subCategory": "tooling",
          "count": 3
        },
        {
          "subCategory": "art",
          "count": 2
        },
        {
          "subCategory": "pfps",
          "count": 1
        }
      ]
    },
    {
      "category": "developer-tools",
      "count": 249,
      "subCategory": [
        "developer-infra",
        "identity",
        "bridges",
        "analytics",
        "indexer",
        "oracle",
        "discovery-tool",
        "payments"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "developer-infra",
          "count": 227
        },
        {
          "subCategory": "identity",
          "count": 6
        },
        {
          "subCategory": "bridges",
          "count": 4
        },
        {
          "subCategory": "analytics",
          "count": 2
        },
        {
          "subCategory": "indexer",
          "count": 2
        },
        {
          "subCategory": "oracle",
          "count": 2
        },
        {
          "subCategory": "discovery-tool",
          "count": 1
        },
        {
          "subCategory": "payments",
          "count": 1
        }
      ]
    },
    {
      "category": "social-networking",
      "count": 76,
      "subCategory": [
        "messaging",
        "social-media"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "messaging",
          "count": 27
        },
        {
          "subCategory": "social-media",
          "count": 8
        }
      ]
    },
    {
      "category": "productivity",
      "count": 72,
      "subCategory": [
        "decentralized-collaboration-tools",
        "decentralized-collaboration-tools-tools"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "decentralized-collaboration-tools",
          "count": 71
        },
        {
          "subCategory": "decentralized-collaboration-tools-tools",
          "count": 1
        }
      ]
    },
    {
      "category": "business",
      "count": 70,
      "subCategory": [
        "decentralized-business-tools",
        "human-resources"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "decentralized-business-tools",
          "count": 1
        },
        {
          "subCategory": "human-resources",
          "count": 1
        }
      ]
    },
    {
      "category": "shopping",
      "count": 51,
      "subCategory": [
        "ecommerce"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "ecommerce",
          "count": 1
        }
      ]
    },
    {
      "category": "education",
      "count": 12,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "books",
      "count": 3,
      "subCategory": [
        "audiobooks"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "audiobooks",
          "count": 1
        }
      ]
    },
    {
      "category": "entertainment",
      "count": 2,
      "subCategory": [
        "music",
        "music-streaming"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "music",
          "count": 1
        },
        {
          "subCategory": "music-streaming",
          "count": 1
        }
      ]
    }
  ]
}

In this case, you see that all the sub categories of finance are mentioned ex: defi, others, exchanges and so on…

For a specific appStore this may look like below

curl --request GET \
  --url 'https://api-a.meroku.store/api/v1/dapp/categories?storeKey=APP_STORE_KEY' \
  --header 'Accept: application/json' \
  --header 'apikey: YOUR_API_KEY'
{
  "status": 200,
  "message": [
    "success"
  ],
  "total": 34,
  "data": [
    {
      "category": "finance",
      "count": 20,
      "subCategory": [
        "defi",
        "price-aggregator"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "defi",
          "count": 17
        },
        {
          "subCategory": "price-aggregator",
          "count": 1
        }
      ]
    },
    {
      "category": "developer-tools",
      "count": 6,
      "subCategory": [
        "developer-infra"
      ],
      "subCategoriesWithCount": [
        {
          "subCategory": "developer-infra",
          "count": 6
        }
      ]
    },
    {
      "category": "nft",
      "count": 2,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "shopping",
      "count": 2,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "business",
      "count": 1,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "education",
      "count": 1,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "lifestyle",
      "count": 1,
      "subCategory": [],
      "subCategoriesWithCount": []
    },
    {
      "category": "utilities",
      "count": 1,
      "subCategory": [],
      "subCategoriesWithCount": []
    }
  ]
}

This this example you notice that the finance category has only defi and price-aggregator as the sub categories.

What do you need to change?

  1. As a dApp Store you will need to pass your storekey in the storekey param.
  2. If you want to show the count of apps then you need to start referencing the subCategoriesWithCount field.

Let us know if you have any feedback or questions in the comment below.