Skip to content

Official Medusa B2B Starter template. Features common B2B ecommerce requirements and can be easily adapted and extended.

License

Notifications You must be signed in to change notification settings

NB-ENTOO/b2b-starter-medusa

 
 

Repository files navigation

B2B Commerce Starter

Medusa B2B Commerce Starter

Customizable B2B ecommerce built with Medusa 2.0 & Next.js Storefront

PRs welcome! Discord Chat Follow @medusajs

b2b-video.mp4


Table

 

Prerequisites

⚠️ We have tested this repo with the below versions:

  • ✅ Node 20
  • ✅ Postgres 15
  • ✅ Medusa 2.4
  • ✅ Next.js 15
  • ✅ Docker & Docker Compose (for infrastructure services)

 

🚀 Enhanced Development Setup

This fork includes additional enhancements to make your MedusaJS learning journey easier with a ready-to-deploy local development environment:

✨ What's Added

  • 🐳 Docker Compose Infrastructure - Complete containerized setup for all services
  • 📦 MinIO S3 Storage - Self-hosted file storage with automatic image processing
  • 🔍 MeiliSearch Integration - Full-text search with beautiful storefront search modal
  • ⚡ Redis Caching - Event bus and workflow engine optimization
  • 🛠️ Enhanced Seed Script - Idempotent seeding with automatic image processing
  • 🎯 Developer Experience - Improved port management and development tools

🚀 Quick Start with Docker

# Start all infrastructure services
cd "docker compose"
docker-compose up -d

# Services will be available at:
# - PostgreSQL: localhost:5432
# - Redis: localhost:6379  
# - MeiliSearch: localhost:7700
# - MinIO: localhost:9090 (API) / localhost:9001 (Console)

🗂️ Data Persistence & Fresh Start

All service data is stored in the docker compose/data/ folder:

  • data/postgres/ - Database files
  • data/redis/ - Redis persistence
  • data/meilisearch/ - Search index data
  • data/minio_data/ - File storage

🔄 To start completely fresh:

# Stop services
docker-compose down

# Remove all data
rm -rf data/

# Start fresh
docker-compose up -d
# Then re-run the seed script: yarn medusa db:migrate && yarn run seed

Note: This is a development-focused enhancement to help newcomers get started quickly. While it includes production-ready components, additional configuration may be needed for production deployment.

 

Overview

For a full feature overview, please visit the project wiki.

Core features

  • Company Management. Customers can manage their company and invite employees.
  • Spending Limits. Company admins can assign spending limits to its employees.
  • Bulk add-to-cart. Customers can add multiple variants of a product to their cart at once.
  • Quote Management. Customers & Merchants can communicate, accept or reject quotes.
  • Order Edit. Merchants can edit orders or quotes - add/remove item, update quantity & price management and more.
  • Company Approvals. Companies can mandate approvals from company admins before employees can finalize a cart.
  • Merchant Approvals. Merchants can set up approval processes for orders, ensuring compliance with business rules before fulfillment.
  • Promotions. Customers can apply manual and automatic promotions to their cart.
  • Free Shipping Nudge. Displays a component showing progress toward free shipping.
  • Full ecommerce support
    • Product Pages
    • Product Collections & Categories
    • Cart & Checkout
    • User Accounts
    • Order Details
  • Full Next.js 15 support
    • App Router
    • Caching
    • Server components/actions
    • Streaming
    • Static Pre-Rendering

 

Demo

Quote Management

image  

Company Management

image  

Approval Management

image  

Product Page

image  

Cart Summary

image  

 

Quickstart

Setup Infrastructure (Enhanced Version)

# Clone the repository
git clone https://github.com/NB-ENTOO/b2b-starter-medusa.git

# Start infrastructure services with Docker
cd "docker compose"
docker-compose up -d

# Wait for services to be ready (about 30 seconds)
# Check service status: docker-compose ps

Setup Medusa project

## Setup Backend

# Go to the folder
cd ../backend

# Clone .env.template
cp .env.template .env

# Install dependencies
yarn install

# Install dependencies, setup database & seed data
# Note: The enhanced seed script will automatically:
# - Set up MinIO file storage with processed product images
# - Configure MeiliSearch with product indexing
# - Create sample products with proper file storage
yarn install && yarn medusa db:create && yarn medusa db:migrate && yarn run seed && yarn medusa user -e admin@test.com -p supersecret -i admin

# Start Medusa project - backend & admin
yarn dev

## Setup Storefront

# Go to folder
cd ../storefront

# Clone .env.template
cp .env.template .env

# Install dependencies
yarn install

Setup publishable key

  • ✅ Visit Admin: Publishable Key
    • Credentials:
      • email: admin@test.com
      • password: supersecret
  • ✅ Copy token key of "Webshop"
  • ✅ Open file - storefront/.env
  • ✅ Add token to this var - NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
# Start Medusa storefront
yarn dev

Visit the following links to see the Medusa storefront & admin

🎉 Enhanced Features Available

After setup, you'll have access to these additional features:

  • 🔍 Search Functionality - Try the search bar in the storefront (⌘K or Ctrl+K)
  • 📦 File Storage - Product images are served from your local MinIO instance
  • 📊 Search Analytics - MeiliSearch dashboard at http://localhost:7700
  • 🗄️ File Management - MinIO console at http://localhost:9001 (admin/password: medusaminio)

 

Update

Some general guidelines for when you're updating this Starter to a newer version.

Update packages

Run yarn install in both projects to update you're packages to the latest versions.

Run migrations

To reflect any changes made to data models, make sure to run npx medusa db:migrate in the backend project.

Note: are you updating from a version of this Starter that didn't have the Approval module yet? Run npx medusa exec src/scripts/create-approval-settings.ts in the backend project to add approval settings to all existing companies.

Resources

Learn more about Medusa

Learn more about Next.js

 

Contributors

About

Official Medusa B2B Starter template. Features common B2B ecommerce requirements and can be easily adapted and extended.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.9%
  • Other 1.1%