Search for a command to run...
In this guide, you'll learn how to install Medusa DTC Starter by Gorgo, configure both apps, and connect your first integration.
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.
yarn dlx create-medusa-app@latest --repo-url https://github.com/gorgojs/medusa-dtc-startertells 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.
Clone the repository and install dependencies:
1git clone https://github.com/gorgojs/medusa-dtc-starter.git2cd medusa-dtc-starter3yarn installCreate the backend's environment file and point at a real database:
Terminalcp apps/backend/.env.template apps/backend/.env
apps/backend/.envDATABASE_URL=postgres://postgres:@localhost:5432/medusa-dtc-starter
Run the migrations, create an admin user, seed the initial data, and start the backend:
1cd apps/backend2yarn medusa db:migrate3yarn medusa user -e admin@medusajs.com -p supersecret4yarn seed5yarn devOpen the Admin dashboard at , log in, and copy the publishable API key from Settings → Publishable API Keys.
Create the storefront's environment file with that key:
Terminalcp apps/storefront/.env.template apps/storefront/.env.local
apps/storefront/.env.localNEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_6c3...
Start the storefront:
1cd apps/storefront2yarn devThe 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.
Before the backend can run, set a real value for and :
apps/backend/.env1DATABASE_URL=postgres://postgres:@localhost:5432/medusa-dtc-starter2INTEGRATION_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.local1NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_6c3...2NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:90003NEXT_PUBLIC_DEFAULT_REGION=en4NEXT_PUBLIC_BASE_URL=https://localhost:80005NEXT_PUBLIC_STRIPE_KEY=6MEDUSA_CLOUD_S3_HOSTNAME=7MEDUSA_CLOUD_S3_PATHNAME=8NODE_ENV=development9REVALIDATE_SECRET=supersecret10NEXT_PUBLIC_SITE_NAME="Gorgo Medusa Store"11NEXT_PUBLIC_ADDRESS_AUTOCOMPLETE_PROVIDER=dadata12NEXT_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.
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.
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.
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.
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.
, , 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.