暂无描述

olivermrbl d2a1ad4936 chore: Bump versions 2 年之前
data 1983d01d8a new seed data 3 年之前
src b12738a80c Update README.md 3 年之前
.babelrc.js 8aac90de6f Initial commit 3 年之前
.dockerignore 7da2930b33 fix: dockerfile, add dockeringore 3 年之前
.env.template 8aac90de6f Initial commit 3 年之前
.gitignore 35eb696e02 refactor: Add dotenv support in medusa-config.js 3 年之前
Dockerfile 2c89b92c44 fixed error of copying yarn.lock when it doesn't exist 3 年之前
README.md 876f9eb41b Merge branch 'master' into patch-1 3 年之前
develop.sh c0a0393e28 update docker compose setup 3 年之前
docker-compose.yml f3cc38ae25 pr review fixes 3 年之前
medusa-config.js 426b8cba17 feat: Update medusa-config NODE_ENV switch cases 3 年之前
package.json d2a1ad4936 chore: Bump versions 2 年之前
tsconfig.json 23607a6909 fix: removed additional comma in JSON file 2 年之前
yarn.lock d2a1ad4936 chore: Bump versions 2 年之前

README.md

Medusa

Medusa Starter Default

This repo provides the skeleton to get you started with using Medusa. Follow the steps below to get ready.

Medusa is released under the MIT license. PRs welcome! Discord Chat

Deploy

Prerequisites

This starter has minimal prerequisites and most of these will usually already be installed on your computer.

Setting up your store

  • Install the Medusa CLI

    npm install -g @medusajs/medusa
    yarn global add @medusajs/medusa
    
  • Create a new Medusa project

    medusa new my-medusa-store
    
  • Run your project

    cd my-medusa-store
    medusa develop
    

Your local Medusa server is now running on port 9000.

Seeding your Medusa store


To seed your medusa store run the following command:

medusa seed -f ./data/seed.json

This command seeds your database with some sample data to get you started, including a store, an administrator account, a region and a product with variants. What the data looks like precisely you can see in the ./data/seed.json file.

Setting up your store with Docker

  • Install the Medusa CLI

    npm install -g @medusajs/medusa-cli
    
  • Create a new Medusa project

    medusa new my-medusa-store
    
  • Update project config in medusa-config.js:

    module.exports = {
    projectConfig: {
      redis_url: REDIS_URL,
      database_url: DATABASE_URL, //postgres connectionstring
      database_type: "postgres",
      store_cors: STORE_CORS,
      admin_cors: ADMIN_CORS,
    },
    plugins,
    };
    
  • Run your project

When running your project the first time docker compose should be run with the build flag to build your container locally:

  docker-compose up --build

When running your project subsequent times you can run docker compose with no flags to spin up your local environment in seconds:

  docker-compose up

Your local Medusa server is now running on port 9000.

Seeding your Medusa store with Docker


To add seed data to your medusa store running with Docker, run this command in a seperate terminal:

docker exec medusa-server medusa seed -f ./data/seed.json

This will execute the previously described seed script in the running medusa-server Docker container.

Try it out

curl -X GET localhost:9000/store/products | python -m json.tool

After the seed script has run you will have the following things in you database:

  • a User with the email: admin@medusa-test.com and password: supersecret
  • a Region called Default Region with the countries GB, DE, DK, SE, FR, ES, IT
  • a Shipping Option called Standard Shipping which costs 10 EUR
  • a Product called Cool Test Product with 4 Product Variants that all cost 19.50 EUR

Visit docs.medusa-commerce.com for further guides.

Website | Notion Home | Twitter | Docs