Skip to main content

Installation

This guide covers all methods for installing and setting up a Medusa project, from the automated CLI to manual installation. The fastest way to get started is with create-medusa-app, which handles project scaffolding, database setup, and initial configuration.

Prerequisites

  • Node.js 20 or higher
  • PostgreSQL 13 or higher
  • npm, yarn, or pnpm

Installation

See the Quickstart guide for detailed walkthrough of create-medusa-app.

With Options

Customize your installation with command-line options:
Available options:

Method 2: Manual Installation

For more control over the setup process, you can install Medusa packages manually.

Step 1: Create Project Directory

Step 2: Initialize Package Manager

Step 3: Install Core Packages

Install the Medusa framework and required dependencies:

Step 4: Install Commerce Modules

Add the commerce modules you need:
You can install only the modules you need. See the Commerce Modules documentation for the complete list.

Step 5: Install Development Dependencies

Step 6: Create Configuration Files

Create medusa-config.ts in your project root:
medusa-config.ts
Create .env file:
.env
Create tsconfig.json:
tsconfig.json

Step 7: Add Scripts to package.json

Update your package.json with these scripts:
package.json

Step 8: Create Source Directory

Create the basic directory structure:

Step 9: Initialize Database

Run database migrations:

Step 10: Start Development Server

Your Medusa application is now running at http://localhost:9000!

Database Setup

PostgreSQL Installation

Using Homebrew:
Create database:

Database Connection String Format

Example:
With SSL (for hosted databases):

Installing Providers

Providers extend Medusa modules with specific implementations.

Payment Providers

Configure in medusa-config.ts:
medusa-config.ts

File Storage Providers

Configure in medusa-config.ts:
medusa-config.ts

Notification Providers

Admin Dashboard Setup

The admin dashboard is included by default. To customize:

Install Admin SDK

Build Admin for Production

Configure Admin Path

In medusa-config.ts:

Environment Variables

Required Variables

.env

Optional Variables

.env

Verification

After installation, verify everything works:

1. Check Server Health

Expected response:

2. Test API

3. Access Admin

Open http://localhost:9000/app in your browser.

4. Check Database Connection

Troubleshooting

“Cannot find module @medusajs/framework”Ensure all packages are installed:
“Database connection failed”Verify PostgreSQL is running and credentials are correct:
“Port 9000 is already in use”Change the port in your .env:
Or kill the process using the port:

Next Steps

Quickstart

Follow the quickstart guide for your first steps

Architecture

Understand Medusa’s architecture and design

API Routes

Learn to create custom API endpoints

Commerce Modules

Explore all available commerce modules