build Command - Medusa CLI Reference

Create a standalone build of the Medusa application that you can deploy to production.

This creates a build that:

  • Doesn't rely on the source TypeScript files.
  • Can be copied to a production server reliably.

The build is output to a new .medusa/server directory.

Refer to the Build Medusa Application guide for next steps.

Options#

Option

Description

Default

--admin-only

Whether to build only the admin to host it separately. If this option is not passed, the admin is built to the .medusa/server/public/admin directory. When this option is passed, the admin is built to the .medusa/admin directory instead.

false

--lint / --no-lint (v2.16.0+)

Run the Medusa linter before building. Pass --no-lint to skip linting. Enabled by default only when @medusajs/eslint-plugin is installed in the project. Linting is also skipped automatically when no eslint.config.js is found in the project root.

true when @medusajs/eslint-plugin is installed, false otherwise

--fix (v2.16.0+)

Auto-fix lint issues where possible before building.

false

--quiet (v2.16.0+)

Report lint errors only, suppressing warnings.

false


Build Medusa Admin#

By default, the Medusa Admin is built to the .medusa/server/public/admin directory.

If you want a separate build to host the admin as a standalone application, such as on Vercel, pass the --admin-only option as explained in the Options section. This outputs the admin to the .medusa/admin directory instead.

By default, the Medusa Admin dashboard is hosted at the /app path. You can change it with the admin.path configuration in medusa-config.ts.

For example, to serve it from the root path / when hosting on a separate domain:

medusa-config.ts
1module.exports = defineConfig({2  admin: {3    path: "/",4    backendUrl: process.env.MEDUSA_BACKEND_URL,5  },6  // ...7})

The admin will now run at / of your application. For example, at acme.com.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Medusa MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵