ProdDeck is a modern, server-side rendered e-commerce product management dashboard built with Next.js. It provides administrators with a comprehensive platform to manage products efficiently through CRUD operations, validated forms, cloud-based image uploads, and interactive data visualization dashboards.
π Live Demo: https://prod-deck.vercel.app
- Secure admin login system with username, email, and password authentication
- Session management using HTTP-only cookies (7-day expiration)
- Protected admin routes with middleware authentication
- Admin account creation functionality
- Logout functionality
- Create Products: Multi-step form with validation
- Step 1: Basic Information (name, description, category)
- Step 2: Pricing Information (price, stock, status)
- Step 3: Image Upload (Cloudinary integration)
- Step 4: Review & Submit
- Read Products: View all products in a responsive grid layout
- Product cards with images, pricing, stock, and category
- Product detail modal with full information
- Update Products: Edit existing products with pre-filled multi-step form
- Delete Products: Remove products with automatic image cleanup from Cloudinary
- Product status management (Draft/Active)
- Stock tracking
- Category organization
- Multiple image support (Cloudinary storage)
- Form validation using Zod schema
- Real-time form validation feedback
- Overview Statistics:
- Total Products count
- Total Sales (βΉ currency format)
- Total Orders count
- Product Status Chart: Interactive pie chart showing Active vs Draft products
- Stock Overview Chart: Bar chart displaying stock levels per product
- Sales Trend Chart: Area chart with monthly sales data
- Timeline filters (1 Week, 1 Month, 1 Year)
- Dummy data generation for preview
- Comparison with previous period
- Modern, dark-themed UI with gradient accents
- Responsive design (mobile, tablet, desktop)
- Glassmorphism effects with backdrop blur
- Smooth animations and transitions
- Interactive charts using Recharts
- Modal-based forms for better UX
- Empty state handling with helpful messages
- Cloudinary integration for cloud storage
- Automatic image upload during product creation/update
- Image deletion from Cloudinary when products are deleted
- Support for multiple images per product
- Image preview in product cards and detail views
- Server-side validation using Zod schemas
- Client-side form validation
- Type-safe form handling
- Error messages and user feedback
- Next.js 16.1.1 - React framework with App Router
- React 19.2.3 - UI library
- TypeScript - Type safety
- Tailwind CSS 4 - Styling
- Recharts 2.15.4 - Data visualization
- Lucide React - Icons
- Next.js Server Actions - Server-side logic
- MongoDB - Database (via Mongoose)
- Mongoose 9.0.2 - ODM for MongoDB
- bcryptjs 3.0.3 - Password hashing
- HTTP-only cookies - Secure session management
- Cloudinary 2.8.0 - Image storage and management
- Zod 4.2.1 - Schema validation
- Node.js 18+ and npm/yarn
- MongoDB database (local or cloud like MongoDB Atlas)
- Cloudinary account for image storage
-
Clone the repository
git clone <repository-url> cd ProdDeck
-
Install dependencies
npm install
-
Set up environment variables Create a
.env.localfile in the root directory:MONGODB_URI=your_mongodb_connection_string CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
-
Run the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
The following dummy admin credentials can be used to access the dashboard for testing purposes:
Username: Admin1
Email: admin@proddeck.com
Password: admin123
- These are test/demo credentials only
- DO NOT use these credentials in production
- Change passwords immediately after first login in production environments
- Use strong, unique passwords for production
- Never commit real credentials to version control
You can create new admin accounts in two ways:
- Log in with an existing admin account (use the dummy credentials above)
- Navigate to the sidebar
- Click on "Create Admin"
- Fill in the form with:
- Username
- Password
- Submit to create a new admin account
You can create an admin account directly in MongoDB or use a script:
// Example: Create admin using Node.js script
const bcrypt = require('bcryptjs');
const mongoose = require('mongoose');
async function createAdmin() {
await mongoose.connect(process.env.MONGODB_URI);
const hashedPassword = await bcrypt.hash('admin123', 10);
await mongoose.connection.db.collection('admins').insertOne({
username: 'admin',
email: 'admin@proddeck.com',
password: hashedPassword,
role: 'admin',
createdAt: new Date(),
updatedAt: new Date()
});
console.log('Admin created successfully!');
process.exit(0);
}
createAdmin();Note: If you need to set up the dummy admin account, run the script above or create it manually through the dashboard after setting up your first admin account.
ProdDeck/
βββ app/
β βββ admin/ # Admin dashboard routes
β β βββ components/ # Admin-specific components
β β β βββ CreateAdminModal.tsx
β β β βββ DeleteProductButton.tsx
β β β βββ LogoutButton.tsx
β β β βββ ProductStatusChart.tsx
β β β βββ SalesTrendChart.tsx
β β β βββ SidebarNav.tsx
β β β βββ StockOverviewChart.tsx
β β βββ products/ # Product management routes
β β β βββ [id]/
β β β β βββ edit/ # Edit product page
β β β βββ components/ # Product components
β β β β βββ CreateProductModal.tsx
β β β β βββ EditProductModal.tsx
β β β β βββ ProductDetailModal.tsx
β β β β βββ ProductItem.tsx
β β β β βββ ProductsList.tsx
β β β β βββ ProductsPageClient.tsx
β β β βββ new/ # Create product page
β β β β βββ steps/ # Multi-step form steps
β β β β βββ StepBasicInfo.tsx
β β β β βββ StepImages.tsx
β β β β βββ StepPricingInfo.tsx
β β β β βββ StepReview.tsx
β β β βββ actions.ts # Product server actions
β β β βββ MultiStepForm.tsx
β β β βββ page.tsx
β β βββ actions.ts # Admin server actions
β β βββ layout.tsx # Admin layout with sidebar
β β βββ page.tsx # Dashboard home
β βββ components/ # Shared components
β β βββ AlertProvider.tsx
β βββ login/ # Login page
β β βββ actions.ts
β β βββ page.tsx
β βββ logout/ # Logout action
β β βββ actions.ts
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page (redirects to login)
β βββ globals.css # Global styles
βββ lib/
β βββ cloudinary.ts # Cloudinary configuration
β βββ db.ts # MongoDB connection
β βββ validators/ # Zod validation schemas
β βββ product.ts
β βββ productSteps.ts
βββ models/ # Mongoose models
β βββ Admin.ts
β βββ Order.ts
β βββ Product.ts
βββ public/ # Static assets
βββ package.json
βββ tsconfig.json
βββ README.md
- Navigate to
http://localhost:3000 - You'll be redirected to
/login - Enter your admin credentials (username, email, password)
- Upon successful login, you'll be redirected to
/admindashboard
- Click "Add Product" button on the Products page
- Fill in the multi-step form:
- Step 1: Enter product name, description, and category
- Step 2: Set price, stock quantity, and status (Draft/Active)
- Step 3: Upload product image(s)
- Step 4: Review all information and submit
- Product will be created and appear in the products list
- Navigate to Products page
- Click "Edit" on any product card
- Modify the information in the multi-step form
- Submit to save changes
- Navigate to Products page
- Click "Delete" on any product card
- Confirm deletion
- Product and its images will be permanently removed
The dashboard provides several analytics views:
- Overview Cards: Quick stats at the top
- Product Status Chart: Visual breakdown of Active vs Draft products
- Stock Overview: Bar chart showing stock levels for each product
- Sales Trend: Monthly sales data with timeline filters
- Log in as an existing admin
- Click "Create Admin" in the sidebar
- Fill in the form with new admin details
- Submit to create the account
- Password hashing using bcrypt (10 rounds)
- HTTP-only cookies for session management
- Server-side authentication checks
- Protected routes with middleware
- Input validation on both client and server
- Secure image uploads via Cloudinary
- Dark Theme: Modern dark color scheme with gradient accents
- Responsive Design: Works seamlessly on all device sizes
- Glassmorphism: Modern UI with backdrop blur effects
- Smooth Animations: Transitions and hover effects
- Empty States: Helpful messages when no data is available
- Loading States: Visual feedback during async operations
- Error Handling: Clear error messages for user feedback
{
username: string (required, unique)
email: string (required, unique)
password: string (required, hashed)
role: string (default: "admin")
createdAt: Date
updatedAt: Date
}{
name: string (required)
description: string (required)
price: number (required, positive)
stock: number (default: 0)
category: string (optional)
images: string[] (default: [])
status: "draft" | "active" (default: "draft")
createdAt: Date
updatedAt: Date
}{
products: [{
productId: ObjectId (ref: Product)
quantity: number
price: number
}]
totalAmount: number
status: "pending" | "completed" | "cancelled" (default: "pending")
createdAt: Date
updatedAt: Date
}npm run build
npm startMake sure to set all required environment variables in your production environment:
MONGODB_URICLOUDINARY_CLOUD_NAMECLOUDINARY_API_KEYCLOUDINARY_API_SECRETNODE_ENV=production
-
MongoDB Connection Error
- Verify
MONGODB_URIis correct in.env.local - Ensure MongoDB is running or Atlas cluster is accessible
- Verify
-
Cloudinary Upload Fails
- Check Cloudinary credentials in
.env.local - Verify API key permissions
- Check Cloudinary credentials in
-
Admin Login Fails
- Ensure admin account exists in database
- Verify password is correctly hashed
- Check cookie settings in browser
-
Images Not Displaying
- Verify Cloudinary configuration
- Check image URLs in database
- Ensure CORS settings allow image access
npm run devNote: This is a production-ready e-commerce management system. Ensure all security best practices are followed when deploying to production.