"Zing in Every Bite!" โก
A production-ready, full-stack pizza delivery application built with React, Node.js, Express, MongoDB, and integrated payment processing via Razorpay. Features real-time order tracking with Socket.IO, email notifications, role-based authentication, and a modern responsive UI.
- Features
- Tech Stack
- Architecture
- Getting Started
- Environment Variables
- API Endpoints
- Database Schema
- Real-Time Features
- Future Improvements
| Role | Password | |
|---|---|---|
| Customer | test@pizzazing.com |
test123 |
| Admin | admin@pizzazing.com |
admin123 |
- ๐ JWT Authentication with email verification & password reset
- ๐ Browse Menu with category filters (Veg, Non-Veg, Premium, Cheese Lovers)
- ๐ Size Selection - Small, Medium, Large with dynamic pricing
- ๐ ๏ธ Custom Pizza Builder - Build your own pizza step-by-step
- ๐ณ Razorpay Integration - Secure payment processing (Test Mode supported)
- ๐ฆ Real-Time Order Tracking - Live status updates via WebSocket
- ๐ง Email Notifications - Order confirmation, status updates, delivery alerts
- ๐ฑ Responsive Design - Works seamlessly on mobile, tablet, desktop
- ๐ Admin Dashboard - Overview of all orders, inventory, alerts
- ๐ Order Management - Update order status through the pipeline
- ๐ฆ Inventory Management - Track ingredient stock levels, set thresholds
โ ๏ธ Low Stock Alerts - Real-time notifications when stock runs low- ๐ฅ Customer View - See customer details, order history
- ๐ Real-Time Updates - Socket.IO for instant notifications
- ๐ก๏ธ Role-Based Access Control - Admin vs Customer permissions
- ๐ง Nodemailer Integration - SMTP email service
- ๐ Secure Password Hashing - bcrypt with salt rounds
- ๐ Input Validation - Server-side validation on all endpoints
- ๐ Stock Management - Automatic inventory deduction on orders
| Technology | Purpose |
|---|---|
| React 18 | UI Library |
| React Router v6 | Client-side routing |
| Tailwind CSS 3 | Styling framework |
| Vite | Build tool & dev server |
| Axios | HTTP client |
| Socket.IO Client | Real-time communication |
| Technology | Purpose |
|---|---|
| Node.js 18+ | Runtime environment |
| Express 5 | Web framework |
| MongoDB + Mongoose | Database & ODM |
| Socket.IO | WebSocket server |
| JWT | Authentication tokens |
| bcrypt | Password hashing |
| Razorpay SDK | Payment processing |
| Nodemailer | Email service |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLIENT (React) โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Pages โ โ Components โ โ Context/Hooks โ โ
โ โ - Login โ โ - Navbar โ โ - AuthContext โ โ
โ โ - Dashboard โ โ - PayBtn โ โ - useSocket โ โ
โ โ - Admin โ โ - Timeline โ โ - useToast โ โ
โ โ - Builder โ โ - Toast โ โ - usePayment โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP + WebSocket
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SERVER (Express) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Middleware โ โ
โ โ (CORS, Auth, Admin Check, Error Handler) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Routes โ โ Helpers โ โ Socket.IO โ โ
โ โ - /auth โ โ - emailSvc โ โ - order updates โ โ
โ โ - /orders โ โ - pricing โ โ - payment events โ โ
โ โ - /pizzas โ โ - notifier โ โ - inventory alerts โ โ
โ โ - /payment โ โ - socketCfg โ โ - admin broadcasts โ โ
โ โ - /inventoryโ โ โ โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MongoDB โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ Users โ โ Orders โ โ Pizzas โ โPayments โ โIngredientsโ โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Node.js 18+
- MongoDB (local or Atlas)
- Razorpay account (for payments)
- SMTP credentials (for emails)
- Clone the repository
git clone https://github.com/yourusername/pizzazing.git
cd pizzazing- Install backend dependencies
cd backend
npm install- Install frontend dependencies
cd ../frontend
npm install-
Set up environment variables (see Environment Variables)
-
Seed the database
cd backend
node test/seedPizzaZing.js- Start the backend server
npm run dev
# Server runs on http://localhost:5000- Start the frontend (new terminal)
cd frontend
npm run dev
# App runs on http://localhost:5173Create a .env file in the backend directory:
# Server
PORT=5000
NODE_ENV=development
# MongoDB
MONGODB_URI=mongodb://localhost:27017/pizza_app
# JWT
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRES_IN=7d
# Razorpay (Get from Razorpay Dashboard)
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxx
RAZORPAY_KEY_SECRET=your-razorpay-secret
# Email (SMTP)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# Frontend URL (for email links)
FRONTEND_URL=http://localhost:5173| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | ๐ Public |
| POST | /api/auth/login |
Login & get JWT | ๐ Public |
| GET | /api/auth/verify-email |
Verify email token | ๐ Public |
| POST | /api/auth/forgot-password |
Request password reset | ๐ Public |
| POST | /api/auth/reset-password |
Reset password with token | ๐ Public |
| GET | /api/auth/me |
Get current user | ๐ JWT |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/pizzas |
Get all pizza presets | ๐ JWT |
| GET | /api/pizzas/:id |
Get single pizza | ๐ JWT |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/orders/create-preset |
Create order from preset | ๐ JWT |
| POST | /api/orders/create-custom |
Create custom pizza order | ๐ JWT |
| GET | /api/orders/my |
Get user's orders | ๐ JWT |
| GET | /api/orders/:id |
Get order details | ๐ JWT |
| GET | /api/orders/admin |
Get all orders (Admin) | ๐ Admin |
| PATCH | /api/orders/admin/:id/status |
Update order status (Admin) | ๐ Admin |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/payments/create |
Create Razorpay order | ๐ JWT |
| POST | /api/payments/verify |
Verify payment signature | ๐ JWT |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/inventory/public |
Get available ingredients | ๐ JWT |
| GET | /api/inventory/ingredients |
Get all ingredients (Admin) | ๐ Admin |
| PUT | /api/inventory/ingredients/:id |
Update ingredient (Admin) | ๐ Admin |
{
name: String,
email: String (unique),
password: String (hashed),
role: 'user' | 'admin',
isVerified: Boolean,
verificationToken: String,
resetPasswordToken: String,
resetPasswordExpires: Date,
phone: String,
addresses: [{ label, street, city, state, pincode, isDefault }],
favorites: [ObjectId -> PizzaPreset],
loyaltyPoints: Number,
totalOrders: Number
}{
user: ObjectId -> User,
items: [{
type: 'preset' | 'custom',
preset: ObjectId -> PizzaPreset,
ingredients: [ObjectId -> Ingredient],
name: String,
price: Number,
quantity: Number,
size: 'small' | 'medium' | 'large'
}],
size: String,
totalAmount: Number,
paymentStatus: 'pending' | 'paid' | 'failed' | 'refunded',
orderStatus: 'pending' | 'received' | 'in_kitchen' | 'out_for_delivery' | 'delivered' | 'cancelled',
razorpayOrderId: String,
razorpayPaymentId: String,
deliveryAddress: Object,
estimatedDelivery: Date,
rating: Number,
review: String
}{
name: String (unique),
description: String,
category: 'veg' | 'non-veg' | 'premium' | 'cheese-lovers',
basePrice: Number,
prices: { small: Number, medium: Number, large: Number },
ingredients: [ObjectId -> Ingredient],
isActive: Boolean,
isBestseller: Boolean,
isNewArrival: Boolean,
spiceLevel: 'mild' | 'medium' | 'hot' | 'extra-hot',
rating: Number,
totalOrders: Number
}{
name: String (unique),
type: 'base' | 'sauce' | 'cheese' | 'veggie' | 'meat',
price: Number,
stock: Number,
threshold: Number,
isActive: Boolean
}The app uses Socket.IO for real-time communication:
| Event | Payload | Description |
|---|---|---|
ORDER_STATUS_UPDATE |
{ orderId, status, updatedAt } |
Order status changed |
PAYMENT_SUCCESS |
{ orderId, paymentId } |
Payment completed |
NEW_ORDER_CREATED |
{ orderId, user, totalItems } |
New order (to admins) |
LOW_STOCK_ALERT |
{ name, stock, threshold } |
Ingredient low (to admins) |
user-{userId}- Personal notifications for each useradmin- Admin-only notificationsorder-{orderId}- Order-specific updates
Modern UI with category filters, size selection, and real-time order tracking
Step-by-step wizard: Base โ Sauce โ Cheese โ Toppings โ Review
Order management, inventory tracking, low stock alerts
Visual timeline showing order progress from received to delivered
- Add Google/Facebook OAuth login
- Implement order scheduling (pre-order for later)
- Add promo codes & discount system
- Delivery partner assignment & tracking
- Customer reviews & ratings on pizzas
- Push notifications (PWA)
- Order history analytics for admins
- Multi-language support (i18n)
pizzazing/
โโโ backend/
โ โโโ controllers/ # Business logic
โ โโโ helpers/ # Utility functions
โ โ โโโ emailService.js # Nodemailer setup
โ โ โโโ notificationManager.js
โ โ โโโ orderPricing.js
โ โ โโโ socketIOConfig.js
โ โโโ middleware/ # Auth, admin checks
โ โโโ models/ # Mongoose schemas
โ โ โโโ user.js
โ โ โโโ order.js
โ โ โโโ pizza.js
โ โ โโโ PizzaPreset.js
โ โ โโโ ingredient.js
โ โ โโโ payment.js
โ โโโ routes/ # API routes
โ โโโ test/ # Test scripts & seeders
โ โโโ server.js # Entry point
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ api/ # Axios instance
โ โ โโโ components/ # Reusable components
โ โ โโโ context/ # React context (Auth)
โ โ โโโ hooks/ # Custom hooks
โ โ โโโ pages/ # Route pages
โ โ โโโ main.jsx # Entry point
โ โโโ index.html
โ โโโ tailwind.config.js
โ โโโ vite.config.js
โ
โโโ README.md
# Run seed script
cd backend
node test/seedPizzaZing.js
# Health check
curl http://localhost:5000/api/health
# Run smoke tests
npm run smokePizzaZing - Where every slice tells a story ๐โจ