A modern e-commerce platform built with Next.js, Payload CMS, and Stripe, featuring multi-tenant architecture and platform fees capabilities.
- 🏬 Multi-tenant architecture
- 🌐 Vendor subdomains
- 🎨 Custom merchant storefronts
- 💳 Stripe Connect integration
- 💰 Automatic platform fees
- ⭐ Product ratings & reviews
- 📚 User purchase library
- 🧑💼 Role-based access control
- 🛠️ Admin dashboard
- 🧾 Merchant dashboard
- 🧱 Payload CMS backend
- 🗂️ Category & product filtering
- 🔍 Search functionality
- 🖼️ Image upload support
- ⚙️ Built with Next.js 15
- 🎨 TailwindCSS V4 styling
- 💅 ShadcnUI components
- Node.js 18+ or Bun 1.0+
- MongoDB Atlas account
- Stripe account
- Vercel account (for Blob storage)
# Clone the repository
git clone https://github.com/code-with-antonio/next15-multitenant-ecommerce.git
cd multitenant-ecommerce
# Install dependencies
bun install
# Copy environment variables
cp .env.example .env# Clone the repository
git clone https://github.com/code-with-antonio/next15-multitenant-ecommerce.git
cd multitenant-ecommerce
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env# Clone the repository
git clone https://github.com/code-with-antonio/next15-multitenant-ecommerce.git
cd multitenant-ecommerce
# Install dependencies
yarn install
# Copy environment variables
cp .env.example .envUpdate the .env file with your configuration:
# Database
DATABASE_URI=your_mongodb_uri
PAYLOAD_SECRET=your_payload_secret
# Global
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_ROOT_DOMAIN=localhost:3000
NEXT_PUBLIC_ENABLE_SUBDOMAIN_ROUTING=false
# Stripe
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
# Vercel Blob
BLOB_READ_WRITE_TOKEN=your_vercel_blob_tokenThe platform supports wildcard subdomain routing, allowing each vendor to have their own unique subdomain (e.g., vendorname.yourdomain.com). This feature is controlled by the NEXT_PUBLIC_ENABLE_SUBDOMAIN_ROUTING environment variable.
By default, subdomain routing is disabled in development (NEXT_PUBLIC_ENABLE_SUBDOMAIN_ROUTING="false"), and all stores are accessed through routes like:
http://localhost:3000/tenants/[tenant-slug]
To enable subdomain routing in production:
-
Configure your DNS provider with a wildcard subdomain record:
*.yourdomain.com → your-vercel-deployment.vercel.app -
Update your environment variables:
NEXT_PUBLIC_ROOT_DOMAIN=yourdomain.com NEXT_PUBLIC_ENABLE_SUBDOMAIN_ROUTING="true"
Once enabled, stores will be accessible through their unique subdomains:
https://tenantslug.yourdomain.com
- Make sure your hosting provider (e.g., Vercel) supports wildcard subdomains
- Each subdomain will automatically serve the corresponding store's content
- SSL certificates should be configured to support wildcard subdomains
- The main marketplace will remain accessible at your root domain
# Using Bun
bun run db:fresh
bun run db:seed
# Using npm
npm run db:fresh
npm run db:seed
# Using yarn
yarn db:fresh
yarn db:seed# Using Bun
bun run dev
# Using npm
npm run dev
# Using yarn
yarn devOpen http://localhost:3000 with your browser to see the result.
dev- Start development serverbuild- Build for productionstart- Start production serverlint- Run ESLintgenerate:types- Generate Payload CMS typesdb:fresh- Reset and migrate databasedb:seed- Seed database with initial data
