Docs

B2B Starter: Foundation for a modern B2B setup

by Medusa

Let employees purchase on behalf of their company while companies manage users, invite employees, set purchasing rules, and track orders. Ships with pre-built B2B purchase flows out of the box — draft orders, quotes, cart approvals, spending limits, and bulk add-to-cart. Manage large catalogs with millions of SKUs and configure custom price lists and promotions for each B2B client, all within the Medusa Admin.

B2B Starter: Foundation for a modern B2B setup

Medusa B2B Starter

Documentation | Website

Building blocks for digital commerce

Medusa B2B Starter

An official Medusa starter for B2B ecommerce, built with Medusa and Next.js 15. It covers common business-to-business requirements out of the box and is designed to be customized and extended.

Features

  • Company management — Create and manage companies, invite employees, and assign roles
  • Spending limits — Set per-employee spending limits with configurable reset frequencies
  • Approval workflows — Require admin or sales manager approval before orders are placed
  • Quote management — Allow customers and merchants to negotiate quotes with messaging
  • Order editing — Adjust order items, pricing, and totals after placement
  • Bulk add-to-cart — Add multiple products to the cart at once
  • Promotions — Manual and automatic promotion support with free shipping progress
  • Full ecommerce — Products, collections, cart, checkout, and order history

Getting Started

Deploy with Medusa Cloud

The fastest way to get started is deploying with Medusa Cloud:

  1. Create a Medusa Cloud account
  2. Deploy this starter directly from your dashboard

Local Installation

**Prerequisites:

  1. Clone the repository and install dependencies:
1git clone https://github.com/medusajs/b2b-starter.git
2cd b2b-starter
3pnpm install
  1. Set up environment variables for the backend:
cp apps/backend/.env.template apps/backend/.env
  1. Set the database URL in :
1# Replace with actual database URL, make sure the database exists.
2DATABASE_URL=postgres://postgres:@localhost:5432/medusa-b2b-starter
  1. Run migrations:
1cd apps/backend
2pnpm medusa db:migrate
  1. Add admin user:
1cd apps/backend
2pnpm medusa user -e admin@test.com -p supersecret
  1. Start Medusa backend:
1cd apps/backend
2pnpm dev
  1. Open the admin dashboard at and log in. Retrieve your publishable API key at Settings > Publishable API key.

  2. Set up environment variables for the storefront:

cp apps/storefront/.env.template apps/storefront/.env.local
  1. Update with your Medusa publishable API key:
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_6c3...
  1. Start storefront:
1cd apps/storefront
2pnpm dev

The storefront runs on .

You can slo run the following command from the root to start both backend and storefront:

pnpm dev

Configuration

Backend ()

VariableDescription
PostgreSQL connection string
Redis connection string (optional)
Secret used to sign JWT tokens
Secret used to sign session cookies

Storefront ()

VariableDescription
URL of the Medusa backend
Public URL of the storefront
Default region code (e.g. )
Secret for on-demand cache revalidation

Resources

License

Licensed under the MIT License.