An awesome tour booking site built with NodeJS.
-
Authentication & Authorization
- Sign up, Log in, Logout, Update, Reset Password.
- Users can be Regular User, Admin, Lead Guide, or Guide.
- Default role on sign up: Regular User.
-
User Profile
- Users can update username, photo, email, password, and other information.
-
Tours
- Admin and Lead Guide can create, update, and delete tours.
- All users can view tours.
- Booking, map, reviews, and ratings are available for all tours.
-
Bookings
- Only Regular Users can book tours (with payment).
- Regular users cannot book the same tour twice.
- Admin and Lead Guide can view, create, edit, and delete any booking.
- Regular Users can see their bookings.
-
Reviews
- Only Regular Users can write reviews for tours they've booked.
- Users can edit and delete their own reviews.
- Admin can delete any review.
- Users cannot review the same tour twice.
-
Favorite Tours
- Regular Users can add/remove booked tours to/from their favorite list.
- A tour can only be added once to a user's favorites.
-
Credit card payment using Stripe
- Sign In to your account.
- Browse and search for the tours that interest you.
- Select a Tour and complete the booking process.
- Proceed to Payment Checkout.
- Enter the following test card details:
- Card No. : 4242 4242 4242 4242 - Expiry date: 02 / 22 - CVV: 222
- Done! Your tour is booked!
- After booking, visit the "Manage Booking" page under your profile to view or edit your tour reservations.
- Update your username, profile photo, email, and password anytime in the Profile Settings section.
- Node.js: JavaScript runtime environment.
- Express: Web framework.
- Mongoose: ODM library for MongoDB.
- MongoDB Atlas: Cloud database.
- Pug: Template engine.
- JWT: JSON Web Token for authentication.
- Parcel: Blazing fast web application bundler.
- Stripe: Online payment gateway.
- Postman: API testing tool.
- Mailtrap & Sendgrid: Email delivery services.
- Heroku: Cloud platform.
- Mapbox: Map service for displaying tour locations.
To run the app locally, follow these steps:
- Clone the repo to your machine:
git clone https://github.com/js313/natours.git
- Navigate into the project directory:
cd natours
- Install dependencies:
npm install
- Set up environment variables in a
.env
file:DATABASE=your MongoDB URL DATABASE_PASSWORD=your MongoDB password SECRET=your JWT secret JWT_EXPIRES_IN=90d JWT_COOKIE_EXPIRES_IN=90 EMAIL_USERNAME=your Mailtrap username EMAIL_PASSWORD=your Mailtrap password EMAIL_HOST=smtp.mailtrap.io EMAIL_PORT=2525 EMAIL_FROM=your real email address SENDGRID_USERNAME=apikey SENDGRID_PASSWORD=your Sendgrid password STRIPE_SECRET_KEY=your Stripe secret key STRIPE_WEBHOOK_SECRET=your Stripe webhook secret
- Start the server:
npm run dev
To interact with the Natours API, set up the following variables in Postman for both development and production environments:
- {{URL}} : Set this to your app's base URL (e.g., http://127.0.0.1:3000 or http://www.example.com).
- {{password}} : Your user password.
Contributions are welcome! If you want to contribute, please open an issue first to discuss your ideas.
This project is licensed under the MIT License.
- This project is inspired by the Node.js, Express, MongoDB & More: The Complete Bootcamp course by Jonas Schmedtmann on Udemy.
- Thanks to Jonas Schmedtmann for creating this amazing learning experience.