Installation
This guide covers all methods for installing and setting up a Medusa project, from the automated CLI to manual installation.Method 1: Using create-medusa-app (Recommended)
The fastest way to get started is withcreate-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:| Option | Description |
|---|---|
--seed | Seed database with demo products |
--skip-db | Skip database creation |
--db-url <url> | PostgreSQL connection string |
--no-migrations | Skip database migrations |
--no-browser | Don’t open admin in browser |
--use-npm | Use npm as package manager |
--use-yarn | Use yarn as package manager |
--use-pnpm | Use pnpm as package manager |
--directory-path <path> | Installation directory |
--verbose | Show detailed logs |
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
Createmedusa-config.ts in your project root:
medusa-config.ts
.env file:
.env
tsconfig.json:
tsconfig.json
Step 7: Add Scripts to package.json
Update yourpackage.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
http://localhost:9000!
Database Setup
PostgreSQL Installation
- macOS
- Ubuntu/Debian
- Windows
- Docker
Using Homebrew:Create database:
Database Connection String Format
Installing Providers
Providers extend Medusa modules with specific implementations.Payment Providers
medusa-config.ts:
medusa-config.ts
File Storage Providers
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
Inmedusa-config.ts:
Environment Variables
Required Variables
.env
Optional Variables
.env
Verification
After installation, verify everything works:1. Check Server Health
2. Test API
3. Access Admin
Openhttp://localhost:9000/app in your browser.
4. Check Database Connection
Troubleshooting
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