Skip to content

Latest commit

 

History

History
94 lines (64 loc) · 2.32 KB

File metadata and controls

94 lines (64 loc) · 2.32 KB

Medusa v2 Example: Product Builder

This directory holds the code for the Product Builder Tutorial.

You can either:

Prerequisites

Installation

  1. Clone the repository and change to the product-builder directory:
git clone https://github.com/medusajs/examples.git
cd examples/product-builder

2. Rename the .env.template file to .env.

3. If necessary, change the PostgreSQL username, password, and host in the DATABASE_URL environment variable.

4. Install dependencies:

yarn # or npm install

5. Setup and seed the database:

npx medusa db:setup
yarn seed # or npm run seed

6. Start the Medusa application:

yarn dev # or npm run dev

You can manage the builder configurations of a product in the Medusa Admin by going to the product's details page.

Refer to the More Resources for OpenAPI Specs of custom API routes.

Copy into Existing Medusa Application

If you have an existing Medusa application, copy the following directories and files into your project:

  • src/admin
  • src/api/admin
  • src/api/store
  • src/api/middlewares.ts
  • src/links
  • src/modules/product-builder
  • src/workflows

Then, add the Product Builder Module to medusa-config.ts:

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "./src/modules/product-builder",
    }
  ],
})

After that, run migrations to create the necessary tables:

npx medusa db:migrate

Finally, start the Medusa application:

yarn dev # or npm run dev

You can manage the builder configurations of a product in the Medusa Admin by going to the product's details page.

More Resources