npm.io
2.22.7 • Published 4d ago

@medusajs/medusa

Licence
SEE LICENSE IN LICENSE
Version
2.22.7
Deps
72
Size
3.5 MB
Vulns
0
Weekly
0
Stars
36.8K

Medusa logo

@medusajs/medusa

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

@medusajs/medusa is the core Medusa application package: the commerce server with its Store, Admin, and Auth API routes, the implementations of the medusa CLI commands, and all default commerce and infrastructure modules. Every Medusa application depends on it, and modules are registered from it by their @medusajs/medusa/<module> path (for example, @medusajs/medusa/cart).

At a glance

Package @medusajs/medusa
Type Core library
Import from @medusajs/medusa/<module> for modules and providers, @medusajs/medusa/core-flows for workflows
Entry points ./<module>, ./core-flows, ./api/*, ./commands/*, ./subscribers/*, ./jobs/*, ./loaders/*, ./feature-flags/*, ./types, ./utils

Features

  • Commerce server: Express-based HTTP server with the Store API (/store), Admin API (/admin), Auth API (/auth), and webhook routes (/hooks).
  • CLI commands: implementations of develop, start, build, exec, user, lint, db:*, and plugin:*, run through the medusa binary from @medusajs/cli.
  • Default modules: re-exports every official module and provider (Cart, Product, Order, Payment, Auth, File, Event Bus, Workflow Engine, and more) at @medusajs/medusa/<name>, so they need no separate install.
  • Workflows: re-exports @medusajs/core-flows at @medusajs/medusa/core-flows.

Installation

Create a new Medusa application, which installs this package along with @medusajs/framework and @medusajs/cli:

npx create-medusa-app@latest my-medusa-store

Requires Node.js >=22.22.0.

Usage

Register a module or provider shipped with this package by its @medusajs/medusa/<name> path in medusa-config.ts:

import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  projectConfig: {
    databaseUrl: process.env.DATABASE_URL,
  },
  modules: [
    {
      resolve: "@medusajs/medusa/file",
      options: {
        providers: [
          {
            resolve: "@medusajs/medusa/file-s3",
            id: "s3",
            options: {
              // ...
            },
          },
        ],
      },
    },
  ],
})

Run the server with the Medusa CLI:

npx medusa develop

Resources