Skip to content

Latest commit

 

History

History
61 lines (36 loc) · 1.66 KB

README.md

File metadata and controls

61 lines (36 loc) · 1.66 KB

Medusa B2C Starter

This monorepo serves as a starter template/example for building B2C e-commerce applications using Medusa for e-commerce functionality, Next.js for the frontend, and Sanity for content management.

Project Setup

To get started with this project, follow these steps:

  1. Clone the repository:
git clone --depth 1 https://github.com/tinloof/medusa-b2c-starter
  1. Install dependencies:

This project utilizes pnpm for package management and monorepo functionality. To install dependencies using pnpm, execute the following command:

pnpm install

Sanity Setup

To set up Sanity for your project:

  1. cd into the frontend directory:
cd frontend
  1. Run the sanity init command:
pnpx sanity init --env
  1. Make sure to append NEXT_PUBLIC_ where it makes sense in your .env file, you can refer to the .env.example file in the frontend directory.

  2. Set the NEXT_PUBLIC_SANITY_API_VERSION in .env to today's date in the format YYYY-MM-DD.

  3. Get the SANITY_API_TOKEN by navigating to the Sanity Manage Dashboard. Choose your project, access the API section, and generate a token with editor permissions.

Medusa Setup

To set up Medusa for your project:

Once project is deployed

  1. Create a Publishable api key in the dashboard settings and set it to NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY

  2. Add the URL of the Medusa project to NEXT_PUBLIC_MEDUSA_BACKEND_URL

Running the Project

After you go through the setup steps, you can run the project using the following command from the root directory:

pnpm dev