Skip to content

SamerYaserr/Natours

Repository files navigation

🌿 Natours

Natours is a full-stack tour-booking app with a RESTful API backend (Node.js, Express, MongoDB/Mongoose) and a server-side rendered frontend (Pug, Vanilla JS, CSS).

🔨 Teck Stack

Node.js PUG nodemon Express MongoDB Axois Stripe Deployed on Railway npm JWT

🏗️ Architecture

  • Backend:

    • REST API with filtering, sorting, pagination, and aliasing
    • Stack: Node.js, Express
    • Endpoints: /tours, /users, /reviews, /bookings
    • Auth & Security: JWT (HTTP-only cookies), rate limiting (100 req/hr), Helmet headers, NoSQL sanitization
    • Responses: JSON, proper HTTP status codes
  • Frontend:

    • Templating: Pug
    • Bundling & ES6: Webpack, modern JavaScript
    • API Calls: Axios

✨ Features

  • Security

    • JWT-based login/signup (bcrypt-hashed passwords)
    • Rate limiting, Helmet, data sanitization
  • Email Notifications

    • Nodemailer (Gmail) for welcome, password reset & booking confirmations
  • Payments

    • Stripe checkout, webhook listener → booking creation
  • Geospatial

    • Radius search & distance calculations
    • Leaflet map integration
  • Images

    • Multer + Sharp for upload, resize (500×500), JPEG conversion & optimization

API Documentation

Run in Postman

Installation

  1. Clone repository:

    git clone https://github.com/SamerYaserr/Natours.git
  2. Initialize a Package.json File (if not already done):

    npm init
  3. Install dependencies:

    npm install
  4. Setting up env variables:

    # Server Configuration
    NODE_ENV=development
    PORT=3000
    
    # Database Configuration
    DATABASE=<your_mongo_db_URL>
    DATABASE_PASSWORD=<your_mongo_db_password>
    
    # Authentication
    JWT_SECRET=<your_jwt_secret_key>
    JWT_EXPIRES_IN=<JWT_expiration_date>
    JWT_COOKIE_EXPIRES_IN=<JWT_cookie_expiration_date>
    
    # Email Services
    ## Mailtrap (Development)
    EMAIL_HOST=<sandbox.smtp.mailtrap.io>
    EMAIL_PORT=587
    EMAIL_USERNAME=<your_mailtrap_username>
    EMAIL_PASSWORD=<your_mailtrap_password>
    
    ## Gmail (Production)
    GMAIL_LOGIN=<your_gmail>
    GMAIL_PASSWORD=<your_gmail_app_key>
    
    # Payments
    STRIPE_SECRET_KEY=<your_stripe_secret_key>
    STRIPE_WEBHOOK_SECRET=<your_stripe_webhook_secret_key>
    
    # General Settings
    EMAIL_FROM=<your_sender_email>
    

About

Natours – A Node.js tour-booking app with map-based search, user auth, image uploads, and Stripe payments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors