Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/solygambas/node-tour-operator-booking-app

A tour operator booking app with a REST API using MongoDB, Mongoose, Express and Stripe.
https://github.com/solygambas/node-tour-operator-booking-app

bun deno express expressjs fastify firebase javascript mongodb mongoose nestjs node nodejs notion-api oak pug rest-api stripe typescript websocket websockets

Last synced: 3 months ago
JSON representation

A tour operator booking app with a REST API using MongoDB, Mongoose, Express and Stripe.

Awesome Lists containing this project

README

        

# Tour Operator Booking App

A tour operator booking app with a REST API using MongoDB, Mongoose, Express and Stripe.

## 1) Node.js Basics - Node Farm

A very simple API to understand Node.js and NPM basics.

[See node-farm folder](node-farm)



Screenshot of Node Farm

### Features

- using core modules, third-party modules and our own modules.
- reading and writing files with fs.
- building a basic server with http.createServer and handling routes.
- building templates and parsing variables from URLs.
- creating nice URLs with slugify.

## 2) Tour Operator Booking App - Natours

A tour operator booking app with a REST API using MongoDB, Mongoose, Express and Stripe.

[See Demo deployed on Render](https://node-travel-app.onrender.com/)

[See API documentation on Postman](https://documenter.getpostman.com/view/11993746/T17Ke7HH?version=latest)

[See natours folder](natours)



See Demo deployed on Render

### Key features

- building a REST API with Express, logging requests with Morgan and sending JSend responses.
- using the MVC (Model-View-Controller) architecture with separate routers.
- rendering a server-side website with Pug templates.
- handling log in, sign up and book tour actions with JavaScript and Axios.
- displaying day-by-day itinerary for each tour with Mapbox.
- showing user-friendly alerts with success/error messages.
- updating user settings, profile picture and showing bookings in user dashboard.
- accepting credit card payments with Stripe Checkout and listening to Stripe webhooks.
- sending emails with Pug templates, Nodemailer, Mailtrap and Sendgrid.
- uploading files with multer and processing images with sharp.
- deploying on Render.

### MongoDB and Mongoose

- performing CRUD operations with MongoDB database locally and on MongoDB Atlas.
- writing a script to import data into MongoDB.
- filtering, sorting, aliasing and handling pagination with Mongoose.
- manipulating data with aggregation pipeline and operators.
- leveraging Mongoose pre and post hooks: document middleware, aggregate middleware and query middleware.
- validating data and creating custom validators with Mongoose schemas and validator.
- modeling relationships between data, embedding and referencing.
- creating a factory function for CRUD operations on Tours, Users, Reviews and Bookings.
- using indexes, modeling geospatial data with $geoWithin and $geoNear operators.
- publishing API documentation on Postman.

### Error handling

- handling operational errors and programmer errors with a middleware wrapping all async controllers.
- sending complete error messages in development and user-friendly messages in production.
- having a safety net for unhandled promise rejections, uncaught exceptions and SIGTERM signals with process.on.
- debugging with ndb.

### Authentication and authorization

- hashing passwords with bcryptjs.
- building a complete authentication workflow with JWT: user sign up, log in and reset password via email.
- protecting routes and restricting access according to user role (user, guide, lead guide, admin).

### Security

- implementing security best practices with express-rate-limit, helmet and CORS.
- sending tokens in secure cookies and reading them with cookie-parser.
- sanitizing data with express-mongo-sanitize, xss-clean and hpp.

Based on [Node.js, Express, MongoDB & More: The Complete Bootcamp](https://www.udemy.com/course/nodejs-express-mongodb-bootcamp/) by Jonas Schmedtmann (2019).