Nocto Config

Nocto use configuration file called Nocto Config.

Nocto Config Concept

Nocto needs to know how, what and where to render UI elements. For that purpose, Nocto uses a file - nocto-config.ts.

If you already installed Nocto using CLI setup, this file will be available for you in your project.

Structure

import { NoctoConfig } from "@rsc-labs/noctojs-plugin-system"

export const noctoConfig: NoctoConfig = {
  plugins: {
    "<plugin-id>": {
      config: {
        <parameter-name>: <parameter-value>
      }
    },
    "<plugin-id-2>": {},
  },
  sidebar: {
    "plugin-id-2": { order: 1 },
    "plugin-id-3": { order: 2 },
  }
}

Plugins

This part is responsible for enabling and configuring plugins. Every entry starts with plugin ID - it is unique ID across whole Nocto application. For consistency, all defaults (core) plugins (like orders, products etc) starts with @ (e.g. @orders). If you are developing your own plugins - you are totally free with choosing a name, but remember - it needs to be unique.

If plugin exposes configuration (see more: Expose configuration), then you are able to configure it using config. It takes parameter-name and parameter-value.

Configuring plugins:

More about how to configure plugins using nocto-config.ts can be found here: Nocto configuration

Sidebar part is also used for enabling plugins, but also for configuring sidebar. If plugin defines sidebar in its own definition, then it can be put in sidebar section. You shall also use order parameter to define where to put such item.

Default plugins:

When using CLI, application is created with already configured nocto-config.ts. It is needed to have app working - for instance without @login plugin, you won't see login page. However, you are totally free what plugins you would like to have enabled.

Example

Here is the nocto-config.ts generated by the CLI:

import { NoctoConfig } from "@rsc-labs/noctojs-plugin-system"
import {
  Sparkles,
} from "@medusajs/icons"

export const noctoConfig: NoctoConfig = {
  plugins: {
    "@login": {
      config: {
        title: "Welcome to Nocto",
        hint: "Sign in to access",
        mainIcon: Sparkles
      }
    },
    "@orders": {},
    "@order-detail": {},
    "@campaigns-routes": {},
    "@categories-routes": {},
    "@collections-routes": {},
    "@core-routes": {},
    "@customer-groups-routes": {},
    "@public-routes": {},
    "@reservations-routes": {},
    "@settings-routes": {}
  },
  sidebar: {
    "@orders": { order: 1 },
    "@products": { order: 2 },
    "@inventory": { order: 3 },
    "@customers": { order: 4 },
    "@promotions": { order: 5 },
    "@price-lists": { order: 6 },
  }
}