Plugins
Nocto introduces its own concept of plugins.
Nocto Plugin Concept
Nocto uses different way of handling plugins than Medusa. For instance, instead of having predefined directory where you can create plugin, Nocto gives you a freedom how you are structuring your plugins.
Medusa plugins:
To not have any mismatch, Nocto stops using Medusa plugins. To have Medusa plugin working in Nocto, you need to migrate it. Instruction will be available soon.
Every Nocto plugin can have different functionality - you can for instance introduce plugin as sidebar item, or you can just create totally new page with a new route. What is more - you do not have introduce two plugins in such scenario, you are just defining one plugin with different functionalities.
Here is the example of plugin which registers the new sidebar item with new routes.
import { ErrorBoundary } from "../../../components/utilities/error-boundary"
import { t } from "i18next"
import { RouteEntry } from "@rsc-labs/noctojs-plugin-system"
import { ShoppingCart } from "@medusajs/icons"
import { z } from "zod"
export const sidebarOrders = {
id: "@orders",
sidebar: {
path: "/orders",
label: "Orders",
icon: ShoppingCart,
},
routes: (): RouteEntry[] => [
{
path: "/orders",
layout: "main",
errorElement: <ErrorBoundary />,
handle: {
breadcrumb: () => t("orders.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../../routes/orders/order-list").then((mod) => ({
Component: () => <mod.Component/>,
})),
layout: "main"
},
],
}
]
}
Above plugin registers new route under /orders
which leds to order-list
. Additionally, it registers new sidebar item with the name Orders
and icon ShoppingCart
.
It is still simple version of plugin - more advanced concepts are described in separated section - Create plugin
Creation of plugin is not enough - you need to enable it. Such functionality comes from the fact that you can have dozens of plugins, but you would like to have only couple of them working (for instance, you would like to hide Products
sidebar item).
Here is where Nocto Config concept appears - you can read about it in the next section.