Trail is an intuitive, user-friendly web application that helps users discover the top 5 historical sites near their location. Users can get detailed descriptions of each location, complete with text-to-speech functionality and step-by-step navigation. We leverage the Google Places API for location data, and OpenAI's GPT for generating engaging and informative descriptions.
The application is live and can be accessed at trailapp.net.
git clone https://github.com/Shakhrai8/trail.git
- Create/login to your Google Cloud account: cloud.google.com
- Navigate to APIs and Services
- Create a new project and enable Places API, Distance Matrix API, Maps Javascript API, and Cloud Text-To-Speech API.
- Generate an API Key under credentials.
- Head to openai.com and create an account.
- Follow the instructions to generate an API key.
export GOOGLE_API_KEY=<insert key here>
export OPENAI_KEY=<insert key here>
export TextToSpeech_KEY=<insert RELATIVE PATH to key file here>
-
Navigate to the
api
directory and install:cd trail/api/ npm install
-
Navigate to the
frontend
directory and install:cd ../frontend/ npm install
This project is organized into two main directories:
api/
: This directory contains the backend server logic written in Express. Theroutes/
,controllers/
, andcommon/
folders can be found here. Thecommon/
folder contains all the required API call files.frontend/
: This directory houses the React frontend. All the components used in the project are contained in thesrc/
directory.
To run the server:
-
Go to
api/bin/
:cd api/bin/
-
Run the following command:
node www.js
To run the frontend:
-
Go to the
frontend
folder:cd ../../frontend/
-
Run the following command:
npm run dev
Now, the app should be running on your specified local port.
We use Jest for backend testing and Cypress for end-to-end testing on the frontend.
- To run backend tests, navigate to the
api
directory and runjest
. - To run frontend tests, navigate to the
frontend
directory and runnpm run cypress:run
.
- Google Places API for providing location data.
- OpenAI GPT for generating engaging descriptions.