Skip to content

Nivedhaasai/Pizzazing-fullstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ• PizzaZing - Full-Stack Pizza Delivery App

"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.

Node.js React MongoDB Socket.IO Razorpay TailwindCSS


๐Ÿ“‹ Table of Contents


Test Credentials

Role Email Password
Customer test@pizzazing.com test123
Admin admin@pizzazing.com admin123

โœจ Features

Customer Features

  • ๐Ÿ” 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 Features

  • ๐Ÿ“Š 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

Technical Features

  • ๐Ÿ”„ 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

๐Ÿ› ๏ธ Tech Stack

Frontend

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

Backend

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

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         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โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • Razorpay account (for payments)
  • SMTP credentials (for emails)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/pizzazing.git
cd pizzazing
  1. Install backend dependencies
cd backend
npm install
  1. Install frontend dependencies
cd ../frontend
npm install
  1. Set up environment variables (see Environment Variables)

  2. Seed the database

cd backend
node test/seedPizzaZing.js
  1. Start the backend server
npm run dev
# Server runs on http://localhost:5000
  1. Start the frontend (new terminal)
cd frontend
npm run dev
# App runs on http://localhost:5173

๐Ÿ” Environment Variables

Create 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

๐Ÿ“ก API Endpoints

Authentication

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

Pizzas

Method Endpoint Description Auth Required
GET /api/pizzas Get all pizza presets ๐Ÿ” JWT
GET /api/pizzas/:id Get single pizza ๐Ÿ” JWT

Orders

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

Payments

Method Endpoint Description Auth Required
POST /api/payments/create Create Razorpay order ๐Ÿ” JWT
POST /api/payments/verify Verify payment signature ๐Ÿ” JWT

Inventory

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

๐Ÿ—„๏ธ Database Schema

User

{
  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
}

Order

{
  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
}

PizzaPreset

{
  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
}

Ingredient

{
  name: String (unique),
  type: 'base' | 'sauce' | 'cheese' | 'veggie' | 'meat',
  price: Number,
  stock: Number,
  threshold: Number,
  isActive: Boolean
}

๐Ÿ”„ Real-Time Features

The app uses Socket.IO for real-time communication:

Events Emitted by Server

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)

Rooms

  • user-{userId} - Personal notifications for each user
  • admin - Admin-only notifications
  • order-{orderId} - Order-specific updates

Customer Dashboard

Modern UI with category filters, size selection, and real-time order tracking

Custom Pizza Builder

Step-by-step wizard: Base โ†’ Sauce โ†’ Cheese โ†’ Toppings โ†’ Review

Admin Dashboard

Order management, inventory tracking, low stock alerts

Order Tracking

Visual timeline showing order progress from received to delivered


๐Ÿ”ฎ Future Improvements

  • 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)

๐Ÿ“ Project Structure

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

๐Ÿงช Testing

# Run seed script
cd backend
node test/seedPizzaZing.js

# Health check
curl http://localhost:5000/api/health

# Run smoke tests
npm run smoke

PizzaZing - Where every slice tells a story ๐Ÿ•โœจ

About

Full-stack pizza delivery app with React, Node.js, MongoDB & Razorpay. Features real-time order tracking (Socket.IO), JWT auth, email notifications, custom pizza builder, admin dashboard, inventory management. Responsive Tailwind UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors