🌍 Natours – Full-Stack Tour Booking Web Application Natours is a feature-rich tour booking web application built using MVC architecture. It allows users to explore various tours, register securely, and book their favorite packages with ease.
⚡️ Tech Stack 🎨 Frontend: HTML, CSS, JavaScript
⚡ Backend: Node.js, Express.js
🗄️ Database: MongoDB, Compass, Mongoose
🚀 Key Features ✅ Explore and browse available tour packages ✅ Secure user registration, login, and authentication (JWT) ✅ CRUD operations for managing tours and users ✅ MongoDB integration with Mongoose for efficient data handling ✅ MVC pattern for clean and scalable code ✅ Payment integration with Razorpay for smooth checkout
📡 Database Management MongoDB Atlas: For cloud-based data storage
MongoDB Compass: For local data visualization and management
🛠️ Installation & Setup Follow these steps to run the project locally:
-
Clone the Repository git clone https://github.com/your-username/natours.git
-
Navigate to Project Directory cd natours
-
Install Dependencies npm install
-
Set Up Environment Variables Create a .env file in the root directory and add the following: NODE_ENV = 'development' # or 'production' USER = 'your_name_here'
DATABASE = 'mongodb+srv://:@cluster.mongodb.net/natours' DATABASE_LOCAL = 'mongodb://localhost:27017/natours'
JWT_SECRET = 'your_jwt_secret' JWT_EXPIRES_IN = '90d' JWT_COOKIE_EXPIRES_IN = '30d'
EMAIL_USERNAME = 'your_mailtrap_username' EMAIL_PASSWORD = 'your_mailtrap_password' EMAIL_HOST = 'smtp.mailtrap.io' EMAIL_PORT = '2525'
PROD_EMAIL_USERNAME = 'your_brevo_email_username' PROD_EMAIL_PASSWORD = 'your_brevo_password'
EMAIL_FROM = 'your_email@example.com'
RAZORPAY_KEY_ID = 'your_razorpay_key_id' RAZORPAY_KEY_SECRET = 'your_razorpay_secret_key'
.env
- Start the Server
npm run start
npm run start:prod
- Open the App in Your Browser http://localhost:3000
📧 Email Configuration Development: Mailtrap SMTP for testing email services. Production: Brevo (SendinBlue) SMTP for sending real emails.
Booking Routes: POST /api/v1/bookings/checkout-session/:tourId – Payment via Razorpay
📝 Important Notes ✅ Security: Add .env to .gitignore to avoid pushing sensitive data. ✅ Payment Gateway: Razorpay API keys should be securely stored.