Medusa Admin | Website | Blog | LinkedIn | Twitter | Documentation | Notion
Medusa is an open-source headless commerce engine empowering developers to do more with less. In this repo, you find Medusa combined with Printful for a powerful customizable setup for on-demand product fulfillment.
- Set up project
git clone https://github.com/olivermrbl/medusa-printful
- Set up Printful account Navigate to Printful and sign in or create an account
- Create a Store Choose Stores in the left side bar and create a new one of type Manual order platform / API
- Create credentials In the left sidebar, choose Settings > API and create an API for the Store created in previous step. Note it down.
- Set up Medusa
Navigate to
/backend
(Medusa project) and add the API key to your.env
.
mv .env.template .env
...
PRINTFUL_API_KEY=[your-key]
- Start Medusa
At this point, we assume that you have Redis and Postgres running locally. You should have a Postgres DB named
medusa-printful
.
In /backend
, run the following commands in your terminal to get Medusa up and running:
yarn
# migrate and seed your database
yarn seed
# start medusa
yarn start
Medusa should now be running on http://localhost:9000
We have a prebuilt admin dashboard that you can use to configure and manage your store find it here: Medusa Admin
- Clone this repository
git clone https://github.com/medusajs/admin medusa-admin cd medusa-admin
- Install dependencies
yarn install
- Start the development server
yarn start
- Go to http://localhost:7000
Back in your Medusa engine installation directory, you can create your own user for the admin by running:
medusa user -e some@email.com -p some-password
Alternatively, if you've seeded your server with our dummy data, you can use the following credentials:
admin@medusa-test.com // supersecret
In this tutorial, we will be using a simple Next.js storefront. Navigate to /storefront
and run the following:
npm install && npm run dev
With your Medusa server and your storefront running, you can open http://localhost:8000 in your browser and view the products in your store, build a cart, add shipping details and pay and complete an order.
In order for Printful to sync. products to Medusa, we use webhooks. Those are created on first run of the server. For this to work locally, you need to use a tunnelling service. In this tutorial, we will be using ngrok
. Make sure you've set that up before proceeding.
- Set up
ngrok
In a terminal window, startngrok
to tunnel traffic tohttp://localhost:9000
ngrok http 9000
This should give you an https URL. Note it down.
- Set up Medusa with
ngrok
Navigate to/backend
(Medusa project) and add the URL to your.env
.
BACKEND_URL=https://723d386a4a4e.ngrok.io # <- This should be your URL from ngrok
- Restart your Medusa server
You should now be ready to syncronize products. Go to you Printful account and create a Product template. Then add the Product to your Printful store created previously. Upon submitting the changes to your store, the product should be syncronized to Medusa. Validate this by going to your Medusa Admin running on http://localhost:7000
.
You can now publish the product in your admin, and it should show on the storefront.
Before creating an order, you should add shipping options to your regions. In Medusa Admin, navigate to Settings > Regions and add Printful as fulfillment provider as well as a shipping option from Printful.
Create an order with your Product through the storefront. In Medusa Admin, you should be able to see the order. Upon creating a fulfillment for the product in the order, the integration will create an order in Printful.
...more to come