Skip to content

Commit

Permalink
Merge pull request medusajs#11 from shahednasser/patch-1
Browse files Browse the repository at this point in the history
chore: general fixes to the readme
  • Loading branch information
VariableVic authored May 12, 2023
2 parents 1557568 + 43c7434 commit 9d82379
Showing 1 changed file with 43 additions and 28 deletions.
71 changes: 43 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,77 @@ A Next.js 13 and App Router-ready ecommerce template, built with [Medusa](https:

## What is Medusa?

[Medusa](https://medusajs.com/) is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any product that needs foundational commerce primitives. All modules are open-source and freely available on npm.
[Medusa](https://medusajs.com/) is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any system that needs foundational commerce primitives. All modules are open-source and freely available on NPM.

Learn more about [Medusa’s architecture](https://docs.medusajs.com/development/fundamentals/architecture-overview) and [commerce modules](https://docs.medusajs.com/modules/overview) in the Docs.
Learn more about [Medusa’s architecture](https://docs.medusajs.com/development/fundamentals/architecture-overview) and [commerce modules](https://docs.medusajs.com/modules/overview) in Medusa's documentation.

## Running locally

You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js Commerce. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables) for this, but a `.env` file is all that is necessary.
You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js Commerce. It's recommended to use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables) for this, but a `.env` file is all that is necessary.

> Note: You should not commit your `.env` file or it will expose secrets.
1. Install Vercel CLI: `npm i -g vercel`
2. Link local instance with Vercel and GitHub accounts (creates `.vercel` directory): `vercel link`
3. Download your environment variables: `vercel env pull`
1\. Install Vercel CLI:

```bash
pnpm install
pnpm dev
npm i -g vercel
```

Your app should now be running on [localhost:3000](http://localhost:3000/).

## How to configure your Medusa server for Next.js Commerce
2\. Link local instance with Vercel and GitHub accounts (which creates a `.vercel` directory):

Next.js Commerce x Medusa requires a running [Medusa](https://github.com/medusajs/medusa) server.
```bash
vercel link
```

### Create a Medusa Backend[](https://docs.medusajs.com/development/backend/install#create-a-medusa-backend 'Direct link to Create a Medusa Backend')
3\. Download your environment variables:

It is recommended to use [Yarn](https://yarnpkg.com/getting-started/install) for the installation process as it's much faster than using NPM.
```bash
vercel env pull
```

#### 1. Install Medusa CLI[](https://docs.medusajs.com/development/backend/install#1-install-medusa-cli 'Direct link to 1. Install Medusa CLI')
4\. Install dependencies and run your app:

```
yarn global add @medusajs/medusa-cli
```bash
npm install
npm run dev
```

If you run into any errors while installing the CLI tool, check out the [troubleshooting guide](https://docs.medusajs.com/troubleshooting/cli-installation-errors).
Your app should now be running on [localhost:3000](http://localhost:3000/).

#### 2. Create a new Medusa project[](https://docs.medusajs.com/development/backend/install#2-create-a-new-medusa-project 'Direct link to 2. Create a new Medusa project')
## How to configure your Medusa backend for Next.js Commerce

```
medusa new my-medusa-store --seed
```
Next.js Commerce x Medusa requires a running [Medusa](https://github.com/medusajs/medusa) backend.

#### 3. Start your Medusa backend[](https://docs.medusajs.com/development/backend/install#3-start-your-medusa-backend 'Direct link to 3. Start your Medusa backend')
### Prerequisites

Please refer to the [documentation](https://docs.medusajs.com/development/backend/install#prerequisites) to learn about required tools for the Medusa Backend.

### How to Install the Medusa Backend

1\. Install the Medusa CLI tool:

```bash
npm install @medusajs/medusa-cli -g
```
cd my-medusa-store medusa develop

2\. Run the following command to create a Medusa backend:

```bash
medusa new my-medusa-store https://github.com/medusajs/medusa-starter-default/tree/nextjs-commerce --seed
```

#### 4. Add Medusa backend domain to an environment variable
3\. Start the Medusa backend:

```bash
cd my-medusa-store
medusa develop
```

Copy the contents of `.env.example` to a `.env` file in the root of your Next.js Commerce project. Make sure the `NEXT_PUBLIC_MEDUSA_BACKEND_API` environment variable points to your Medusa backend domain (default: `http://localhost:9000`).
4\. Copy the contents of .env.example to a .env file in the root of your Next.js Commerce project, and make sure the NEXT_PUBLIC_MEDUSA_BACKEND_API environment variable points to your Medusa backend domain (default: http://localhost:9000).

#### 5. (Optional) Install Medusa Admin plugin and add product categories
### (Optional) Install Medusa Admin plugin and add product categories

Medusa comes with a few demo products, but they won't show up in the template by default. To showcase products in the store, we need to install the Medusa Admin and add a few product categories:
Medusa comes with a few demo products, but they won't show up in the template by default. To showcase products in the store, you need to install the Medusa Admin and add a few product categories. To do that:

1. Install the [Medusa Admin plugin](https://docs.medusajs.com/admin/quickstart)
2. Enable the [Product Categories feature flag](https://docs.medusajs.com/modules/products/categories)
Expand Down

0 comments on commit 9d82379

Please sign in to comment.