Стартер Medusa DTC

от Medusa

Готовый к продакшену стартер для интернет-магазинов модели D2C на базе Medusa и Next.js. Включает полнофункциональную витрину с возможностью просмотра товаров, корзиной, оформлением заказа, личными кабинетами покупателей и системой управления заказами.

Стартер Medusa DTC

Medusa DTC Starter

Documentation | Website

Building blocks for digital commerce

Medusa DTC Starter

A production-ready monorepo starter for direct-to-consumer ecommerce stores powered by Medusa and Next.js. Includes a fully featured storefront with product browsing, cart, checkout, customer accounts, and order management.

Features

  • All of Medusa's commerce features
  • Multi-region support with automatic country detection
  • Product catalog with variant selection
  • Cart with promotion codes
  • Multi-step checkout with shipping and payment
  • Customer accounts with order history and address management
  • Order transfer between accounts

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/dtc-starter.git
2cd dtc-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-dtc-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

The storefront is configured via environment variables in :

VariableDescriptionDefault
Publishable API key from your Medusa backend
URL of your Medusa backend
Default region country code
Base URL of the storefront
Stripe publishable key (optional)

Resources