* initialized next.js project * finished markdown sections * added operation schema component * change page metadata * eslint fixes * fixes related to deployment * added response schema * resolve max stack issue * support for different property types * added support for property types * added loading for components * added more loading * type fixes * added oneOf type * removed console * fix replace with push * refactored everything * use static content for description * fixes and improvements * added code examples section * fix path name * optimizations * fixed tag navigation * add support for admin and store references * general enhancements * optimizations and fixes * fixes and enhancements * added search bar * loading enhancements * added loading * added code blocks * added margin top * add empty response text * fixed oneOf parameters * added path and query parameters * general fixes * added base path env variable * small fix for arrays * enhancements * design enhancements * general enhancements * fix isRequired * added enum values * enhancements * general fixes * general fixes * changed oas generation script * additions to the introduction section * added copy button for code + other enhancements * fix response code block * fix metadata * formatted store introduction * move sidebar logic to Tags component * added test env variables * fix code block bug * added loading animation * added expand param + loading * enhance operation loading * made responsive + improvements * added loading provider * fixed loading * adjustments for small devices * added sidebar label for endpoints * added feedback component * fixed analytics * general fixes * listen to scroll for other headings * added sample env file * update api ref files + support new fields * fix for external docs link * added new sections * fix last item in sidebar not showing * move docs content to www/docs * change redirect url * revert change * resolve build errors * configure rewrites * changed to environment variable url * revert changing environment variable name * add environment variable for API path * fix links * fix tailwind settings * remove vercel file * reconfigured api route * move api page under api * fix page metadata * fix external link in navigation bar * update api spec * updated api specs * fixed google lint error * add max-height on request samples * add padding before loading * fix for one of name * fix undefined types * general fixes * remove response schema example * redesigned navigation bar * redesigned sidebar * fixed up paddings * added feedback component + report issue * fixed up typography, padding, and general styling * redesigned code blocks * optimization * added error timeout * fixes * added indexing with algolia + fixes * fix errors with algolia script * redesign operation sections * fix heading scroll * design fixes * fix padding * fix padding + scroll issues * fix scroll issues * improve scroll performance * fixes for safari * optimization and fixes * fixes to docs + details animation * padding fixes for code block * added tab animation * fixed incorrect link * added selection styling * fix lint errors * redesigned details component * added detailed feedback form * api reference fixes * fix tabs * upgrade + fixes * updated documentation links * optimizations to sidebar items * fix spacing in sidebar item * optimizations and fixes * fix endpoint path styling * remove margin * final fixes * change margin on small devices * generated OAS * fixes for mobile * added feedback modal * optimize dark mode button * fixed color mode useeffect * minimize dom size * use new style system * radius and spacing design system * design fixes * fix eslint errors * added meta files * change cron schedule * fix docusaurus configurations * added operating system to feedback data * change content directory name * fixes to contribution guidelines * revert renaming content * added api-reference to documentation workflow * fixes for search * added dark mode + fixes * oas fixes * handle bugs * added code examples for clients * changed tooltip text * change authentication to card * change page title based on selected section * redesigned mobile navbar * fix icon colors * fix key colors * fix medusa-js installation command * change external regex in algolia * change changeset * fix padding on mobile * fix hydration error * update depedencies
204 lines
7.2 KiB
Plaintext
204 lines
7.2 KiB
Plaintext
---
|
||
description: 'Learn how to create a composable commerce platform using Medusa. This quickstart guide will help you set up your Medusa backend and the admin dashboard.'
|
||
addHowToData: true
|
||
---
|
||
|
||
import Tabs from '@theme/Tabs';
|
||
import TabItem from '@theme/TabItem';
|
||
import Feedback from '@site/src/components/Feedback';
|
||
import DocCard from '@theme/DocCard';
|
||
import DocCardList from '@theme/DocCardList';
|
||
import Icons from '@theme/Icon';
|
||
import Troubleshooting from '@site/src/components/Troubleshooting'
|
||
import TypeErrorSection from "./troubleshooting/create-medusa-app-errors/_typeerror.md"
|
||
import OtherErrorsSection from "./troubleshooting/create-medusa-app-errors/_other-errors.mdx"
|
||
import EagainError from "./troubleshooting/create-medusa-app-errors/_eagain-error.md"
|
||
import ConnectionErrorSection from './troubleshooting/database-errors/_connection-error.md'
|
||
import FreshInstallationSection from './troubleshooting/awilix-resolution-error/_fresh-installation.md'
|
||
import EaddrinuseSection from './troubleshooting/eaddrinuse.md'
|
||
|
||
# Install Medusa with create-medusa-app
|
||
|
||
In this document, you’ll learn how to use create-medusa-app to set up a Medusa backend and an admin dashboard.
|
||
|
||
:::tip
|
||
|
||
`create-medusa-app` allows you to install and setup a Medusa backend project with minimal configurations. If you're more familiar with Medusa and you need to have more control over the configurations of the Medusa backend, please use the [backend quickstart instead](./development/backend/install.mdx).
|
||
|
||
:::
|
||
|
||
## Overview
|
||
|
||
Medusa is a toolkit for developers to create digital commerce applications. In its simplest form, Medusa is a Node.js backend with the core API, plugins, and modules installed through npm.
|
||
|
||
`create-medusa-app` is a command that facilitates creating a Medusa ecosystem. It installs the Medusa backend and admin dashboard, along with the necessary configurations to run the backend.
|
||
|
||
---
|
||
|
||
## Prerequisites
|
||
|
||
Before you can install and use Medusa, you need the following tools installed on your machine:
|
||
|
||
- [Node.js v16+](./development/backend/prepare-environment.mdx#nodejs)
|
||
- [Git](./development/backend/prepare-environment.mdx#git)
|
||
- [PostgreSQL](./development/backend/prepare-environment.mdx#postgresql). The PostgreSQL server should also be running during your installation process.
|
||
|
||
---
|
||
|
||
## How to Create a Medusa Project
|
||
|
||
:::note
|
||
|
||
`create-medusa-app` uses a beta version of the Medusa backend and admin. If you want to use a stable Medusa setup, consider passing the `--stable` option to the command. However, when using this option, you'll have to [install the Medusa admin](./admin/quickstart.mdx) manually.
|
||
|
||
:::
|
||
|
||
In your terminal, run the following command:
|
||
|
||
<Tabs groupId="npxyarn" isCodeTabs={true}>
|
||
<TabItem value="npx" label="NPX" default>
|
||
|
||
```bash
|
||
npx create-medusa-app@latest
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="yarn" label="Yarn">
|
||
|
||
```bash
|
||
yarn create medusa-app
|
||
```
|
||
|
||
</TabItem>
|
||
<TabItem value="pnpm" label="pnpm">
|
||
|
||
```bash
|
||
pnpm dlx create-medusa-app@latest
|
||
```
|
||
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
<details>
|
||
<summary>Available Options</summary>
|
||
|
||
- `--stable`: A flag that allows you to opt-out of the beta Medusa backend project. When using this option, the Medusa admin won't be installed.
|
||
- `--repo-url <url>`: The repository URL to create the project from. By default it will be `https://github.com/medusajs/medusa-starter-default`.
|
||
- `--seed`: A flag indicating whether the database should be seeded with demo data. By default, seeding is disabled.
|
||
- `--no-boilerplate`: A flag that removes all files added for an enhanced onboarding experience (files under `src/admin`, `src/api`, etc...). This is helpful if you want to create a clean project, and is only recommended if you're familiar with Medusa.
|
||
|
||
</details>
|
||
|
||
### Step 1: Specify Project Name
|
||
|
||
You’ll first be asked to enter the name of your project, which is used to create the directory holding your Medusa backend. You can use the default `my-medusa-store` or enter another project name.
|
||
|
||
### (Optional) Step 2: Specify PostgreSQL credentials
|
||
|
||
By default, this command will try to use the default PostgreSQL credentials to connect to your PostgreSQL server. If they don't work, you'll be prompted to enter your PostgreSQL database and password. If they work, you can move ahead to the next step.
|
||
|
||
These credentials will be used to create a database during this setup and configure your Medusa backend to connect to that database.
|
||
|
||
### Step 3: Enter an admin email
|
||
|
||
You'll then be prompted to enter an admin email for your admin user. You'll be using this admin email later to login to your admin dashboard. You can use the default `admin@medusa-test.com` or enter any other email.
|
||
|
||
### Step 4: Wait for Project Setup
|
||
|
||
After the above steps, the project setup will start which includes:
|
||
|
||
1. Creating the project directory. The directory name will be the project name you entered in step 1.
|
||
2. Creating the project database.
|
||
3. Installing dependencies in your project directory.
|
||
4. Building project and running migrations to migrate the Medusa schema into your project database.
|
||
5. Create the admin user.
|
||
6. Seeding the database with demo data.
|
||
|
||
### Step 5: Log into admin dashboard
|
||
|
||
:::note
|
||
|
||
If you passed the `--stable` option, the `localhost:9000/store/products` endpoint will open in your browser instead.
|
||
|
||
:::
|
||
|
||
Once the project is prepared, the Medusa backend will start and the admin dashboard will be opened in your default browser. You'll then be asked to enter a password for the admin email you entered earlier, as well as other account information.
|
||
|
||
Once you're logged in, you can start using Medusa! Try following the setup guide to create your first product and order.
|
||
|
||
<Feedback
|
||
event="survey_create-medusa-app"
|
||
question="Did you set up Medusa successfully?"
|
||
positiveQuestion="Is there anything that should improved?"
|
||
negativeQuestion="Please describe the issue you faced."
|
||
/>
|
||
|
||
---
|
||
|
||
## Next Steps: Start your Development
|
||
|
||
Based on what you're building, you can find a development path for you in the Recipes page.
|
||
|
||
<DocCardList colSize={4} items={[
|
||
{
|
||
type: 'link',
|
||
href: '/recipes',
|
||
label: 'Recipes',
|
||
customProps: {
|
||
icon: Icons['map'],
|
||
description: "Find learning paths based on what you're building"
|
||
}
|
||
},
|
||
{
|
||
type: 'link',
|
||
href: '/development/overview',
|
||
label: 'Medusa Backend Basics',
|
||
customProps: {
|
||
icon: Icons['server-stack-solid'],
|
||
description: 'Learn all the basics of developing with the Medusa backend.'
|
||
}
|
||
},
|
||
{
|
||
type: 'link',
|
||
href: '/modules/overview',
|
||
label: 'Commerce Modules',
|
||
customProps: {
|
||
icon: Icons['puzzle-solid'],
|
||
description: 'Learn about the available commerce modules and features in the Medusa backend.'
|
||
}
|
||
},
|
||
]} />
|
||
|
||
---
|
||
|
||
## Troubleshooting
|
||
|
||
<Troubleshooting
|
||
sections={[
|
||
{
|
||
title: 'Error: EADDRINUSE',
|
||
content: <EaddrinuseSection />
|
||
},
|
||
{
|
||
title: "EAGAIN error",
|
||
content: <EagainError />
|
||
},
|
||
{
|
||
title: "TypeError: cmd is not a function",
|
||
content: <TypeErrorSection />
|
||
},
|
||
{
|
||
title: "Error: connect ECONNREFUSED ::1:5432",
|
||
content: <ConnectionErrorSection />
|
||
},
|
||
{
|
||
title: 'AwilixResolutionError: Could Not Resolve X',
|
||
content: <FreshInstallationSection />
|
||
},
|
||
{
|
||
title: "Other Errors",
|
||
content: <OtherErrorsSection />
|
||
},
|
||
]}
|
||
/>
|