docs: improve getting started chapters (#10014)

This commit is contained in:
Shahed Nasser
2024-11-11 20:35:57 +02:00
committed by GitHub
parent fb05ca2b8a
commit a131a4468d
11 changed files with 144 additions and 43 deletions
@@ -0,0 +1,118 @@
import { Prerequisites } from "docs-ui"
export const metadata = {
title: `${pageNumber} Install Medusa`,
}
# {metadata.title}
In this documentation, you'll learn how to install and run a Medusa application.
## Create Medusa Application
<Prerequisites items={[
{
text: "Node.js v20+",
link: "https://nodejs.org/en/download"
},
{
text: "Git CLI tool",
link: "https://git-scm.com/downloads"
},
{
text: "PostgreSQL",
link: "https://www.postgresql.org/download/"
}
]} />
To create a Medusa application, use the `create-medusa-app` command:
```bash
npx create-medusa-app@latest
```
When you run the command, you'll be asked for the project's name and whether you want to install the Next.js storefront.
After answering the prompts, the command installs the Medusa application in a directory with your project name, and prepares a PostgreSQL database that the application connects to.
<Note>
Since the Medusa server is headless, the storefront is optional to install and you can install it later by following [this guide](../storefront-development/nextjs-starter/page.mdx). If you choose to install it with the Medusa application, the storefront is installed in a separate directory named `{project-name}-storefront`.
</Note>
### Successful Installation Result
Once the Medusa application installation finishes successfully, the Medusa application will run at `http://localhost:9000`.
The Medusa Admin dashboard also runs at `http://localhost:9000/app`. The installation process opens the Medusa Admin dashboard in your default browser to create a user. You can later log in with that user.
If you also installed the Next.js storefront, it'll be running at `http://localhost:8000`.
### Troubleshooting Installation Errors
If you ran into an error during your installation, refer to the following troubleshooting guides for help:
1. [create-medusa-app troubleshooting guides](!resources!/troubleshooting/create-medusa-app-errors).
2. [CORS errors](!resources!/troubleshooting/cors-errors).
3. [All troubleshooting guides](!resources!/troubleshooting).
If you can't find your error reported anywhere, please open a [GitHub issue](https://github.com/medusajs/medusa/issues/new/choose).
<Feedback
question="Did you install Medusa successfully?"
negativeQuestion="What errors or issues did you run into?"
showDottedSeparator={false}
positiveBtn="Yes"
negativeBtn="No"
/>
---
## Run Medusa Application in Development
To run the Medusa application in development, change to your application's directory and run the following command:
```bash npm2yarn
npm run dev
```
This runs your Medusa application at `http://localhost:9000`, and the Medusa Admin dashboard `http://localhost:9000/app`.
<Note title="Tip">
For details on starting and configuring the Next.js storefront, refer to [this documentation](../storefront-development/nextjs-starter/page.mdx).
</Note>
The application will restart if you make any changes to code under the `src` directory, except for admin customizations which are hot reloaded, providing you with a seamless developer experience without having to refresh your browser to see the changes.
---
## Create Medusa Admin User
Aside from creating an admin user in the admin dashboard, you can create a user with Medusa's CLI tool.
Run the following command in your Medusa application's directory to create a new admin user:
```bash
npx medusa user -e admin@medusajs.com -p supersecret
```
Replace `admin@medusajs.com` and `supersecret` with the user's email and password respectively.
You can then use the user's credentials to log into the Medusa Admin application.
---
## Configure Medusa Application
By default, your Medusa application is equipped with the basic configuration to start your development.
If you run into issues with configurations, such as CORS configurations, or need to make changes to the default configuration, refer to [this guide on all available configurations](!resources!/medusa-config).
---
## Next Steps
In the next documentation pages, you'll start customizing your Medusa application, learn about the project's directory structure, and learn about different basic concepts.