This repository hosts the source code for TOMATO, a dynamic food ordering website built with the MERN Stack. It offers a user-friendly platform for seamless online food ordering.
- User Panel: https://food-delivery-frontend-s2l9.onrender.com/
- Admin Panel: https://food-delivery-admin-wrme.onrender.com/
- User Panel
- Admin Panel
- JWT Authentication
- Password Hashing with Bcrypt
- Stripe Payment Integration
- Login/Signup
- Logout
- Add to Cart
- Place Order
- Order Management
- Products Management
- Filter Food Products
- Login/Signup
- Authenticated APIs
- REST APIs
- Role-Based Identification
- Beautiful Alerts
- Hero Section
- Products Section
- Cart Page
- Login Popup
Clone the project
git clone https://github.com/Mshandev/Food-DeliveryGo to the project directory
cd Food-DeliveryInstall dependencies (frontend)
cd frontend
npm installInstall dependencies (admin)
cd admin
npm installInstall dependencies (backend)
cd backend
npm installSetup Environment Vaiables
JWT_SECRET=YOUR_SECRET_TEXT
SALT=YOUR_SALT_VALUE
MONGO_URL=YOUR_DATABASE_URL
STRIPE_SECRET_KEY=YOUR_KEYSetup the Frontend and Backend URL
-
App.jsx in Admin folder const url = YOUR_BACKEND_URL
-
StoreContext.js in Frontend folder const url = YOUR_BACKEND_URL
-
orderController in Backend folder const frontend_url = YOUR_FRONTEND_URL
Start the Backend server
nodemon server.jsStart the Frontend server
npm startStart the Backend server
npm startThe application is deployed on Render.
Contributions are always welcome! Just raise an issue, and we will discuss it.
If you have any feedback, please reach out to me here
==============================================================================================================================================================================================================================================================================
=>How to dockerize this project
=>Clone the project git clone https://github.com/Mshandev/Food-Delivery
=>Create a .env file in /backend folder and put these credential inside it JWT_SECRET=YOUR_SECRET_TEXT SALT=YOUR_SALT_VALUE MONGO_URI=YOUR_DATABASE_URI STRIPE_SECRET_KEY=YOUR_KEY
EXAMPLE: PORT=5000 MONGO_URI=mongodb:localhost:27017/tomato STRIPE_SECRET_KEY=sk_test_51D9ybx... JWT_SECRET=gE8QVTK5zWmx6sp72WH9Gx9PBJIFwjc7z5GIT16MT+k= SALT_VALUE=10
=>Setup the Frontend and Backend URL as mentioned bellow
-
Add bellow line in App.jsx file in Admin folder const url = YOUR_BACKEND_URL or Your Ec2 instance public IP(http://13.232.197.66:5000)
-
Add bellow line in StoreContext.js file in Frontend folder const url = YOUR_BACKEND_URL or Your Ec2 instance public IP(http://13.232.197.66:5000)
-
orderController in Backend folder const frontend_url = YOUR_FRONTEND_URL or Your Ec2 instance public IP(https://13.232.197.66:5173)
=>Go inside /admin folder & create a Dockerfile & add these codes in this file and save it
FROM node:18-slim as build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
=>Go inside /frontend folder & create a Dockerfile & add these codes in this file and save it
FROM node:18-slim as build
WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
=>Go inside /backend folder & create a Dockerfile & add these codes in this file and save it
FROM node:18-slim
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD ["npm", "start"]
=>Now create a docker-compose.yaml file in /Food-Delivery app folder and paste the codes bellow
version: '3.9'
services: mongo: image: mongo:6 container_name: mongo restart: always ports: - "27017:27017" volumes: - mongo_data:/data/db
backend: build: ./backend container_name: backend restart: always ports: - "5000:5000" environment: - MONGO_URL=mongodb://mongo:27017/tomoto depends_on: - mongo
frontend: build: ./frontend container_name: frontend restart: always ports: - "3000:80" depends_on: - backend
admin: build: ./admin container_name: admin restart: always ports: - "4000:80" # admin app accessible on http://<EC2_IP>:4000 depends_on: - backend
volumes: mongo_data:
=>Now run this command to start and stop the docker-compose docker-compose up -d --build docker-compose down
=>Access the ports Admin Page: http://your_instance_public_ip:4000/ Frontend Page: http://your_instance_public_ip:4000/ Backend Page: http://your_instance_public_ip:5000/
=>To access the database run the commands inside the mongo container
- mongosh
- show dbs
- use <db_name>
- show collections
- db.<collection_name).find()



