- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
build Command - Medusa CLI Reference
Create a standalone build of the Medusa application.
This creates a build that:
- Doesn't rely on the source TypeScript files.
- Can be copied to a production server reliably.
The build is outputted to a new .medusa/server
directory.
Refer to this section for next steps.
Options#
Option | Description |
---|---|
| Whether to only build the admin to host it separately. If this option is not passed, the admin is built to the |
Run Built Medusa Application#
After running the build
command, use the following step to run the built Medusa application:
- Change to the
.medusa/server
directory and install the dependencies:
- When running the application locally, make sure to copy the
.env
file from the root project's directory. In production, use system environment variables instead.
- In the system environment variables, set
NODE_ENV
toproduction
:
- Use the
start
command to run the application:
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 standalone, 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.