-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
12,057 additions
and
14,655 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
/dist | ||
.env | ||
.DS_Store | ||
/uploads | ||
/node_modules | ||
yarn-error.log | ||
/.idea | ||
.idea | ||
/lib | ||
node_modules | ||
.DS_store | ||
**/.DS_Store | ||
.env* | ||
/*.js | ||
|
||
dist | ||
coverage | ||
|
||
api/ | ||
services/ | ||
models/ | ||
subscribers/ | ||
migrations/ | ||
loaders/ | ||
index.* | ||
|
||
!src/** | ||
|
||
./tsconfig.tsbuildinfo | ||
./package-lock.json | ||
./yarn.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.idea | ||
node_modules | ||
.DS_store | ||
.env* | ||
src | ||
coverage | ||
|
||
tsconfig.tsbuildinfo |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,155 +1,66 @@ | ||
<p align="center"> | ||
<a href="https://www.medusa-commerce.com"> | ||
<img alt="Medusa" src="https://i.imgur.com/USubGVY.png" width="100" /> | ||
</a> | ||
</p> | ||
<h1 align="center"> | ||
Medusa Starter Default | ||
</h1> | ||
<p align="center"> | ||
This repo provides the skeleton to get you started with using <a href="https://github.com/medusajs/medusa">Medusa</a>. Follow the steps below to get ready. | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/medusajs/medusa/blob/master/LICENSE"> | ||
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." /> | ||
</a> | ||
<a href="https://github.com/medusajs/medusa/blob/master/CONTRIBUTING.md"> | ||
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" /> | ||
</a> | ||
<a href="https://discord.gg/xpCwq3Kfn8"> | ||
<img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" /> | ||
</a> | ||
<a href="https://twitter.com/intent/follow?screen_name=medusajs"> | ||
<img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" /> | ||
</a> | ||
<!--lint disable awesome-list-item--> | ||
<div align="center"> | ||
<p align="center"> | ||
<a href="https://heroku.com/deploy?template=https://github.com/medusajs/medusa-starter-default/tree/feat/deploy-heroku"> | ||
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy"> | ||
</a> | ||
<img alt="Medusa" src="https://uploads-ssl.webflow.com/61fba9f6deac297b7b22017d/62000006ce573a706c92546c_logo.svg" width="200" /> | ||
</p> | ||
</p> | ||
|
||
## Prerequisites | ||
|
||
This starter has minimal prerequisites and most of these will usually already be installed on your computer. | ||
|
||
- [Install Node.js](https://nodejs.org/en/download/) | ||
- [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
- [Install SQLite](https://www.sqlite.org/download.html) | ||
|
||
## 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 | ||
<h1>Plugin starter (Typescript)</h1> | ||
<p>Start to write your own plugin as quick as possible</p> | ||
|
||
<a href="https://github.com/adrien2p/awesome-medusajs"> | ||
<img src="https://awesome.re/badge.svg" alt="Awesome"> | ||
</a> | ||
</div> | ||
|
||
--- | ||
# Getting started | ||
|
||
To seed your medusa store run the following command: | ||
Installation | ||
|
||
``` | ||
medusa seed -f ./data/seed.json | ||
```bash | ||
git clone [email protected]:adrien2p/medusa-plugin-starter-ts.git | ||
``` | ||
|
||
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. | ||
# Usage | ||
|
||
## Setting up your store with Docker | ||
## Api | ||
|
||
- 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`: | ||
### Admin routes | ||
|
||
``` | ||
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, | ||
}; | ||
``` | ||
Those routes will automatically be attached by medusa to the `admin` path. | ||
|
||
- Run your project | ||
### Store routes | ||
|
||
When running your project the first time `docker compose` should be run with the `build` flag to build your container locally: | ||
Those routes will automatically be attached by medusa to the `store` path. | ||
|
||
``` | ||
docker-compose up --build | ||
``` | ||
### Custom routes | ||
|
||
When running your project subsequent times you can run docker compose with no flags to spin up your local environment in seconds: | ||
All those routes are added in the main router and you have to manage them. | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
## Models/Migrations | ||
|
||
Your local Medusa server is now running on port **9000**. | ||
Those models will be attach to the manager and included into the medusa container. | ||
The migrations will be applied automatically. | ||
|
||
### Seeding your Medusa store with Docker | ||
## Subscribers | ||
|
||
--- | ||
It acts like a service but its main purpose is to extends core flow depending on the | ||
events you want to listen to. | ||
|
||
To add seed data to your medusa store running with Docker, run this command in a seperate terminal: | ||
## Services | ||
|
||
``` | ||
docker exec medusa-server medusa seed -f ./data/seed.json | ||
``` | ||
Those services will be automatically added to the medusa container and will be available | ||
in any other service through the constructor injection. | ||
|
||
This will execute the previously described seed script in the running `medusa-server` Docker container. | ||
## Loaders | ||
|
||
## Try it out | ||
Those will be applied during the loading and allow you to register custom components | ||
to the container to be accessible later on. | ||
|
||
``` | ||
curl -X GET localhost:9000/store/products | python -m json.tool | ||
``` | ||
# Deployment | ||
|
||
After the seed script has run you will have the following things in you database: | ||
Once your plugin is done. | ||
|
||
- a User with the email: [email protected] 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](https://docs.medusa-commerce.com) for further guides. | ||
```bash | ||
npm run build && npm version && npm publish | ||
``` | ||
|
||
<p> | ||
<a href="https://www.medusa-commerce.com"> | ||
Website | ||
</a> | ||
| | ||
<a href="https://medusajs.notion.site/medusajs/Medusa-Home-3485f8605d834a07949b17d1a9f7eafd"> | ||
Notion Home | ||
</a> | ||
| | ||
<a href="https://twitter.com/intent/follow?screen_name=medusajs"> | ||
</a> | ||
| | ||
<a href="https://docs.medusa-commerce.com"> | ||
Docs | ||
</a> | ||
</p> | ||
You can now install it into your project file `medusa-config`. |
Oops, something went wrong.