cpsc455-bugstorm / TravelersTea

A Trip Planning App that tailors travel itineraries based on user preferences and providing detailed information about destinations; making travel planning less daunting and more enjoyable.
https://travelerstea-906d.onrender.com
MIT License
6 stars 2 forks source link
googleapi mapbox-gl mern mui openai

TravelersTea

Demo

IMAGE_ALT

Project Description

Welcome to Traveler’s Tea, an intuitive and personalized travel planning web app that turns your travel dreams into detailed itineraries.

Built around user preferences, the app delivers curated plans comprising places to visit, descriptions, and more, all at your fingertips.

Alongside its planning capabilities, TravelersTea thrives on the collective wisdom of its user community, featuring plan sharing with others, and shaping a dynamic and interactive travel planning experience.

Table of Contents

Project Requirements

Minimal Requirements

Standard Requirements

Stretch Requirements

Usage of Units

Unit 1: HTML CSS JS: Our frontend consists of appropriately sized components, where each one involved writing JSX using Tailwind CSS. Since these JS language extensions are based on HTML and CSS, we utilized knowledge from all three languages to build our app.

Unit 2: React and Redux: Our front end was built using React and Redux. We followed best practices by using thunks to handle asynchronous events, segregated the API calls into their own service.js files, and used state hooks to manage frontend states.

Unit 3: Node/Express: Our backend uses Node and Express. We followed design patterns such as the Model Route Controller pattern in order to separate the responsibilities of handling the business logic, route exposure, and database models. Express also allowed us to build middlewares for error handling, error logging, general logging, authentication, and IP based rate limiting.

Unit 4: MongoDB: Our data is stored in collections inside an Atlas Cluster. We followed model schema design best practices such as choosing to not go with the common embedded document pattern by considering how frequently documents may be accessed and changed.

Unit 5: GitHub Action to format the code before any pushes to main. Two-stage Docker, one to build all dependencies for the server and client, then the second to copy over only necessary built-artifacts and run the server that serves the client. Deployed using Render with docker.

Above and Beyond Functionality

Descriptions of Next Steps

We would like to add improved budget considerations when generating trips and implement Global Share Board and Voting System between friends and families for itineraries. We would also like to improve popups for markers on the map to have more details about the place, such as opening hours and images, and retry Logic for failed stages and trips

Team Contributions

Andy My responsibilities were mainly centered around the backend as I implemented the user system, auth middleware, error handling and logging middlewares, share itinerary backend, postman regression tests. I was also responsible for the initial implementation and investigation for mapbox-gl, which is the map in our app.

Noreen: Most of my tasks were creating UI views in the frontend (React / Redux / Tailwind CSS). To chronologically name a few large features, I created the wireframe draft of the app, the regular trip view which includes teacups and the side panel, the “see more” drawer, the day view, the compact view, and finally light mode. I also styled and placed markers on the map.

Lymeng: I set up the mono-repo structure and redux with thunks. Create frontend components such as modals, loaders, forms, etc. Engineer the connection between the client and server. Containerized using Docker to ensure the environment is the same for the mono-repo and deployed with Render.

Vaishnavi: mainly responsible for the integration of Google Places API to fetch coordinates and ratings based on the names of the places generated by OpenAI’s returned trip plan response. Helped create UI for sign in page and added routing. Helped add the spinning feature on Mapbox globe and add FE and BE logic for tea cup ratings for each place on the plan. Also improved UI for map marker popups.

Rithin: I worked on the complete end to end implementation of the edit stage feature and also worked with Andy to deliver the share itinerary feature. I was also responsible for driving team discussions and was involved in code reviews. As I had the most experience with GPT, I was also responsible for developing the interfacing logic for GPT API.

Limitations

Prototypes

Top-level plan: Homepage

User input

User Input

App Response: Plan Overview

With sidebar closed

Plan Overview - Closed Sidebar

With sidebar open: Specific details about a day in the plan

Plan Overview - Open Sidebar

Instructions

This is a MERN stack project using JavaScript, with auto-linting and formatting set up using ESLint and Prettier. We use Yarn Workspaces to simplify installation and running scripts.

Prerequisites

  1. Install Node.js. This will include Yarn as well.
  2. Install MongoDB.

Installation

  1. Clone the repository:
git clone https://github.com/cpsc455-bugstorm/TravelersTea.git
  1. Install the dependencies:
yarn install

Now, you will need .env files, one in server and one in client.

  1. Create a new file .env in the server folder:
touch server/.env
  1. Find the correct <value> for the following in discord's secret channel.

The content of server/.env file should look like this (with the <value> replaced with the correct constant) : server/.env.example provides a template for this file.

ENV=<value>
MONGO_USERNAME=<value>
MONGO_PASSWORD=<value>
JWT_SECRET=<value>
OPEN_AI_ORG_ID=<value>
OPEN_AI_API_KEY=<value>
GPT_MODEL=<value>
DB_USER_FLAG=<value>
GOOGLE_PLACES_API_KEY=<value>
CLIENT_URL=<value>
  1. Create a new file .env in the client folder:
touch client/.env
  1. Find the correct <value> for the following in discord's secret channel.

The content of client/.env file should look like this (with the <value> replaced with the correct constant) : client/.env.example provides a template for this file.

REACT_APP_MAPBOX_TOKEN=<value>
REACT_APP_API_URL=<value>

Running the Project

  1. Start both the server and client using concurrently
yarn start

Alternatively, you can start either server or client using the commands below:

# starting only server
yarn start:server

# starting only client
yarn start:client

follow the client link here: http://localhost:3000

follow the server link here: http://localhost:5001/api/user

Auto-Linting and Formatting

# run linter
yarn lint:fix

# check for linting errors
yarn lint

# run formatter
yarn format

# check for formatting errors
yarn format:check

We use Husky to run pre-commit hooks with lint-staged to run linters on git staged files. This ensures that our code is formatted correctly when we commit our codes and when we open a pull-request on main branch.

Troubleshooting tips:

Client

Folder Structure

Under client/src

Under client/public

This is where assets (e.g. images) go, as well as the index.html.

tailwind.config.js

Configure tailwind and add custom tailwind keywords.

Server

How to see our databases and how to use your own database?

To see some particular database, whether it is the shared one, of your own, follow the steps below.

  1. Log in to Mongo Atlas (press Sign In on the top right)

  2. Press Database -> Browse Collection image

  3. Here is our database! Our collections (think of SQL Tables), along with other helpful buttons, can be found here: image

To use your own database. Navigate to config.js in the server folder.

  1. Simply change the DB_USER_FLAG to your name in all capital letters. image