Skip to content

mfbhai10/UniCan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

UIU Canteen

A full-stack web application for United International University (UIU) canteen food ordering and delivery inside the UIU campus only. It helps students, staff, and faculty order canteen food when they do not want to walk to the canteen, while UIU students can deliver as part-time student delivery partners.

Campus Scope

  • Service area: UIU campus only
  • Food source: UIU canteen shops only
  • Users: UIU students, staff, and faculty
  • Delivery partners: UIU students working part-time
  • Not supported: city-wide or off-campus home delivery

πŸš€ Features

User Roles

  • Student/Staff/Faculty User - Browse canteen shops, place orders, track delivery, confirm OTP, and rate service
  • Canteen Owner - Create/manage canteen shop, maintain menu items, and prepare orders
  • Student Delivery Partner - UIU student who accepts assignments, picks up orders, and delivers inside campus

Core Functionality

  • πŸ” Authentication - Sign up, sign in, password reset with OTP verification
  • πŸͺ Canteen Shop Management - Create, edit, and manage canteen shops with images
  • πŸ” Menu Management - Add, edit, and categorize food items
  • πŸ“¦ Order Lifecycle - Place order, prepare, assign, pickup, on-the-way, delivered
  • 🧭 Campus Delivery Flow - Delivery location is limited to UIU campus areas
  • 🏍️ Auto Assignment - Assign online student delivery partners when order is ready
  • πŸ”’ OTP Handover - Delivery is completed after OTP verification
  • ⭐ Delivery Rating - Users can rate student delivery partners after successful delivery
  • πŸ–ΌοΈ Image Upload - Cloudinary integration for image storage
  • πŸ’³ Payment Integration - Secure payment flow for order checkout
  • πŸ”₯ Firebase Integration - Additional authentication support

Food Categories

  • Snacks
  • Desserts
  • Burgers
  • Sandwiches
  • Drinks
  • Fast Food
  • Chinese
  • Others

πŸ› οΈ Tech Stack

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT (JSON Web Tokens)
  • Password Hashing: bcryptjs
  • File Upload: Multer + Cloudinary
  • Email Service: Nodemailer

Frontend

  • Framework: React 19
  • Build Tool: Vite
  • State Management: Redux Toolkit
  • Routing: React Router DOM
  • Styling: Tailwind CSS
  • HTTP Client: Axios
  • Icons: React Icons
  • Authentication: Firebase

πŸ“ Project Structure

UniCan/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ config/         # Database configuration
β”‚   β”œβ”€β”€ controllers/    # Route controllers
β”‚   β”œβ”€β”€ middlewares/    # Auth & file upload middlewares
β”‚   β”œβ”€β”€ models/         # Mongoose schemas
β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”œβ”€β”€ utils/          # Cloudinary, mail, token utilities
β”‚   └── index.js        # Entry point
β”‚
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ public/         # Static assets
β”‚   └── src/
β”‚       β”œβ”€β”€ assets/     # Images and static files
β”‚       β”œβ”€β”€ components/ # Reusable components
β”‚       β”œβ”€β”€ hooks/      # Custom React hooks
β”‚       β”œβ”€β”€ pages/      # Page components
β”‚       β”œβ”€β”€ redux/      # Redux store and slices
β”‚       β”œβ”€β”€ App.jsx     # Main app component
β”‚       └── main.jsx    # Entry point
β”‚
└── package.json

πŸ”§ Installation

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB
  • Cloudinary account
  • Firebase project (for additional auth)

Environment Variables

Create a .env file in the Backend folder with the following variables:

PORT=8000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Email (Nodemailer)
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_app_password

Backend Setup

# Navigate to backend directory
cd Backend

# Install dependencies
npm install

# Start development server
npm run dev

The backend server will run on http://localhost:8000

Frontend Setup

# Navigate to frontend directory
cd Frontend

# Install dependencies
npm install

# Start development server
npm run dev

The frontend will run on http://localhost:5173

πŸ“‘ API Endpoints

Authentication (/api/auth)

  • POST /signup - Register a new user
  • POST /signin - Login user
  • POST /forgot-password - Request password reset
  • POST /verify-otp - Verify OTP for password reset
  • POST /reset-password - Reset password

User (/api/user)

  • GET /current - Get current user profile
  • POST /toggle-online - Toggle student delivery partner online/offline status
  • POST /set-online - Set student delivery partner online status explicitly
  • GET /delivery-stats - Get student delivery partner stats and performance

Shop (/api/shop)

  • POST /create - Create a new shop
  • GET /my-shop - Get owner's shop
  • PUT /update/:id - Update shop details
  • DELETE /:id - Delete a shop

Items (/api/item)

  • POST /add - Add a new item
  • GET /shop/:shopId - Get items by shop
  • PUT /update/:id - Update an item
  • DELETE /:id - Delete an item

Orders (/api/order)

  • POST /place-order - Create a new order
  • GET /user-orders - Get user's order history
  • GET /owner-orders - Get owner's order list
  • PUT /update-status/:orderId - Update shop-side order status
  • PUT /cancel-order/:orderId - Cancel order by user
  • GET /available-orders - Get available orders for student delivery partner
  • GET /delivery-boy-orders - Get assigned delivery orders for student delivery partner
  • PUT /accept-order/:orderId - Accept order (legacy compatibility route)
  • PUT /confirm-accept/:orderId - Confirm auto-assigned order
  • PUT /reject-order/:orderId - Reject order
  • PUT /update-delivery-status/:orderId - Update delivery status
  • POST /generate-otp/:orderId - Generate delivery OTP
  • POST /verify-otp/:orderId - Verify delivery OTP and complete order
  • GET /today-deliveries - Get today's completed deliveries
  • GET /shop-earnings - Get shop earnings summary
  • GET /monthly-shop-earnings - Get monthly shop earnings
  • GET /delivery-boy-monthly-earnings - Get monthly earnings for student delivery partner

Payment (/api/payment)

  • POST /init - Initialize payment for an order
  • POST /ipn - Payment IPN callback
  • GET/POST /success - Payment success callback
  • GET/POST /fail - Payment failure callback
  • GET/POST /cancel - Payment cancel callback

Delivery Rating (/api/delivery-rating)

  • POST /rate/:orderId - Submit rating for student delivery partner
  • GET /order/:orderId - Get rating for a specific order
  • GET /can-rate/:orderId - Check if the user can rate this order
  • GET /delivery-boy/:deliveryBoyId - Get ratings for a student delivery partner

🍽️ Simple Workflow

  1. UIU user logs in and selects food from canteen menu
  2. User chooses a delivery spot inside UIU campus
  3. User confirms payment and order is created
  4. Canteen prepares food and marks order ready
  5. System auto-assigns an online student delivery partner
  6. Partner picks up food and delivers inside UIU only
  7. User confirms delivery with OTP
  8. User rates delivery service

πŸƒ Running the Application

  1. Start MongoDB service
  2. Start the backend server: cd Backend && npm run dev
  3. Start the frontend: cd Frontend && npm run dev
  4. Open http://localhost:5173 in your browser

πŸ“ Scripts

Backend

  • npm run dev - Start development server with nodemon

Frontend

  • npm run dev - Start Vite development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

πŸ‘€ Author

Mutasim Fuad Rafi

πŸ“„ License

ISC License

Screenshots

Below are selected screenshots from the UniCan frontend (stored under Frontend/src/assets/) with short annotations explaining each view.

  • Landing Page:

    Landing Page

    • Description: The public-facing hero section showcasing UniCan's core value proposition, quick search, and call-to-action buttons.
  • Sign Up / Registration:

    Sign Up

    • Description: User registration form allowing role selection (user, owner, delivery partner) and social sign-in options.
  • User / Student View (Shops & Items):

    User View

    • Description: Browse shops, categories, and individual food items with add-to-cart controls and ratings.
  • Canteen Owner Dashboard:

    Canteen Owner Dashboard

    • Description: Owner view with shop banner, earnings summary, and a list of menu items for quick management.
  • Student Delivery Partner Dashboard:

    Delivery Partner Dashboard

    • Description: Delivery partner interface showing online/offline toggle, performance stats, and active delivery information.

About

UIU Canteen Food Delivery System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages