create-medusa-app CLI Tool

The create-medusa-app CLI tool simplifies the process of creating a new Medusa project and provides an onboarding experience.

Usage#

Terminal
npx create-medusa-app@latest

Command Options#

OptionDescriptionDefault

--repo-url <url>

The repository URL to create the project from.

https://github.com/medusajs/medusa-starter-default

--seed

Whether to seed the database with demo data.

false

--no-browser

Disables opening the browser at the end of the project creation and only shows success message.

false

--skip-db

Skips creating the database, running migrations, and seeding, and subsequently skips opening the browser. Useful if you want to set the database URL with the --db-url option.

false

--db-url <url>

Skips database creation and sets the database URL to the provided URL. Throws an error if connection to the database fails. Will still run migrations and open the admin after project creation. Useful if you already have a database created, locally or remotely.

-

--no-migrations

Skips running migrations, creating admin user, and seeding. If used, it's expected that you pass the --db-url option with a URL of a database that has all necessary migrations. Otherwise, unexpected errors will occur. Helpful only if combined with --db-url.

false

--directory-path <path>

Allows specifying the parent directory path to create the directory of the new project in.

The current directory the command is running in.

--with-nextjs-starter

Installs the Next.js Starter storefront under the {project-name}-storefront directory, where {project-name} is the name of the project you enter in the first question. If the {project-name}-storefront directory already exists, random characters are added at the end of it.

false

--verbose

Shows detailed logs. Useful when you're reporting an issue with the tool.

false

--v2

Installs Medusa v2, which is still not ready for production.

false

Examples#

Connect to a Vercel PostgreSQL Database#

To use a PostgreSQL database hosted on Vercel, use the --db-url option and add to the end of your connection URL ?sslmode=require. For example:

Terminal
npx create-medusa-app@latest --db-url "postgres://default:<password><host-region>.postgres.vercel-storage.com:5432/verceldb?sslmode=require"
NoteIf the database already has the necessary migrations and you don't need the command to run migrations, you can pass the --no-migrations option.

Connect to a Supabase Database#

To connect to a Supabase database, use the --db-url option with its value being the connection URL to your Supabase database. For example:

Terminal
npx create-medusa-app@latest --db-url "postgres://postgres.<host>:<password>@aws-0-eu-central-1.pooler.supabase.com:5432/postgres"
NoteIf the database already has the necessary migrations and you don't need the command to run migrations, you can pass the --no-migrations option.

Troubleshooting#

Errors when using VSCode or GitHub Codespaces
Can't connect to database with --db-url option
Error: EADDRINUSE
Can't Connect to PostgreSQL Docker Container
EAGAIN Error
TypeError: cmd is not a function
Error: connect ECONNREFUSED ::1:5432
Invalid Token Error After Using --no-browser option
Other Errors
Was this page helpful?
Edit this page