π 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 = '[email protected]'
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.