Natours Tour Booking Platform

Natours Tour Booking Platform

A full-featured tour booking platform built with Node.js, Express, and MongoDB, initially based on Jonas Schmedtmann's course but enhanced with real-world business logic and advanced features to create a production-ready application.

🎥 Video Presentation: Watch on YouTube
💻 Code Repository: GitHub Repository


Key Features

  • Secure authentication with email verification & 2FA
  • Advanced booking system with payments & refunds
  • Comprehensive admin dashboard for user & tour management
  • Role-based access control system
  • Email notifications for various events
  • Review moderation and management
  • Invoice generation and management
  • Tour capacity tracking and availability management
  • Secure payment processing with Stripe
  • Advanced error handling and logging

Tech Stack

Backend

  • Node.js
  • Express.js
  • MongoDB with Mongoose ODM
  • JWT for authentication
  • Stripe for payment processing

Frontend & Tools

  • Pug templates
  • CSS
  • JavaScript
  • SendGrid/Nodemailer for emails
  • Multer for file uploads

Project Architecture

This project follows the MVC (Model-View-Controller) architecture pattern:

  • Models: Mongoose schemas and models for tours, users, reviews, and bookings
  • Views: Pug templates for rendering the user interface
  • Controllers: Request handlers for tours, users, reviews, bookings, and authentication
  • Routes: Express routers for defining API endpoints and page routes
  • Middleware: Custom middleware for authentication, error handling, and request processing

Implementation Details

Authentication System

The authentication system includes:

  • User signup with email verification
  • Login with JWT tokens
  • Password reset functionality
  • Two-factor authentication option
  • User profile management
  • Role-based access control (admin, guide, lead-guide, user)

Tour Management

The tour management system includes:

  • CRUD operations for tours
  • Advanced filtering, sorting, and pagination
  • Geospatial queries for tours within a certain distance
  • Tour statistics and aggregation
  • Image upload and processing
  • Capacity management and availability tracking

Booking System

The booking system includes:

  • Secure checkout with Stripe
  • Booking management for users and admins
  • Email notifications for booking confirmations
  • Cancellation and refund processing
  • Invoice generation

Review System

The review system includes:

  • User reviews for tours
  • Average rating calculation
  • Review moderation by admins
  • Prevention of duplicate reviews

Learning Experience

This project was a significant learning experience, allowing me to:

  • Implement a complete authentication system with security best practices
  • Design and implement RESTful APIs following industry standards
  • Work with MongoDB and Mongoose to create complex data models and relationships
  • Integrate with third-party services like Stripe for payments and SendGrid for emails
  • Implement error handling and validation to create a robust application
  • Apply advanced features in Node.js and Express to create a scalable application

Source Code

Back to Projects