Skip to content

bdchang403/Roadtrip

Repository files navigation

Roadtrip Planner

Created by Bruce Chang
Version: MVP #1.5

Release Notes

This version is the initial release of Roadtrip Planner, enabling users to:

  1. Search attractions between two destinations with category filtering
  2. Use local storage to remember map and places

Deployment & Usage Guide

Prerequisites

  • Docker installed on your machine.
  • A Google Cloud Project with billing enabled.
  • A valid Google Maps API Key.

Google Cloud Setup

To run this application successfully, you must enable the following Google Cloud APIs for your project:

  1. Maps JavaScript API: Renders the map interface.
  2. Directions API: Calculates routes between waypoints.
  3. Places API: Enables location search and autocomplete.
  4. Geocoding API: Converts storage addresses to coordinates (if applicable).

Configuration Steps:

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Navigate to APIs & Services > Library.
  4. Search for and ENABLE each of the APIs listed above.
  5. Go to APIs & Services > Credentials and create an API Key.
  6. (Recommended) Restrict your API key to the specific APIs above to prevent unauthorized quota usage.

Installation

1. Clone the Repository

git clone https://github.com/bdchang403/Roadtrip.git
cd Roadtrip

2. Configure Environment

Create a .env file in the root directory:

touch .env

Add your Google API Key to the file:

REACT_APP_GOOGLE_API_KEY=your_actual_api_key_here

Deployment with Docker

Build the Image

To build the Docker image, pass your API key as a build argument:

docker build --build-arg REACT_APP_GOOGLE_API_KEY=your_actual_api_key_here -t roadtrip-app .

Note: If you have a .env file, you can also source it or use a script to inject the variable.

Run the Container

Run the container mapping port 3000 to the container's port 80:

docker run -d -p 3000:80 roadtrip-app

Access the application at http://localhost:3000.

CI/CD & Infrastructure

This repository uses Google Cloud Platform (GCP) self-hosted runners for GitHub Actions to ensure a secure and consistent CI environment.

Setting up Runners

We use gcloud scripts to deploy managed instance groups for our runners.

  1. Prerequisites:

    • Google Cloud Project with billing enabled.
    • GitHub Personal Access Token (PAT) with repo scope.
    • gcloud CLI installed and authenticated (gcloud auth login).
  2. Deploy Runners: Run the deployment script to create the infrastructure:

    ./scripts/gcp-runner-deploy.sh
    • The script creates an Instance Template and a Managed Instance Group.
    • It installs Docker, Git, Maven, and Google Chrome (for UI testing).
    • Runners automatically register with the repository and shut down if idle for too long.

Security Updates

We use npm overrides in package.json to enforce secure versions of dependencies (e.g., nth-check, postcss), resolving vulnerabilities in transitive dependencies like react-scripts.

Usage Scenarios

1. Home Page Dashboard

Upon loading the application, you will be presented with the main dashboard. The map is centered, and the search inputs are ready.

Home Page

2. Planning a Route

To plan a trip:

  1. Enter a Starting Point (e.g., "San Francisco, CA").
  2. Enter a Destination (e.g., "Los Angeles, CA").
  3. Enter an Attraction Type (e.g., "museum", "park", "BBQ") to find stops along the way.
  4. Autocomplete suggestions from the Places API will assist you.
  5. Click the Submit button.

The application will calculate the optimal driving route and display it on the map.

Route View

Testing & Verification

This project uses Karate for automated testing. You can run specific test suites using feature flags (tags).

View Latest Test Reports

Running Tests

To run tests, navigate to the karate-tests directory and use Maven:

cd karate-tests
mvn test

Selective Testing (Feature Flags)

Use the -Dkarate.options="--tags @tagName" option to run specific test groups:

Tag Description Scenarios
@smoke Critical path verification Dashboard load check (Fast)
@ui User Interface flows Attraction Search, Dashboard, Persistence
@api API Key validation Direct calls to Google Maps JS/Directions (No UI)
@integration Service integration Backend Directions & Places API calls
@persistence Local Storage logic Verify data retention and 'Clear All'
@regression Full suite All tests

Example:

# Run only smoke tests
mvn test -Dkarate.options="--tags @smoke"

# Run non-API tests (skip tests requiring injected keys)
mvn test -Dkarate.options="--tags ~@api"

About

Making life a little easier finding food along a roadtrip

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors