Note: Looking for Next.js Commerce v1? View the code, demo, and release notes
A Next.js 13 and App Router-ready ecommerce template, built with Medusa, featuring:
- Next.js App Router
- Optimized for SEO using Next.js's Metadata
- React Server Components (RSCs) and Suspense
- Server Actions for mutations
- Edge Runtime
- New fetching and caching paradigms
- Dynamic OG images
- Styling with Tailwind CSS
- Automatic light/dark mode based on system settings
Medusa is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any system that needs foundational commerce primitives. All modules are open-source and freely available on NPM.
Learn more about Medusa’s architecture and commerce modules in Medusa's documentation.
Please refer to the documentation to learn about required tools for the Medusa Backend.
1. Run create-medusa-app
with the nextjs-commerce
starter:
npx create-medusa-app@nextjs-commerce
This will create a new main folder with two subfolders for Medusa and Next.js Commerce respectively.
2. Create a Postgres database named vercel-commerce
and make sure the Postgres server is running locally.
3. Inside your newly created nextjs-commerce
project, change to the medusa
folder and seed the database:
cd nextjs-commerce/medusa
yarn seed
This will provide you with some demo products and the necessary product categories to fill out the homepage.
From the medusa
subfolder, run:
yarn start
Your Medusa server should now be running on localhost:9000.
1. You will need to use the environment variables defined in .env.example
to run Next.js Commerce. Copy the contents of .env.example to a .env file in the root of your Next.js Commerce project, and make sure the NEXT_PUBLIC_MEDUSA_BACKEND_API environment variable points to your Medusa backend domain (default: http://localhost:9000).
Note: You should not commit your
.env
file or it will expose secrets.
2. From the nextjs-commerce
subfolder, run:
yarn dev
Your app should now be running on localhost:3000.