A comprehensive travel planning and booking platform built with modern technologies.
- Runtime: Node.js + Express.js
- Database: MongoDB + Mongoose
- Authentication: Bcrypt password hashing
- Email: Nodemailer (OTP, notifications)
- API: RESTful architecture
- Framework: React + Vite
- Styling: CSS Modules
- State: React Hooks
- HTTP: Fetch API
👤 User Authentication
- Sign up / Login
- Password reset with OTP
- Profile management
🏨 Booking System
- Browse destinations
- Book accommodations
- View booking history
- Booking status tracking
⭐ Reviews & Ratings
- Submit reviews for bookings
- View all reviews
- Rating system (1-5 stars)
💬 Query Management
- Submit support queries
- Admin responses
- Query status tracking
👨💼 Admin Dashboard
- Manage users
- Manage bookings
- Handle queries
- View analytics
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
macOS:
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-communityWindows: Download from MongoDB Website
Linux (Ubuntu):
sudo apt-get install -y mongodb-org
sudo systemctl start mongodgit clone https://github.com/AryanCodeWizard/Travel-Planner.git
cd Travel-Plannercd backend
npm install
cp .env.example .env
# Edit .env with your configuration
npm run devBackend runs on: http://localhost:3000
cd Frontend
npm install
npm run devFrontend runs on: http://localhost:5173
# MongoDBMONGODB_URI=mongodb://localhost:27017/tour_planner# ServerPORT=3000NODE_ENV=development# CORSCORS_ORIGIN=http://localhost:5173# Email (Optional)EMAIL_HOST=smtp.gmail.comEMAIL_PORT=587EMAIL_USER=your-email@gmail.comEMAIL_PASSWORD=your-app-passwordVITE_API_URL=http://localhost:3000/apiPOST /api/auth/signup- Register new userPOST /api/auth/login- User loginPOST /api/auth/forgot-password- Request OTPPOST /api/auth/verify-otp- Verify OTPPOST /api/auth/reset-password- Reset password
GET /api/user/data- Get user profilePOST /api/user/update- Update profile
POST /api/booking/save- Create bookingGET /api/booking/user-bookings- Get user bookingsGET /api/booking/recent-activities- Recent bookings
POST /api/review/submit- Submit reviewGET /api/review/all- Get all reviews
GET /api/admin/users- Get all usersGET /api/admin/bookings- Get all bookingsPOST /api/admin/update-booking- Update bookingDELETE /api/admin/delete-booking/:id- Delete booking
Travel-Planner/
├── backend/
│ ├── config/
│ │ └── database.js
│ ├── models/
│ │ ├── User.js
│ │ ├── Booking.js
│ │ ├── Review.js
│ │ └── Query.js
│ ├── routes/
│ │ ├── auth.js
│ │ ├── user.js
│ │ ├── booking.js
│ │ ├── admin.js
│ │ ├── review.js
│ │ └── query.js
│ ├── utils/
│ │ └── mailer.js
│ └── server.js
│
├── Frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── config/
│ │ │ └── api.js
│ │ └── App.jsx
│ └── index.html
│
└── docs/
├── QUICK_START.md
├── MONGODB_SETUP.md
├── MIGRATION_GUIDE.md
└── MIGRATION_SUMMARY.md
# Terminal 1: Start MongoDB
brew services start mongodb-community # macOS
sudo systemctl start mongod # Linux# Terminal 2: Start Backendcd backend && npm run dev
# Terminal 3: Start Frontendcd Frontend && npm run devVisit: http://localhost:5173
- Quick Start Guide - Get started quickly
- MongoDB Setup - Database setup guide
- Migration Guide - PHP to Node.js migration
- Migration Summary - Complete migration overview
curl http://localhost:3000/mongosh
use tour_planner
db.stats()- ✅ Password hashing with bcrypt
- ✅ CORS protection
- ✅ Environment variable configuration
- ✅ Input validation & sanitization
- ✅ Secure OTP generation
- ✅ Auto-expiring password reset tokens
- users - User accounts and profiles
- bookings - Travel bookings and reservations
- reviews - User reviews and ratings
- queries - Support queries and tickets
- passwordresets - OTP tokens for password reset
- Create account at MongoDB Atlas
- Create cluster
- Get connection string
- Update
.envwith Atlas URI
- Backend: Heroku, AWS, Azure, DigitalOcean
- Frontend: Vercel, Netlify, AWS S3
- Database: MongoDB Atlas
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the ISC License.
- AryanCodeWizard - GitHub
- MongoDB for the excellent database
- Express.js for the web framework
- React team for the amazing frontend library
- All contributors and supporters
For issues and questions:
- Open an issue on GitHub
- Check documentation in
/docsfolder - Review troubleshooting in
QUICK_START.md
Built with ❤️ using Node.js, MongoDB, Express, and React
🌟 Star this repo if you found it helpful!
Travel Planner is a comprehensive web application that streamlines travel planning and booking. With an intuitive user interface and powerful backend, it helps users discover destinations, book accommodations, plan activities, and manage their entire travel experience from a single platform.
|
|
|
|
|
|
Additional technologies:
- Framer Motion: Animation library for React
- PHPMailer: Email functionality
- JSON Web Tokens: Authentication mechanism
Travel-Planner/
├── Frontend/ # React frontend application
│ ├── public/ # Public assets
│ ├── src/ # Source files
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── data/ # Mock data and constants
│ │ └── App.jsx # Main application component
│ ├── index.html # HTML entry point
│ └── package.json # Frontend dependencies
│
├── backend/ # PHP backend
│ ├── config/ # Database configuration
│ ├── controllers/ # Business logic
│ ├── utils/ # Utility functions
│ └── *.php # API endpoints
│
├── database/ # Database schema and migrations
├── PHPMailer/ # PHPMailer library for emails
└── README.md # Project documentation
- XAMPP (version 7.4+ recommended)
- Node.js (version 18+ recommended) and npm
- Git (optional, for cloning the repository)
- Download and install XAMPP from the official website
- Start the XAMPP Control Panel and start both Apache and MySQL services
- Verify that services are running correctly:
- Apache should be green and running on port 80
- MySQL should be green and running on port 3306
- Open your browser and go to phpMyAdmin:
http://localhost/phpmyadmin - Create a new database:
CREATEDATABASEtravel_planner;
- Select the newly created database and import the schema:
- Click on the "Import" tab
- Click "Browse" and navigate to
/Applications/XAMPP/xamppfiles/htdocs/img/Travel-Planner/database/travel_planner.sql - Click "Go" to import the schema
Alternatively, you can set up the database manually with these SQL commands:
CREATEDATABASEtravel_planner;
USE travel_planner;
-- Users TableCREATETABLEusers (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
is_admin BOOLEAN DEFAULT FALSE,
registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert admin userINSERT INTO users (name, email, password, is_admin) VALUES ('Admin', 'admin@travelplanner.com', '$2y$10$YourHashedPasswordHere', TRUE);
-- Destinations TableCREATETABLEdestinations (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
location VARCHAR(100) NOT NULL,
description TEXT,
image VARCHAR(255),
cost DECIMAL(10,2) NOT NULL,
rating DECIMAL(3,1),
reviews INT DEFAULT 0
);
-- Accommodations TableCREATETABLEaccommodations (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
location VARCHAR(100) NOT NULL,
description TEXT,
image VARCHAR(255),
cost DECIMAL(10,2) NOT NULL,
rating DECIMAL(3,1),
reviews INT DEFAULT 0
);
-- Bookings TableCREATETABLEbookings (
booking_id VARCHAR(20) PRIMARY KEY,
user_id INT,
destination VARCHAR(100),
accommodation VARCHAR(100),
check_in_date DATE,
check_out_date DATE,
num_nights INT,
total_cost DECIMAL(10,2),
booking_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
admin_status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
payment_method VARCHAR(50),
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- Reviews TableCREATETABLEreviews (
id INT AUTO_INCREMENT PRIMARY KEY,
booking_id VARCHAR(20),
user_id INT,
rating INTNOT NULL,
review_text TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (booking_id) REFERENCES bookings(booking_id),
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- User Queries TableCREATETABLEuser_queries (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
user_name VARCHAR(100),
user_email VARCHAR(100),
subject VARCHAR(255),
message TEXT,
reply TEXTNULL,
status ENUM('pending', 'answered') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPNULLONUPDATECURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);- If using Git, clone the repository to your XAMPP's htdocs folder:
cd /Applications/XAMPP/xamppfiles/htdocs/img git clone https://github.com/yourusername/travel-planner.git Travel-Planner - If not using Git, download the ZIP and extract it to:
/Applications/XAMPP/xamppfiles/htdocs/img/Travel-Planner
Navigate to the backend configuration file:
cd /Applications/XAMPP/xamppfiles/htdocs/img/Travel-Planner/backend/configCreate or edit the
database.phpfile with your MySQL credentials:<?php// Database configurationdefine('DB_SERVER', 'localhost'); define('DB_USERNAME', 'root'); // Default XAMPP usernamedefine('DB_PASSWORD', ''); // Default XAMPP password is emptydefine('DB_NAME', 'travel_planner'); // Attempt to connect to MySQL database$conn = newmysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME); // Check connectionif ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } ?>
Configure the email settings in PHPMailer (if using email features):
// Inside email-sending script$mail = newPHPMailer(true); $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; // Or your SMTP server$mail->SMTPAuth = true; $mail->Username = 'your-email@gmail.com'; $mail->Password = 'your-app-password'; // Use app password for Gmail$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587;
Navigate to the Frontend directory:
cd /Applications/XAMPP/xamppfiles/htdocs/img/Travel-Planner/FrontendInstall dependencies:
npm install
Start the development server:
npm run dev
The development server will start, typically at
http://localhost:3000
Ensure your API endpoints are correctly pointing to the backend:
// Example in your React codeconstAPI_BASE_URL='http://localhost/img/Travel-Planner/backend';
You may need to configure CORS in your PHP backend:
// Add to the top of your PHP API filesheader("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS"); header("Access-Control-Allow-Headers: Content-Type, Authorization");
If you want to populate your database with sample data:
-- Sample destinationsINSERT INTO destinations (title, location, description, image, cost, rating, reviews) VALUES ('Great Wall of China', 'Beijing, China', 'One of the Seven Wonders of the World.', 'https://example.com/greatwall.jpg', 499999, 4.9, 8000),
('Taj Mahal', 'Agra, India', 'A symbol of eternal love.', 'https://example.com/tajmahal.jpg', 9999, 4.9, 5500);
-- Sample accommodationsINSERT INTO accommodations (title, location, description, image, cost, rating, reviews) VALUES ('Luxury Beach Resort', 'Maldives', 'Relax in a private villa with ocean access.', 'https://example.com/resort.jpg', 3499, 4.8, 290),
('Mountain Retreat', 'Swiss Alps', 'Cozy wooden lodge with breathtaking views.', 'https://example.com/lodge.jpg', 4999, 4.9, 340);Frontend: Open your browser and navigate to:
http://localhost:3000Backend API: Available at:
http://localhost/img/Travel-Planner/backend/
For testing purposes, you can use these accounts:
Admin Account:
- Email: admin@travelplanner.com
- Password: admin123
Sample User Account:
- Email: user@example.com
- Password: user123
- User Registration: Create a new account
- User Login: Use the sample account or newly created one
- Browse Destinations: View available destinations
- Book Accommodation: Select dates and complete a booking
- Manage Bookings: View your bookings in the user dashboard
- Admin Features: Log in with the admin account to manage users, bookings, and queries
- Error: "Cannot connect to database"
- Solution: Verify MySQL is running in XAMPP Control Panel
- Solution: Double-check database name, username, and password in config file
- Error: "Failed to fetch" in browser console
- Solution: Ensure Apache is running
- Solution: Check API endpoint URLs are correct
- Solution: Verify CORS headers are properly set
- Error: npm dependencies issues
- Solution: Delete node_modules folder and run
npm installagain - Solution: Make sure you're using a compatible Node.js version
- Solution: Delete node_modules folder and run
- Error: "Call to undefined function" or similar
- Solution: Make sure PHP extensions are enabled in php.ini
- Solution: Check XAMPP PHP version is 7.4 or higher
- Email: support@travelplanner.com
- GitHub Issues: https://github.com/yourusername/travel-planner/issues
- Developer: Your Name



