Skip to content

Install Core

Install Core in your Medusa application, see what changes in the Admin, then connect your storefront.

Prerequisites

You need a working Medusa application. If you haven’t created one yet, follow Create Medusa App. Check the supported versions before installing.

1. Install and register Core

Install the package

In your Medusa application directory, run:

Terminal
npm install @mantajs/core

Register Core

In medusa-config.ts, add Core to the plugins array inside defineConfig. Create the array if needed and keep your other entries. Core has no mandatory configuration options. The excerpt below shows where it belongs; merge it into your existing configuration.

medusa-config.ts
// medusa-config.ts
import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  // Keep your existing application configuration here.
  plugins: [
    // Keep your other plugins here.
    { resolve: "@mantajs/core", options: {} },
  ],
})

Run the migrations

Before the first migration of an existing database, back it up, restore it in isolation and test the migration on that copy. Preserve the application configuration and other plugins.

Create Core’s tables and module links:

Terminal
npx medusa db:migrate

Core supplies the private b2b_company index for the Companies directory. Medusa 2.23.1 enables PostgreSQL Search by default: normal db:migrate creates the index, then shared/worker startup fills it in the background. No additional Core-specific configuration or first-install reindex script is required. Keep Search enabled and check initialization errors; disabling it breaks the directory. This private Admin index must not be exposed through Store.

2. Build and start

Build the application, then start the development server:

Terminal
npx medusa build
npx medusa develop

Open your usual Medusa Admin URL (http://localhost:9000/app with the default local setup) and sign in. Core’s company pages, such as Companies, appear in the Admin menu. Dashboard organises these entries according to the commerce mode.

What changes in the Medusa Admin

Core’s company pages, such as Companies, appear in the Admin menu. Dashboard organises these entries according to the commerce mode. Native order lists and exports show personal orders; use Core’s company order entries for business purchases.

Changes to native Medusa routes

Use Manta Dashboard (optional)

Create your first company order

The Quickstart walks you through creating a company, adding a buyer and placing its first order.

Follow the first company order walkthrough

Connect your storefront

In your storefront, let the signed-in customer choose a company they belong to. Use Core’s company routes to create and manage that company’s cart; the server checks the customer’s active buyer membership. Keep the native Medusa Store routes for personal purchases.

Store API: company carts and orders