There are two ways of installing Mercur: the CLI script or manual installation.

Follow these steps to install and run Mercur backend on your operating system:

Step 1: Clone the Mercur repository:

git clone https://github.com/mercurjs/mercur.git

Step 2: Navigate to the Mercur directory and execute the following command:

cd mercur
yarn install

Step 3: Go to the backend directory and prepare .env file

cd apps/backend

cp .env.template .env

Step 4: Configure database credentials in the .env file

# Replace user, password, address and port parameters with your values
DATABASE_URL=postgres://[user]:[password]@[address]:[port]/$DB_NAME
# For example:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/$DB_NAME

Do not delete $DB_NAME from the connection string. You’ll be prompted to choose database name during the next step.

Step 5: Setup database and run migrations

yarn medusa db:create && yarn medusa db:migrate && yarn seed

Step 6: Generate OpenApi specs from the Mercur backend

yarn generate:oas

Step 7: Create admin user

npx medusa user --email <email> --password <password>

Optional step: Run the seed script. This will set up all necessary configuration, along with example seller and products. Recommended for new users.

yarn seed

Default seller credentials (to login into vendor panel):

email: seller@mercurjs.com
password: secret

Step 8: Go to the root directory and generate http-client class

cd ../..

yarn codegen

Step 9: Run Turborepo

yarn dev