Creating a content type programatically and adding a component and a relation to it's attributes

System Information
  • Strapi Version: 4.10.5
  • Operating System: Windows 11
  • Database: SQLite
  • Node Version: 16.18.1
  • NPM Version: 8.19.2
  • Yarn Version:

I want to create a content type that has a banner component and a relation to another table.
I’m trying to do this in my plugin’s bootstrap function.

This is my code so far:

    try {
      const parentMenuType = await strapi.plugin('content-type-builder').services['content-types'].createContentType({
        contentType: parentMenu,
        components: [
            category: 'menu',
            attributes: banner.attributes,
            category: 'menu',

      console.log('parentMenuType', JSON.stringify(parentMenuType));

    } catch (e) {
      console.log("ERROR \n", e);

parentMenu, banner, children are JSON schemas.

Any clue on how to go about this?