on GitHub" data-tooltip-id=":Rblcldtb:">v2.6·
In this chapter, you'll learn how to create a production build of your Medusa application to be deployed to a hosting provider.
Next chapters explain how to deploy the Medusa application.
The Medusa CLI tool has a build command which creates a standalone build of the Medusa application that:
So, to create the production build, run the following command in the root of your Medusa application:
The build
command outputs the production build in the .medusa/server
directory, and the admin dashboard build in the .medusa/server/public/admin
.
The build
command accepts a --admin-only
option that outputs the admin to the .medusa/admin
directory. This is useful when deploying the admin dashboard separately, such as on Vercel:
To start the Medusa application after running the build
command:
.medusa/server
directory and install the dependencies:.env
file from the root project's directory. In production, use system environment variables instead.NODE_ENV=production
, the Medusa application loads the environment variables from .env.production
. Learn more about environment variables in this guide.NODE_ENV
to production
in the system environment variable, then start the Medusa application from .medusa/server
:The next chapter covers how you generally deploy the production build.
You can also refer to the deployment how-to guides for platform-specific how-to guides.