From 9958bf0f15668ee905fdaa51eb816d2044ade9a0 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <87621111+alwinsimon@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:31:59 +0530 Subject: [PATCH 01/10] Create README.md --- README.md | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd4d4a0 --- /dev/null +++ b/README.md @@ -0,0 +1,126 @@ +# GetMyDeal + +Welcome to GetMyDeal, your ultimate destination for discovering and securing incredible deals online! Whether you're a savvy shopper looking for discounts or a merchant seeking a reliable e-commerce platform, GetMyDeal has you covered. + +## Table of Contents + +- [About GetMyDeal](#about-getmydeal) +- [Features](#features) +- [Technologies Used](#technologies-used) +- [Getting Started](#getting-started) +- [Installation](#installation) +- [Usage](#usage) +- [CI/CD Pipeline](#ci-cd-pipeline) +- [Essential Environment Variables](#essential-environment-variables) +- [License](#license) + +## About GetMyDeal + +GetMyDeal is an innovative e-commerce platform built with the user in mind. We've harnessed the power of the MVC (Model-View-Controller) architectural pattern to deliver a seamless shopping experience. Here's what sets us apart: + +- **User-Centric Features:** We prioritize your security and convenience with features like secure authentication, dynamic product listings, and efficient cart management. + +- **Admin Empowerment:** For administrators, we offer intuitive product and category management, coupon customization, and comprehensive sales analytics. + +- **Ongoing Improvement:** GetMyDeal is committed to continuously enhancing your shopping experience. Expect exciting updates and new features in the future. + +## Features + +- **User Authentication:** Enjoy secure and hassle-free authentication with email verification and OTP (One-Time Password) login, powered by Twilio. + +- **Dynamic Product Listings:** Discover a vast array of products, neatly categorized for effortless browsing. + +- **Cart Management:** Effortlessly manage your shopping cart and apply exclusive offers and coupons. + +- **Order Management:** Keep track of your orders in real-time, and benefit from efficient order status updates. + +- **Coupon Management:** Find personalized savings with admin-managed coupons and special offers. + +- **Address Management:** Simplify delivery by managing your addresses and setting a default location. + +- **Wallet Payments:** Seamlessly make payments from your wallet and track transactions transparently. + +- **Secure Cart Functionality:** A secure shopping experience where logged-in users can add items without page reloads. + +- **Error Handling:** Graceful error handling and secure session management ensure uninterrupted shopping. + +- **User Profile Management:** Personalize your account with profile editing and image uploads. + +- **Admin Empowerment:** Admins can easily manage products, categories, offers, coupons, and gain insights through the dashboard. + +## Technologies Used + +GetMyDeal leverages cutting-edge technologies to provide a secure and efficient shopping experience: + +- **MongoDB Native Driver:** We use the MongoDB native driver to manage our database efficiently. This ensures robust data storage and retrieval, enhancing the overall performance of our platform. + +- **Razorpay Payment Gateway:** For seamless and secure payments, we've integrated the Razorpay payment gateway. It allows users to make transactions with confidence and is a trusted solution for handling payments. + +- **Twilio:** Twilio powers our OTP (One-Time Password) verification system during login, adding an extra layer of security to your account. + +- **GitHub Actions:** Our CI/CD pipeline is powered by GitHub Actions. With this automation tool, we ensure that code changes are rigorously tested and seamlessly deployed, keeping GetMyDeal up and running smoothly. + +- **Node.js:** GetMyDeal is built on Node.js, providing a scalable and efficient backend for our application. Node.js enables us to handle a large number of users and transactions with ease. + +- **Express.js:** We use Express.js, a fast and minimalist web framework for Node.js, to handle our application's routing and middleware, making development more efficient. + +## Getting Started + +Ready to explore GetMyDeal? Here's how to get started: + +### Installation + +1. Clone this repository. +2. Run `npm install` to install all the necessary dependencies. + +### Usage + +1. Configure your environment settings by setting up the essential environment variables mentioned in the [Essential Environment Variables](#essential-environment-variables) section. +2. Run `npm start` to start the project. For development environments, you can use `npm run dev` for convenient development with automatic code reloading. + +## CI/CD Pipeline + +We've integrated a robust CI/CD (Continuous Integration and Continuous Deployment) pipeline using GitHub Actions. This ensures that our code is thoroughly tested and deployed automatically, providing a seamless and reliable experience for our users. With every code change, our pipeline: + +- Runs automated tests to catch issues early. +- Builds and packages the application. +- Deploys updates to our production environment when changes pass all tests. + +This ensures that GetMyDeal is always up-to-date, stable, and ready to provide you with the best shopping experience. + +## Essential Environment Variables + +To run GetMyDeal smoothly, you'll need to set up the following essential environment variables in your environment configuration or .env file. These variables are critical for the proper functioning of the application: + +### Server Port + +- **PORT:** The port on which the GetMyDeal server should listen. Example: `PORT=3000` + +### MongoDB Url + +- **MONGO_DB_URL:** The URL for connecting to your MongoDB database. Example: `MONGO_DB_URL=mongodb://localhost:27017/getmydeal` + +### Platform Name + +- **PLATFORM_NAME:** The name of your platform, which is displayed in various parts of the application. Example: `PLATFORM_NAME=GetMyDeal` + +### Cookie Key + +- **SESSION_SECRET_KEY:** A secret key for session management and security. Example: `SESSION_SECRET_KEY=mysecretkey` + +### Payment Gateway Credentials - Razorpay + +- **RAZORPAY_KEY_ID:** Your Razorpay API Key ID for payment processing. Example: `RAZORPAY_KEY_ID=your-key-id` +- **RAZORPAY_SECRET_KEY:** Your Razorpay API Secret Key for payment processing. Example: `RAZORPAY_SECRET_KEY=your-secret-key` + +### OTP Verification Service Credentials - Twilio + +- **TWILIO_ACCOUNT_SID:** Your Twilio Account SID for OTP verification. Example: `TWILIO_ACCOUNT_SID=your-account-sid` +- **TWILIO_AUTH_TOKEN:** Your Twilio Authentication Token for OTP verification. Example: `TWILIO_AUTH_TOKEN=your-auth-token` +- **TWILIO_VERIFY_SID:** Your Twilio Verify Service SID for OTP verification. Example: `TWILIO_VERIFY_SID=your-verify-sid` + +Make sure to securely manage these environment variables to ensure the security and proper functioning of GetMyDeal. You can add them to your application's environment configuration or use a tool like `.env` files to manage them conveniently. + +--- + +Thank you for visiting the repository, Happy coding! From 9a8a9195d53c4e8bd7da031a4edc5e0f7d9cf319 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 12:30:16 +0530 Subject: [PATCH 02/10] Added Dockerfile and Docker Ignore files --- .dockerignore | 1 + Dockerfile | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ca97ef1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modeuls/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f52e2b6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node + +RUN apt update + +WORKDIR /app + +COPY package*.json . + +RUN npm install + +COPY . . + +EXPOSE 3000 + +CMD ["node", "start"] \ No newline at end of file From 6d9dfc50d5515c0733e8c40d7cb3f01b96f289d7 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 12:35:40 +0530 Subject: [PATCH 03/10] Added Docker Compose file --- docker-compose.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..748c000 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: "3" +services: + webserver: + build: + dockerfile: Dockerfile + context: ./backend + container_name: webserver + ports: + - 3000:3000 + restart: on-failure + volumes: + - .:/app + env_file: + - ./.env \ No newline at end of file From b2cca2b1bb27750531342a60ea851a0860951cf6 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 12:38:36 +0530 Subject: [PATCH 04/10] Modified Docker Compose file --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 748c000..c8f0ba2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,7 +3,7 @@ services: webserver: build: dockerfile: Dockerfile - context: ./backend + context: ./ container_name: webserver ports: - 3000:3000 From cfa3d7341205a56d28bf4d8cbc00d6b4cd7d15b3 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 13:00:11 +0530 Subject: [PATCH 05/10] Modified Docker Compose file and Docker ignore --- .dockerignore | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index ca97ef1..dbf0821 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -node_modeuls/* \ No newline at end of file +node_modules/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f52e2b6..68dbc03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,4 @@ COPY . . EXPOSE 3000 -CMD ["node", "start"] \ No newline at end of file +CMD ["npm", "start"] \ No newline at end of file From 3721bcf8eaa612529b0bf2091a46e0e98a185f80 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 17:25:42 +0530 Subject: [PATCH 06/10] Added .enc in docker ignore --- .dockerignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index dbf0821..99ddbd6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ -node_modules/* \ No newline at end of file +node_modules/* +.env \ No newline at end of file From 7aad17fd530271b307f18c071e1c6a7afbfc4bc9 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 17:51:39 +0530 Subject: [PATCH 07/10] Updated comments --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 68dbc03..57c722b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,23 @@ +# Command to configure the base image (official Node.js base image) FROM node +# Command to update the base image RUN apt update +# Set the working directory for the container WORKDIR /app +# Command to copy the package files to working direcotory of the container COPY package*.json . +# Install dependencies inside the container RUN npm install +# Copy all the files from the existing directory to the docker container COPY . . +# Command to set a fixed port for container to listen (exposing a port) EXPOSE 3000 +# Specify the default command to run the application inside the container CMD ["npm", "start"] \ No newline at end of file From 440d29f802fec7d21db683c135e014ed6637bc5f Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 17:54:01 +0530 Subject: [PATCH 08/10] Commented volume configuration temporarily to avoid node-modules compatibility issue --- docker-compose.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index c8f0ba2..8b17394 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,11 +4,12 @@ services: build: dockerfile: Dockerfile context: ./ - container_name: webserver + image: webserver-image:v1 # This will set the image name and tag while building the image from dockerfile using docker compose + container_name: webserver # This will set the container name while starting it from docker compose ports: - 3000:3000 restart: on-failure - volumes: - - .:/app + # volumes: + # - .:/app env_file: - ./.env \ No newline at end of file From 0c04373989f5bfd1a2d6e4e401d0cc100b5ec72a Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 18:14:49 +0530 Subject: [PATCH 09/10] Added env sample file --- .env.sample | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .env.sample diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..f78f0e8 --- /dev/null +++ b/.env.sample @@ -0,0 +1,28 @@ +# ===================Server Port=================== +PORT = 3000 + + +# ===================MongoDB Url=================== +MONGO_DB_URL = 'Paste mongodb url here' + + +# ===================Platform Name=================== +PLATFORM_NAME = 'GetMyDeal' + + +# ===================Cookiee Key=================== +SESSION_SECRET_KEY = 'Paste SESSION-SECRET-KEY here' + + +# ===================Payment Gateway Credentials - Razorpay=================== +RAZORPAY_KEY_ID = "Paste RAZORPAY_KEY_ID here" + +RAZORPAY_SECRET_KEY = "Paste RAZORPAY_SECRET_KEY here" + + +# ===================OTP Verification Service Credentials - Twilio =================== +TWILIO_ACCOUNT_SID = "Paste TWILIO_ACCOUNT_SID here" + +TWILIO_AUTH_TOKEN = "Paste TWILIO_AUTH_TOKEN here" + +TWILIO_VERIFY_SID = "Paste TWILIO_VERIFY_SID here" \ No newline at end of file From 81c2816d63ae40dfaf4d5f4eca8cb89542a62b88 Mon Sep 17 00:00:00 2001 From: Alwin Simon <003alwin@gmail.com> Date: Fri, 8 Sep 2023 20:59:36 +0530 Subject: [PATCH 10/10] Specified node base image version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 57c722b..0a6bae8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Command to configure the base image (official Node.js base image) -FROM node +FROM node:18.16 # Command to update the base image RUN apt update