GithubHelp home page GithubHelp logo

ibrahim11elian / peakbooker Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 446 KB

Tour booking application

Home Page: https://peakbooker.vercel.app/

JavaScript 89.31% Pug 10.69%
booking cookie expressjs jwt-authentication mongodb restful-api sendgrid-mail stripe tours

peakbooker's Introduction

PeakBooker App

This project is a tour booking application based on the Node.js course by Jonas Schmedtmann. I have added several improvements to enhance the application's functionality and user experience.

Table of Contents

Folder Structure

.
├── api
│   ├── controllers
│   │   ├── authController.js
│   │   ├── baseController.js
│   │   ├── bookingController.js
│   │   ├── errorController.js
│   │   ├── reviewController.js
│   │   ├── toursController.js
│   │   └── usersController.js
│   ├── models
│   │   ├── bookingModel.js
│   │   ├── refreshTokenModel.js
│   │   ├── reviewModel.js
│   │   ├── tourModel.js
│   │   └── userModel.js
│   ├── routes
│   │   ├── booking-routes.js
│   │   ├── index.js
│   │   ├── reviews-routes.js
│   │   ├── tours-routes.js
│   │   └── users-routes.js
│   └── utils
│       ├── api-features.js
│       ├── email.js
│       ├── error.js
│       ├── firebase-config.js
│       ├── folder-builder.js
│       ├── imageUploader.js
│       └── logger.js
├── app.js
├── app.log
├── eslint.config.js
├── package.json
├── package-lock.json
├── README.md
├── server.js
├── vercel.json
└── views
    ├── baseEmail.pug
    ├── passwordReset.pug
    ├── _style.pug
    ├── verify.pug
    └── welcome.pug

Features

  • User Management: Register, login, update profile, and deactivate accounts, forget password, reset password.
  • Tour Management: Create, read, update, and delete tours, top 5 cheapest tours, tours statistics, busiest month in a year, tours within distance, closest tours from specific point(coordinate).
  • Booking Management: Create, read, update, and delete bookings, checkout booking, tour bookings, user bookings.
  • Review Management: Create, read, update, and delete reviews, tour reviews.
  • Payment Integration: Integrated with Stripe for secure payments.
  • Photo Uploading: Upload and resize user photos, stored in Firebase.
  • Email Notifications: Automated emails for user registration, booking confirmations, and password reset, resend email confirmation.
  • Pagination support.
  • Limit returned fields.
  • Sort returned data.
  • Error Handling: Improved error handling for both development and production environments.
  • Logging: Implemented request logging using Morgan and application logging using Winston.development and production environments.

Technologies Used

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose
  • Stripe API
  • Firebase Storage
  • Nodemailer
  • JWT
  • Multer
  • Sharp (for image processing)
  • Pug (for email templating)
  • Morgan, Winston (for logging)
  • ESLint, Prettier (for code quality)

Installation

  1. Clone the repository:

    git clone https://github.com/ibrahim11elian/PeakBooker.git
  2. Navigate to the project directory:

    cd booking-app
  3. Install the dependencies:

    npm install
  4. Set up your environment variables by creating a .env file in the root directory and adding the following:

    PORT=3000
    
    NODE_ENV=development
    
    DB_STRING=
    
    DB_USER=
    DB_PASSWORD=
    
    
    HASH_SALT=
    
    JWT_SECRET=
    JWT_EXPIRES_IN=
    JWT_COOKIE_EXPIRES_IN=
    JWT_REFRESH_SECRET=
    
    # Mailtrap (development env)
    EMAIL_USERNAME=
    EMAIL_PASSWORD=
    EMAIL_HOST=
    EMAIL_PORT=
    
    # Sendgrid
    SENDGRID_USERNAME=
    SENDGRID_PASSWORD=
    
    # Company Email
    EMAIL_FROM=
    
    # Stripe Key
    STRIPE_KEY=
    WEBHOOK_SECRET=
    
    # Firebase
    FIREBASE_API_KEY=
    FIREBASE_AUTH_DOMAIN=
    FIREBASE_PROJECT_ID=
    FIREBASE_STORAGE_BUCKET=
    FIREBASE_MESSAGING_SENDER_ID=
    FIREBASE_APP_ID=
    FIREBASE_MEASUREMENT_ID=
    
    FIREBASE_PRIVATE_KEY=
    FIREBASE_CLIENT_EMAIL=

Usage

  1. Start the development server:
    npm run start
  2. The application will be running on http://localhost:3000.

Error Handling

  • Development Mode: Detailed error information including stack trace.
  • Production Mode: Simplified error messages to prevent information leakage.
  • Custom Error Types: Handling of specific errors like CastError, ValidationError, JWT errors, and MongoDB duplicate errors.

Documentation

API Documentation

peakbooker's People

Contributors

ibrahim11elian avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.