Command Palette

Search for a command to run...

Getting Started with Medusa DTC Starter

In this guide, you'll learn how to install Medusa DTC Starter by Gorgo, configure both apps, and connect your first integration.

Requirements

  • Node.js v20 or later
  • PostgreSQL v15 or later
  • npm, yarn, or pnpm

Installation

Install the starter one of two ways: scaffold a new project with Medusa's own CLI, or clone the repository and configure each app by hand.

Approach 1: Install with Medusa Application

yarn dlx create-medusa-app@latest --repo-url https://github.com/gorgojs/medusa-dtc-starter

tells to scaffold from the specified repository instead of the official Medusa starter, but the usual prompts for a project name and a database stay the same. By default, the command also runs migrations, creates an admin user, and seeds the database. Pass to skip all three.

Approach 2: Install Separately

  1. Clone the repository and install dependencies:

    1git clone https://github.com/gorgojs/medusa-dtc-starter.git
    2cd medusa-dtc-starter
    3yarn install
  2. Create the backend's environment file and point at a real database:

    Terminal
    cp apps/backend/.env.template apps/backend/.env
    apps/backend/.env
    DATABASE_URL=postgres://postgres:@localhost:5432/medusa-dtc-starter
  3. Run the migrations, create an admin user, seed the initial data, and start the backend:

    1cd apps/backend
    2yarn medusa db:migrate
    3yarn medusa user -e admin@medusajs.com -p supersecret
    4yarn seed
    5yarn dev
  4. Open the Admin dashboard at , log in, and copy the publishable API key from Settings → Publishable API Keys.

  5. Create the storefront's environment file with that key:

    Terminal
    cp apps/storefront/.env.template apps/storefront/.env.local
    apps/storefront/.env.local
    NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_6c3...
  6. Start the storefront:

    1cd apps/storefront
    2yarn dev

The storefront runs at . The repository root is set up for pnpm, so there starts both apps at once. With npm or yarn, start each app from its own directory.


Configuration

Before the backend can run, set a real value for and :

apps/backend/.env
1DATABASE_URL=postgres://postgres:@localhost:5432/medusa-dtc-starter
2INTEGRATION_ENCRYPTION_KEY=supersecret

encrypts the secret fields the Integration Module stores. Change the value before production.

For the storefront, you need at least the publishable API key from your Medusa backend:

apps/storefront/.env.local
1NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_6c3...
2NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000
3NEXT_PUBLIC_DEFAULT_REGION=en
4NEXT_PUBLIC_BASE_URL=https://localhost:8000
5NEXT_PUBLIC_STRIPE_KEY=
6MEDUSA_CLOUD_S3_HOSTNAME=
7MEDUSA_CLOUD_S3_PATHNAME=
8NODE_ENV=development
9REVALIDATE_SECRET=supersecret
10NEXT_PUBLIC_SITE_NAME="Gorgo Medusa Store"
11NEXT_PUBLIC_ADDRESS_AUTOCOMPLETE_PROVIDER=dadata
12NEXT_PUBLIC_ADDRESS_AUTOCOMPLETE_PROVIDER_API_KEY=

The rest already ship with working localhost defaults. sets the store name shown in the header, footer, and checkout, and it also feeds the markup and the endpoint. is only needed if you use Stripe. is only needed for the built-in address autocomplete, see the Set Up Address Autocomplete documentation. and are only needed when deploying to Medusa Cloud. has to match the same variable in , because the backend sends that value with every revalidation webhook. Change it before production.


Add Integrations

The Integration Module () is already registered in with an empty array, so there's nothing to wire up before you can add one. Once the backend is running, add a payment, fulfillment, or ERP integration and configure it from Medusa Admin, see the Browse and Add an Integration documentation.


Troubleshooting

Storefront Can't Reach the Backend, or Shows a Region Error

If the storefront's logs show , the cause is one of two things: either isn't set or points to the wrong place, or the backend has no region configured yet. Check that the backend is running and reachable at that URL. If there really are no regions, the seed script creates several, see the Customize Seed Data documentation.

Stripe Checkout Doesn't Load

means the storefront tried to render Stripe Elements without a Stripe publishable key set. means no Stripe payment session exists on the cart yet. This usually happens because the selected region has no Stripe provider configured.

Address Autocomplete Doesn't Work

If the address field doesn't suggest anything as you type during checkout, the DaData key is probably missing. Create an account on DaData, set your key in , and leave set to . See the Set Up Address Autocomplete documentation for configuring autocomplete and connecting a different provider.

CORS Errors in the Browser Console

, , and in the backend's are allow-lists. If you move the storefront or Admin to a different port or domain, add that origin to the matching variable and restart the backend.

Edited Aug 21, 2026·Edit this page