Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Production branch #188

Merged
merged 14 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
.env
28 changes: 28 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -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"
1 change: 0 additions & 1 deletion .github/workflows/Main-Branch-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
- name: Setting up environment variables
run: |
echo "MY_ENV_VARIABLE=${{ secrets.ENV_FILE }}" >> .env
cat .env

# Installation of Node packaging Manager (npm)
- name: Installing project dependencies
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/Production-Branch-Deployment-CI-CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- name: Setting up environment variables
run: |
echo "MY_ENV_VARIABLE=${{ secrets.ENV_FILE }}" >> .env
cat .env

# Installation of Node packaging Manager (npm)
- name: Installing project dependencies
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/Production-Branch-Pre-Merge-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
steps:
- uses: actions/checkout@v3

# ========================== Runs the following commands on the newly created Linux instance for integration testing ==========================

# Installing Node.js at the test instance
- name: Setting up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand All @@ -42,7 +40,6 @@ jobs:
- name: Setting up environment variables
run: |
echo "MY_ENV_VARIABLE=${{ secrets.ENV_FILE }}" >> .env
cat .env

# Installation of Node packaging Manager (npm)
- name: Installing project dependencies
Expand All @@ -66,4 +63,4 @@ jobs:

# Log the status of application with Process Manager 2 (PM2)
- name: Logging the status of application with Process Manager 2 (PM2)
run: pm2 status all
run: pm2 status all
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Command to configure the base image (official Node.js base image)
FROM node:18.16

# 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"]
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"
services:
webserver:
build:
dockerfile: Dockerfile
context: ./
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
env_file:
- ./.env
Loading