A comprehensive, multi-store E-commerce Admin Dashboard and Storefront built with modern web technologies. This application serves as a centralized content management system for managing products, categories, billboards, orders, and store attributes across multiple storefronts, with integrated payment processing.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: Radix UI, Lucide Icons, Sonner (Toasts)
- Database: PostgreSQL (via Prisma ORM)
- Authentication: NextAuth.js v5 with Prisma Adapter
- Payment Processing: Stripe
- State Management: Zustand
- Data Fetching: TanStack Query
- Forms: React Hook Form + Zod
- Image Storage: Cloudinary
- Date Handling: date-fns
- Email: Resend
- Multi-Store Architecture: Create and manage multiple distinct stores from a single dashboard account
- Product Management: Full CRUD capabilities for products with:
- Price management
- Featured and archived status
- Multiple images per product
- Category, size, and color associations
- Category Management: Organize products into hierarchical categories with billboard associations
- Billboard Management: Create and manage promotional banner images for stores
- Attribute Management: Define and manage product attributes (Sizes and Colors)
- Order Management: View and track all orders with payment status, customer details, and order items
- Store Settings: Configure individual store settings
- Analytics Dashboard: Overview of store performance and metrics
- Product Catalog: Browse products by category
- Product Details: View detailed product information with image galleries
- Shopping Cart: Add products to cart with persistent storage
- Checkout: Secure checkout process via Stripe
- Order Tracking: View order status after payment
- NextAuth.js Integration: Secure authentication with multiple providers
- Two-Factor Authentication: Enhanced security with 2FA support
- Role-Based Access Control: Admin and User roles
- Email Verification: Account verification via email
- Password Reset: Secure password reset functionality
- OAuth Providers: Support for Google and GitHub authentication
- Stripe Integration: Secure payment processing
- Webhook Handling: Automatic order updates after payment
- Order Management: Automatic order status updates and product archiving
Before you begin, ensure you have the following ready:
- Node.js: v18 or higher
- PostgreSQL: A running instance of PostgreSQL database
- Stripe Account: For payment processing (test mode for development)
- Cloudinary Account: For image upload credentials
- Resend Account: For email functionality (optional, for email verification)
Create a .env file in the root directory and configure the following variables:
# Database
DATABASE_URL="postgresql://user:password@host:port/db_name?schema=public"
# NextAuth.js
AUTH_SECRET="your-secret-key-here" # Generate with: openssl rand -base64 32
AUTH_URL="http://localhost:3000" # Your application URL
# OAuth Providers (Optional)
AUTH_GOOGLE_ID="your-google-client-id"
AUTH_GOOGLE_SECRET="your-google-client-secret"
AUTH_GITHUB_ID="your-github-client-id"
AUTH_GITHUB_SECRET="your-github-client-secret"
# Email (Resend)
RESEND_API_KEY="your-resend-api-key"
# Cloudinary
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="your-cloudinary-cloud-name"
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..." # Get from Stripe Dashboard β Webhooks
# Application
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:3000"-
Clone the repository:
git clone https://github.com/Saeed-Altout/Ecommerce-Admin-CMS.git cd vendo -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Setup Database:
Push the Prisma schema to your database:
npx prisma db push
Generate Prisma Client:
npx prisma generate
-
Run the development server:
npm run dev
-
Open http://localhost:3000 with your browser to see the result.
npm run dev: Starts the development servernpm run build: Builds the application for productionnpm run start: Starts the production servernpm run lint: Runs ESLint to check for code quality issuesnpx prisma studio: Opens a GUI to view and edit your database datanpx prisma db push: Pushes Prisma schema changes to the databasenpx prisma generate: Generates Prisma Client
vendo/
βββ app/ # Next.js App Router pages
β βββ (root)/ # Public storefront routes
β β βββ (routes)/ # Public pages (home, cart, products, categories)
β β βββ _components/ # Public components (navbar, footer)
β βββ api/ # API routes
β β βββ [storeId]/ # Store-specific API endpoints
β β β βββ checkout/ # Stripe checkout endpoint
β β β βββ products/ # Product CRUD endpoints
β β β βββ categories/ # Category CRUD endpoints
β β β βββ billboards/ # Billboard CRUD endpoints
β β β βββ sizes/ # Size CRUD endpoints
β β β βββ colors/ # Color CRUD endpoints
β β βββ webhook/ # Stripe webhook handler
β β βββ auth/ # NextAuth.js endpoints
β β βββ stores/ # Store management endpoints
β βββ auth/ # Authentication pages
β βββ dashboard/ # Admin dashboard
β β βββ [storeId]/ # Store-specific dashboard
β β βββ (routes)/ # Dashboard routes (products, orders, etc.)
β βββ getting-started/ # Getting started page
βββ components/ # React components
β βββ auth/ # Authentication components
β βββ ui/ # Reusable UI components
β βββ store/ # Storefront components
β βββ modals/ # Modal components
βββ lib/ # Utility libraries
β βββ db.ts # Prisma database client
β βββ stripe.ts # Stripe client
β βββ auth.ts # NextAuth configuration
β βββ utils.ts # Utility functions
βββ prisma/ # Prisma schema and migrations
β βββ schema.prisma # Database schema
βββ data/ # Data access layer
βββ services/ # API service functions
βββ hooks/ # Custom React hooks
βββ schemas/ # Zod validation schemas
βββ providers/ # React context providers
GET /api/stores- List all storesPOST /api/stores- Create a new storeGET /api/stores/[storeId]- Get store detailsPATCH /api/stores/[storeId]- Update storeDELETE /api/stores/[storeId]- Delete store
GET /api/[storeId]/products- List productsPOST /api/[storeId]/products- Create productGET /api/[storeId]/products/[productId]- Get product detailsPATCH /api/[storeId]/products/[productId]- Update productDELETE /api/[storeId]/products/[productId]- Delete product
GET /api/[storeId]/categories- List categoriesPOST /api/[storeId]/categories- Create categoryGET /api/[storeId]/categories/[categoryId]- Get category detailsPATCH /api/[storeId]/categories/[categoryId]- Update categoryDELETE /api/[storeId]/categories/[categoryId]- Delete category
GET /api/[storeId]/billboards- List billboardsPOST /api/[storeId]/billboards- Create billboardGET /api/[storeId]/billboards/[billboardId]- Get billboard detailsPATCH /api/[storeId]/billboards/[billboardId]- Update billboardDELETE /api/[storeId]/billboards/[billboardId]- Delete billboard
POST /api/[storeId]/checkout- Create Stripe checkout sessionPOST /api/webhook- Stripe webhook handler (updates orders after payment)
-
Install Stripe CLI:
# macOS brew install stripe/stripe-cli/stripe # Windows (via Scoop) scoop install stripe
-
Login to Stripe:
stripe login
-
Forward webhooks to local server:
stripe listen --forward-to localhost:3000/api/webhook
-
Copy the webhook signing secret and add it to your
.envfile asSTRIPE_WEBHOOK_SECRET
- Go to Stripe Dashboard
- Click "Add endpoint"
- Set endpoint URL:
https://your-domain.com/api/webhook - Select event:
checkout.session.completed - Copy the webhook signing secret to your environment variables
The application uses PostgreSQL with Prisma ORM. Key models include:
- User: Authentication and user management
- Store: Multi-store support
- Product: Product catalog with images, prices, and attributes
- Category: Product categorization
- Billboard: Promotional banners
- Size & Color: Product attributes
- Order: Order management
- OrderItem: Order line items
See prisma/schema.prisma for complete schema definition.
- User registers/logs in via NextAuth.js
- Email verification required (if enabled)
- Two-factor authentication (optional)
- Role-based access control (Admin/User)
- Session management via JWT
- Customer browses products on storefront
- Adds products to cart (stored in Zustand state)
- Proceeds to checkout
- Creates order in database (unpaid)
- Redirects to Stripe Checkout
- After payment, Stripe webhook updates order:
- Sets
isPaidtotrue - Updates customer address and phone
- Archives purchased products
- Sets
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
The application can be deployed to any platform supporting Next.js:
- Railway
- Render
- AWS Amplify
- DigitalOcean App Platform
- Webhook Fix Documentation - Detailed explanation of Stripe webhook integration fixes
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Developed by Saeed Altour