From 0a797602d15899459fbdcab4dd10f0021d95372d Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Thu, 28 Aug 2025 18:14:11 +0530
Subject: [PATCH 01/12] added docker file for frontend
---
frontend/Dockerfile | 7 +++++++
frontend/package.json | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 frontend/Dockerfile
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
new file mode 100644
index 0000000..1340985
--- /dev/null
+++ b/frontend/Dockerfile
@@ -0,0 +1,7 @@
+FROM node:18
+WORKDIR /app
+COPY package.json .
+RUN npm install
+COPY . .
+EXPOSE 5173
+CMD ["npm", "run", "dev"]
\ No newline at end of file
diff --git a/frontend/package.json b/frontend/package.json
index b4be167..1bbed15 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "dev": "vite",
+ "dev": "vite --host 0.0.0.0",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
From 59c3a45c6793a4bb7a5bb5b5f316750ddd7a66d6 Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Thu, 28 Aug 2025 19:13:16 +0530
Subject: [PATCH 02/12] added compose.yml
---
Docker-compose.yml | 34 ++++++++++++++++++++++++++++++++++
backend/Dockerfile | 7 +++++++
2 files changed, 41 insertions(+)
create mode 100644 Docker-compose.yml
create mode 100644 backend/Dockerfile
diff --git a/Docker-compose.yml b/Docker-compose.yml
new file mode 100644
index 0000000..0ab0816
--- /dev/null
+++ b/Docker-compose.yml
@@ -0,0 +1,34 @@
+services:
+ mongo:
+ image: mongo:latest
+ ports:
+ - "27017:27017"
+ volumes:
+ - my-mongo-data:/data/db
+ networks:
+ - mern
+ backend:
+ build:
+ context: ./backend
+ ports:
+ - "5000:5000"
+ networks:
+ - mern
+ depends_on:
+ - mongo
+
+ volumes:
+ - ./backend:/usr/src/app
+
+ frontend:
+ build:
+ context: ./frontend
+ container_name: frontend
+ ports:
+ - "5173:5173"
+ networks:
+ - mern
+
+networks:
+ mern:
+ driver: bridge
\ No newline at end of file
diff --git a/backend/Dockerfile b/backend/Dockerfile
new file mode 100644
index 0000000..0a2e4a0
--- /dev/null
+++ b/backend/Dockerfile
@@ -0,0 +1,7 @@
+FROM node:18
+WORKDIR /app
+COPY package.json .
+RUN npm install
+COPY . .
+EXPOSE 5000
+CMD [ "npm", "start" ]
\ No newline at end of file
From 4cc4e97635ba7185ab9918a5042e7c5c1a3a147d Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Thu, 28 Aug 2025 19:26:26 +0530
Subject: [PATCH 03/12] debuged compose.yml
---
Docker-compose.yml | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Docker-compose.yml b/Docker-compose.yml
index 0ab0816..b5937b6 100644
--- a/Docker-compose.yml
+++ b/Docker-compose.yml
@@ -1,6 +1,7 @@
services:
mongo:
image: mongo:latest
+ container_name: mongodb
ports:
- "27017:27017"
volumes:
@@ -12,13 +13,13 @@ services:
context: ./backend
ports:
- "5000:5000"
+ volumes:
+ - ./backend:/usr/src/app
networks:
- mern
depends_on:
- mongo
- volumes:
- - ./backend:/usr/src/app
frontend:
build:
@@ -28,7 +29,11 @@ services:
- "5173:5173"
networks:
- mern
+ depends_on:
+ - backend
networks:
mern:
- driver: bridge
\ No newline at end of file
+ driver: bridge
+volumes:
+ my-mongo-data:
\ No newline at end of file
From 47f50cf420b75eba517d83e4964e7102f16e5bcf Mon Sep 17 00:00:00 2001
From: Lokendra Dhote <137758094+Lokendram10@users.noreply.github.com>
Date: Tue, 2 Sep 2025 20:32:32 +0530
Subject: [PATCH 04/12] Update README.md
---
README.md | 114 +++++++++++++++++++++++++++++-------------------------
1 file changed, 62 insertions(+), 52 deletions(-)
diff --git a/README.md b/README.md
index d798585..09a0102 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,13 @@
-
-
-
+
+
+
+
+
-**A simple web application to plan routes between stations in Indore using Dijkstra's Algorithm**
+**A web application to plan routes between stations in Indore using Dijkstra's Algorithm**
[🚀 Live Demo](https://indore-route.vercel.app)
@@ -14,62 +16,64 @@
---
-## ✨ What it does
+## ✨ Features
-- 📍 **Add Stations**: Create new stations/locations
-- 🔗 **Connect Stations**: Link stations with distance and cost
-- 🧭 **Find Routes**: Calculate shortest path by distance OR cheapest path by cost
-- 📊 **View All**: See all stations and connections in one place
+* 📍 **Add Stations**: Create new stations/locations
+* 🔗 **Connect Stations**: Link stations with distance and cost
+* 🧭 **Find Routes**: Calculate shortest path by distance or cheapest path by cost
+* 📊 **View All**: See all stations and connections at a glance
+* 🐳 **Dockerized**: Run frontend and backend with Docker & Docker Compose
+* 🤖 **CI/CD**: Automated deployment pipeline with Jenkins
---
## 🛠️ Tech Stack
-- **Frontend**: React.js, Tailwind CSS
-- **Backend**: Node.js, Express.js
-- **Database**: MongoDB
-- **Algorithm**: Dijkstra's Shortest Path
+* **Frontend**: React.js, Tailwind CSS
+* **Backend**: Node.js, Express.js
+* **Database**: MongoDB
+* **Algorithm**: Dijkstra's Shortest Path
+* **Containerization**: Docker, Docker Compose
+* **CI/CD**: Jenkins
---
## 🏃♂️ Quick Start
-### 1. Clone & Install
+### 1. Clone Repository
+
```bash
-git clone https://github.com/harshitsingh4321/indore-route-planner.git
+git clone https://github.com/your-username/indore-route-planner.git
cd indore-route-planner
+```
-# Backend
-cd backend && npm install
+### 2. Docker Setup
-# Frontend
-cd ../frontend && npm install
+Make sure Docker and Docker Compose are installed.
+
+```bash
+# Build and run containers
+docker-compose up --build
```
-### 2. Setup Environment
-Create `.env` in backend folder:
+* Backend API: `http://localhost:5000`
+* Frontend App: `http://localhost:3000`
+
+### 3. Environment Variables
+
+Create a `.env` file inside the `backend` folder:
+
```env
MONGO_URI=your_mongodb_connection_string
PORT=5000
```
-### 3. Run Application
-```bash
-# Start backend (Terminal 1)
-cd backend && npm run dev
-
-# Start frontend (Terminal 2)
-cd frontend && npm run dev
-```
-
-Open `http://localhost:3000` 🎉
-
---
## 🎯 How to Use
1. **Add Stations**: Enter station name and click "Add Station"
-2. **Connect Stations**: Select two stations, enter distance (km) and cost (₹), click "Add Connection"
+2. **Connect Stations**: Select two stations, enter distance (km) and cost (₹), click "Add Connection"
3. **Find Route**: Choose start/end stations, select "Distance" or "Cost" optimization, click "Find Route"
4. **View Results**: See the optimal path with total distance and cost
@@ -79,15 +83,18 @@ Open `http://localhost:3000` 🎉
```
indore-route-planner/
-├── frontend/ # React app
+├── frontend/ # React app
+│ ├── Dockerfile # Dockerfile for frontend
│ ├── src/
-│ │ └── App.jsx # Main component
│ └── package.json
-├── backend/ # Express API
-│ ├── models/ # MongoDB schemas
-│ ├── routes/ # API routes
-│ ├── utils/ # Dijkstra algorithm
-│ └── server.js # Main server
+├── backend/ # Express API
+│ ├── Dockerfile # Dockerfile for backend
+│ ├── models/ # MongoDB schemas
+│ ├── routes/ # API routes
+│ ├── utils/ # Dijkstra algorithm
+│ └── server.js
+├── docker-compose.yml # Docker Compose setup
+├── Jenkinsfile # CI/CD pipeline configuration
└── README.md
```
@@ -96,11 +103,11 @@ indore-route-planner/
## 🔌 API Endpoints
```bash
-GET /api/stations # Get all stations
-POST /api/stations # Add new station
-GET /api/connections # Get all connections
-POST /api/connections # Add new connection
-POST /api/route # Calculate optimal route
+GET /api/stations # Get all stations
+POST /api/stations # Add new station
+GET /api/connections # Get all connections
+POST /api/connections # Add new connection
+POST /api/route # Calculate optimal route
```
---
@@ -108,16 +115,19 @@ POST /api/route # Calculate optimal route
## 🧮 Algorithm
Uses **Dijkstra's Algorithm** to find:
-- **Shortest Distance**: Minimum total kilometers
-- **Cheapest Cost**: Minimum total rupees
+
+* **Shortest Distance**: Minimum total kilometers
+* **Cheapest Cost**: Minimum total rupees
---
## 🚀 Deployment
-- **Frontend**: Deploy to Vercel : https://indore-metro.vercel.app
-- **Backend**: Deploy to Render : https://indore-metro.onrender.com
-- Set environment variables in deployment platforms
+* **Docker**: Run frontend and backend via Docker Compose
+* **CI/CD**: Jenkins pipeline automates building, testing, and deployment
+* **Frontend**: Vercel - [https://indore-metro.vercel.app](https://indore-metro.vercel.app)
+* **Backend**: Render - [https://indore-metro.onrender.com](https://indore-metro.onrender.com)
+* Configure `.env` in deployment environments
---
@@ -135,8 +145,8 @@ Uses **Dijkstra's Algorithm** to find:
**Made by Harshit Singh**
-- 📧 Email: harshitsingh789123@gmail.com
-- 💻 GitHub: [harshitsingh4321](https://github.com/harshitsingh4321)
+* 📧 Email: [harshitsingh789123@gmail.com](mailto:harshitsingh789123@gmail.com)
+* 💻 GitHub: [harshitsingh4321](https://github.com/harshitsingh4321)
---
From cf68cdcf3a283c02364b1af9621df2df4d563605 Mon Sep 17 00:00:00 2001
From: Lokendra Dhote <137758094+Lokendram10@users.noreply.github.com>
Date: Tue, 2 Sep 2025 20:46:10 +0530
Subject: [PATCH 05/12] Update README.md
---
README.md | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 09a0102..4ab6f3e 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,10 @@
---
+> **Note**: This project was originally created by Harshit Singh. I forked the repository and made additional changes (Docker, Docker Compose, and Jenkins pipeline) in the **main** branch. The **master** branch contains the original code.
+
+---
+
## ✨ Features
* 📍 **Add Stations**: Create new stations/locations
@@ -43,13 +47,24 @@
### 1. Clone Repository
```bash
-git clone https://github.com/your-username/indore-route-planner.git
-cd indore-route-planner
+git clone https://github.com/Lokendram10/Indore-Route-Pathfinder-cicd
+cd Indore-Route-Pathfinder-cicd
+```
+
+### 2. Install Docker & Docker Compose (Linux)
+
+```bash
+sudo apt-get update
+sudo apt-get install docker.io -y
+sudo apt-get install docker-compose -y
+
+# Give permission to current user to run docker without sudo
+sudo usermod -aG docker $USER && newgrp docker
```
-### 2. Docker Setup
+> ⚠️ Logout and login again for group changes to take effect.
-Make sure Docker and Docker Compose are installed.
+### 3. Docker Setup
```bash
# Build and run containers
@@ -59,7 +74,7 @@ docker-compose up --build
* Backend API: `http://localhost:5000`
* Frontend App: `http://localhost:3000`
-### 3. Environment Variables
+### 4. Environment Variables
Create a `.env` file inside the `backend` folder:
From 558ba9f7b8b8a3f65746eed979cd15bd4f2f0753 Mon Sep 17 00:00:00 2001
From: Lokendra Dhote <137758094+Lokendram10@users.noreply.github.com>
Date: Tue, 2 Sep 2025 20:50:57 +0530
Subject: [PATCH 06/12] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 4ab6f3e..899a9cb 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ sudo apt-get install docker-compose -y
sudo usermod -aG docker $USER && newgrp docker
```
-> ⚠️ Logout and login again for group changes to take effect.
+>⚠️ Logout and login again for group changes to take effect if newgrp docker does not work.
### 3. Docker Setup
From a6ae539a77d9debd6f46be478f4f4a744e153a5b Mon Sep 17 00:00:00 2001
From: Lokendra Dhote <137758094+Lokendram10@users.noreply.github.com>
Date: Thu, 4 Sep 2025 14:06:48 +0530
Subject: [PATCH 07/12] Rename Docker-compose.yml to docker-compose.yml
---
Docker-compose.yml => docker-compose.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename Docker-compose.yml => docker-compose.yml (96%)
diff --git a/Docker-compose.yml b/docker-compose.yml
similarity index 96%
rename from Docker-compose.yml
rename to docker-compose.yml
index b5937b6..00ae023 100644
--- a/Docker-compose.yml
+++ b/docker-compose.yml
@@ -36,4 +36,4 @@ networks:
mern:
driver: bridge
volumes:
- my-mongo-data:
\ No newline at end of file
+ my-mongo-data:
From 13ebebeb51adfc820d151936d742722af4ae92d3 Mon Sep 17 00:00:00 2001
From: Lokendra Dhote <137758094+Lokendram10@users.noreply.github.com>
Date: Thu, 4 Sep 2025 14:21:23 +0530
Subject: [PATCH 08/12] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 899a9cb..d64356d 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ sudo usermod -aG docker $USER && newgrp docker
```bash
# Build and run containers
-docker-compose up --build
+docker-compose up -d --build
```
* Backend API: `http://localhost:5000`
@@ -168,3 +168,4 @@ Uses **Dijkstra's Algorithm** to find:
## 📄 License
MIT License - feel free to use this project!
+
From 65c986011fe006eb3c8a4d7e944cd2bbd4286acf Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Thu, 4 Sep 2025 19:30:33 +0530
Subject: [PATCH 09/12] Added jenkins file which contains sonarqube, owasp,
trivy code
---
Jenkinsfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..4b2189c
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,50 @@
+pipeline {
+ agent any
+ environment {
+ SONARQUBE_SCANNER_HOME = tool 'SonarQubeScanner'
+
+ }
+
+ stages {
+ stage('Clone') {
+ steps {
+ git url: 'https://github.com/Lokendram10/Indore-Route-Pathfinder-cicd.git', branch: 'main'
+ }
+ }
+ stage('SonarQube Scan') {
+ steps {
+ withSonarQubeEnv('SonarQubeServer') {
+ sh '${SONARQUBE_SCANNER_HOME}/bin/sonar-scanner' -DsonarProjectName=Indore-Route-Pathfinder-cicd
+ -Dsonar.projectKey=Indore-Route-Pathfinder-cicd
+ }
+ }
+ }
+ stage('OWASP Dependency Check') {
+ steps {
+ echo "OWASP Dependency Check"
+ dependencyCheck (
+ additionalArguments: '--scan ./'
+ , odcInstallation: 'owasp'
+ )
+ echo "OWASP Dependency Check"
+ }
+ }
+ stage('Trivy Scan') {
+ steps {
+ sh 'trivy fs --exit-code 1 --severity HIGH,CRITICAL -f json -o trivy-report.json . '
+ }
+ }
+ stage('Quality Gate') {
+ steps {
+ timeout(time: 1, unit: 'HOURS') {
+ waitForQualityGate abortPipeline: true
+ }
+ }
+ }
+ stage('Docker Build') {
+ steps {
+ sh 'docker compose up --build -d'
+ }
+ }
+ }
+}
\ No newline at end of file
From 7bc3ff5e3c8321e35698dbcb8aa41e107d9283f8 Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Fri, 5 Sep 2025 20:46:16 +0530
Subject: [PATCH 10/12] debug
---
Jenkinsfile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4b2189c..1812547 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -14,9 +14,12 @@ pipeline {
stage('SonarQube Scan') {
steps {
withSonarQubeEnv('SonarQubeServer') {
- sh '${SONARQUBE_SCANNER_HOME}/bin/sonar-scanner' -DsonarProjectName=Indore-Route-Pathfinder-cicd
+ sh ''' ${SONARQUBE_SCANNER_HOME}/bin/sonar-scanner \
+ -Dsonar.projectName=Indore-Route-Pathfinder-cicd \
-Dsonar.projectKey=Indore-Route-Pathfinder-cicd
+ '''
}
+
}
}
stage('OWASP Dependency Check') {
From 2c19c363a23d3f14d1b460e1bf5b1570d60f3622 Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Fri, 5 Sep 2025 22:28:20 +0530
Subject: [PATCH 11/12] debug trivy stage
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 1812547..72059c8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,7 +34,7 @@ pipeline {
}
stage('Trivy Scan') {
steps {
- sh 'trivy fs --exit-code 1 --severity HIGH,CRITICAL -f json -o trivy-report.json . '
+ sh 'trivy fs --severity HIGH,CRITICAL -f json -o trivy-report.json . '
}
}
stage('Quality Gate') {
From 6e1fdfa5a2044031a5ec0a3e0e183be9a2282070 Mon Sep 17 00:00:00 2001
From: "[lokendram10]" <[lokendradhote0@gmail.com]>
Date: Mon, 8 Sep 2025 19:53:12 +0530
Subject: [PATCH 12/12] added dependency check report command
---
Jenkinsfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 72059c8..89df1ef 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -30,6 +30,7 @@ pipeline {
, odcInstallation: 'owasp'
)
echo "OWASP Dependency Check"
+ dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}
}
stage('Trivy Scan') {