RAILWAY RESERVATION SYSTEM
A MINI PROJECT REPORT
Submitted by
Mohanapoorani.R[211423104379]
Mrunalini.S [211423104388]
Naveena.H[211423104407]
Naveena Sree[211423104408]
in partial fulfilment for the award of the degree
of
BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING
PANIMALAR ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
23CS1312-DATABASE MANAGEMENT SYSTEM LAB
NOVEMBER 2024
Page 1
PANIMALAR ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
BONAFIDE CERTIFICATE
Certified that this project report “RAILWAY RESERVATION SYSTEM” is the
bonafide work of“MOHANAPOORANI R [211423104379], MRUNALINI.S
[211423104388], NAVEENA.H [21142310407] and NAVEENASREE
[21142310408]” who carried out the project work under my supervision.
Signature of the Supervisor with date
Mrs. [Link] JENNIFER M.E.,
Assistant professor,
Department of Computer Science and
Engineering,
Panimalar Engineering College,
Chennai-123.
Page 2
ABSTRACT
The Railway Registration System is a database management project designed to
streamline the process of booking and managing railway tickets. The system
provides a user-friendly interface for passengers to register, book tickets, and view
train schedules efficiently. It integrates key functionalities such as user registration,
train information management, ticket booking, and cancellations. The database
ensures the integrity and security of data, allowing users to update personal details.
The back-end is powered by a relational database management system (RDBMS),
which stores and manages data such as passenger details, train routes, schedules,
ticket availability, and booking records. The system supports various queries for
viewing available trains, checking seat availability, and generating reports related
to bookings and train operations.
The Railway Registration System simplifies railway management for both
passengers and administrators, enhancing the overall experience through an efficient
and organized digital platform.
Page 3
TABLE OF CONTENTS
[Link] CONTENTS PAGE NO
ABSRACT 3
1. INTRODUCTION 5
2. OBJECTIVE 6
3. SYSTEM REQUIREMENTS 7
8
4. ER-DIAGRAM
5. IMPLEMENTATION 9 - 32
6. SCREENSHOTS 32 - 36
7. CONCLUSION 37
Page 4
INTRODUCTION
The Railway Registration System is a comprehensive digital platform
designed to simplify the process of booking railway tickets and managing
passenger information. In today's fast-paced world, traditional methods of
ticket booking are increasingly becoming inefficient, leading to long
queues, delays, and inconvenience for both passengers and railway staff.
To address these challenges, this system provides an automated, efficient
solution for managing the various aspects of railway ticketing and
registration.
This system allows users to register, book tickets, check seat availability,
view train schedules, and manage bookings from the convenience of their
devices.
This project demonstrates the power of a database management system
(DBMS) in enhancing operational efficiency while ensuring data integrity
and security.
Page 5
OBJECTIVE
The primary objective of the Railway Registration System is to develop
a streamlined and efficient platform for managing railway ticket bookings
and passenger registrations using a relational database management
system (RDBMS). The system aims to:
1. Simplify the Ticket Booking Process: Provide an easy-to-use
interface for passengers to search train schedules, check seat availability,
and book tickets online.
2. Ensure Data Accuracy and Security: Store passenger details, train
schedules, booking records, and seat availability in a secure and reliable
database.
3. Improve Administrative Efficiency: Enable railway administrators to
manage train information, update schedules, and monitor bookings and
cancellations through a centralized system.
4. Generate Real-Time Information: Allow users to access real-time
data on train availability, routes, and booking statuses, ensuring up-to-date
and accurate information.
Page 6
SYSTEM REQUIREMENTS
1. Hardware Requirements:
Processor: Intel Core i3 or higher
RAM: 4 GB or more
Hard Disk: 20 GB of free space
Monitor: 15-inch display or larger
Network Adapter: Required for internet-based or networked systems
Input Devices: Keyboard and mouse
2. Software Requirements:
Operating System:
o Windows 7/8/10/11, Linux, or macOS
Database Management System (DBMS):
o MySQL, PostgreSQL, or Oracle Database (any relational database
system)
Programming Languages:
o HTML, CSS and Javascript for front-end development
o SQL for database queries
IDE or Text Editor:
o Visual Studio Code
Page 7
ER DIAGRAM
Page 8
IMPLEMENTATION
HTML code for Home page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Railway Ticket Booking</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header>
<div class="logo">
<h1>Railway Booking</h1>
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
<li><a href="[Link]">Login</a></li>
</ul>
</nav>
</header>
<main>
<section class="Homepg" >
<img src="./[Link]" style="width: 1000px; height: 400px;border-radius:10px;margin-
left:80px;margin-right: 80px;">
<h1 style="text-align: center;color: rgb(6, 46, 57);">TRAIN TICKET BOOKING</h1>
<div class="buttoncontainer">
<div class="buttoncenter">
Page 9
<a href="[Link]">
<button style="width: 150px; border-radius: 10px;align-items: center;" BOOK NOW
</button>
</a>
</div>
</div>
</section>
</body>
</html>
HTML code for Booking section:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Railway Ticket Booking</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<main>
<header>
<div class="logo">
<h1>Railway Booking</h1>
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
<li><a href="[Link]">Login</a></li>
</ul>
</nav>
</header>
<section class="booking-section" style="margin-top: 40px;">
<h2>Book Your Ticket</h2>
<form id="booking-form">
<div class="form-group">
Page 10
<label for="from">From:</label>
<input type="text" id="from" name="from" required>
</div>
<div class="form-group">
<label for="to">To:</label>
<input type="text" id="to" name="to" required>
</div>
<div class="form-group">
<label for="date">Date:</label>
<input type="date" id="date" name="date" required>
</div>
<div class="form-group">
<label for="passengers">Number of Passengers:</label>
<input type="number" id="passengers" name="passengers" min="1" required
onchange="updatePassengerFields()">
</div>
<div id="passenger-details"></div>
<div class="form-group">
<label for="coach">Select Coach Type:</label>
<select id="coach" name="coach" required>
<option value="sleeper">Sleeper</option>
<option value="ac-3">AC 3 Tier</option>
<option value="ac-2">AC 2 Tier</option>
<option value="first-class">First Class</option>
</select>
</div>
<div class="form-group">
<label for="berth">Select Berth Preference:</label>
<select id="berth" name="berth" required>
<option value="lower">Lower Berth</option>
<option value="middle">Middle Berth</option>
<option value="upper">Upper Berth</option>
<option value="side-lower">Side Lower Berth</option>
</select>
</div>
<button type="button" id="submit-btn">Search Trains</button>
</form>
Page 11
<script>
function updatePassengerFields() {
const numberOfPassengers= [Link]('passengers').value;
const passengerDetails = [Link]('passenger-details');
[Link] = ''; // Clear previous fields for (let i = 0;
i < numberOfPassengers; i++) {
[Link] += `
<h3>Passenger ${i + 1}</h3>
<div class="form-group">
<label for="sex-${i}">Sex:</label>
<select id="sex-${i}" name="sex-${i}" required>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="age-${i}">Age:</label>
<input type="number" id="age-${i}" name="age-${i}" min="1"
required>
</div>
<div class="form-group">
<label for="phone-${i}">Phone Number:</label>
<input type="tel" id="phone-${i}" name="phone-${i}" required>
</div>;
}
}
[Link]('submit-btn').addEventListener('click',
function() const formData = {
from: [Link]('from').value,
to: [Link]('to').value,
date: [Link]('date').value, passengers: [],
coach: [Link]('coach').value, berth:
[Link]('berth').value,
};
Page 12
const numberOfPassengers = [Link]('passengers').value;
for (let i = 0; i < numberOfPassengers; i++) {
const passenger = {
sex: [Link](sex-${i}).value, age:
[Link](age-${i}).value,
phone: [Link](phone-${i}).value,
};
[Link](passenger);
}
// Send the data to the backend
fetch('[Link] {
method: 'POST', headers: {
'Content-Type': 'application/json',
},
body: [Link](formData),
// Clear form fields after submission (optional)
[Link]('booking-form').reset();
[Link]('passenger-details').innerHTML = '';
});
</script>
</section>
</main>
</body>
</html>
HTML code for Login page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Page 13
<link rel="stylesheet" href="[Link]">
<title>Login - Railway Ticket Booking System</title>
</head>
<body>
<div class="container">
<h1>Login</h1>
<form id="loginForm">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">Login</button>
<p class="message">Not registered? <a href="#">Create an account</a>
</p>
</form>
</div>
<script>
[Link]('loginForm').addEventListener('submit',
function(event) {
[Link](); [Link] =
'[Link]';
});
</script>
</body>
</html>
CSS code for login section
*{
box-sizing: border-box;
Page 14
margin: 0;
padding: 0;
}
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
Page 15
button{
width: 100%;
padding: 10px;
background-color: #5cb85c;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #4cae4c;
}
.message {
text-align: center;
margin-top: 10px;
}
CSS code for Home page and Booking section:
*{
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #35424a;
color: white;
padding: 20px;
display: flex;
justify-content: space-between;
Page 16
align-items: center;
}
.logo h1 {
margin: 0;
}
nav ul {
list-style: none;
display: flex;
margin: 0;
padding: 0;
}
nav ul li {
margin-left: 20px;
}
nav ul li a {
color: white;
text-decoration: none;
}
nav ul li a:hover {
text-decoration: underline;
}
main {
max-width:1200px;
margin:20px auto;
padding: 20px;
}
.booking-section {
background: white;
padding:20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
h2 {
margin-top: 0;
}
Page 17
.form-group {
margin-bottom: 15px;
}
label {
display:block;
margin-bottom: 5px;
}
input[type="text"],
input[type="date"],
input[type="number"],
input[type="tel"],
select {
width:100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
width:100%;
padding: 10px;
background-color: #35424a;
color: white;
border:none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #4e5d67;
}
.train-info {
display: flex;
flex-wrap: wrap;
}
.train-card {
background: white;
border: 1px solid #ccc;
Page 18
border-radius: 5px;
padding: 15px;
margin: 10px;
flex: 1 1 calc(30% - 20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.train-card h3 {
margin: 0;
}
footer {
text-align:center;
padding: 20px;
background-color: #35424a;
color: white;
}
.passenger {
margin-bottom:20px;
padding: 10px;
border: 1px solid #ccc;
border-radius:5px;
background-color: #f9f9f9;
}
.buttoncenter{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.buttoncontainer{
height:50px;
position: relative;
}
Page 19
Backend code for this project
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const cors = require('cors');
// Create an express app
const app = express();
[Link](cors());
[Link]([Link]());
// MongoDB connection URL
const mongoURI = 'mongodb://localhost:27017/railway_booking'; // replace with your
MongoDB URI
[Link](mongoURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => [Link]('MongoDB connected...'))
.catch(err => [Link](err));
// Define the schema for passengers
const passengerSchema = new [Link]({
sex: String,
age: Number,
phone: String,
});
// Define the schema for booking data
const bookingSchema = new [Link]({
from: String,
to: String,
date: Date,
passengers: [passengerSchema],
coach: String,
berth: String,
});
Page 20
// Create a model based on the schema
const Booking = [Link]('Booking', bookingSchema);
// POST route to save booking details
[Link]('/api/search-trains', async (req, res) => {
try {
// Create a new booking from the request body
const newBooking = new Booking({
from: [Link],
to: [Link],
date: [Link],
passengers: [Link],
coach: [Link],
berth: [Link],
});
// Save the booking data to MongoDB
await [Link]();
[Link](201).json({ message: 'Booking saved successfully!', bookings: newBooking
});
} catch (err) {
[Link](500).json({ message: 'Error saving booking', error: [Link] });
}
});
// Listen on port 5000
const PORT = [Link] || 5000;
[Link](PORT, () => {
[Link](`Server running on port ${PORT}`);
});
Page 21
OUTPUT: SCREENSHOTS
FRONT END:
Fig6.1-HOME PAGE
Fig6.2- LOGIN PAGE
Page 22
Fig6.3 -TRAIN DETAILS
Fig6.4-PASSENGER DETAILS
Page 23
BACKEND:
Page 24
Fig 6.5 -PASSENGER DATABASE
Page 25
CONCLUSION
This project demonstrates the practical application of database
management concepts, such as data modeling, SQL queries, and
transaction management, to solve real-world problems. It enhances the
overall user experience by providing an intuitive interface, real-time
information access, and seamless management of bookings and
cancellations.
In conclusion, the Railway Registration System not only meets the
requirements of passengers by making ticket booking simpler and more
accessible but also helps railway administrators streamline operations,
improving overall service quality.
Page 26