Quick StartNodeJS ServerGoogle Maps Integration

Google Maps integration

  1. Go to Google Cloud Platform on https://console.cloud.google.com/
  2. Click on console.

Google Cloud Platform
  1. Select your Firebase Project

Google Cloud Platform
  1. Search for Google Maps API

Google Cloud Platform
  1. Enable Google Maps API and get the API key

Google Cloud Platform
  1. Add the key to the .env file in the root of the project
GOOGLE_MAPS_API_KEY=YOUR_API_KEY

Secure your API key

If you are just playing around in development mode, you can skip this, but if you are deploying the server to production, you should restrict the API key.

Normally, the API key that is provided inside the Google Clous Platform is not restricted by any means. You can restrict the API key to only be used by your IP or the IP of the machine in which your server is running to.

Furtheremore, only a small list of services are used in the app, so you can restrict the API key to only allow those services:

  • Geocoding API
  • Geolocation API
  • Maps JavaScript API
  • Maps Static API
  • Places API

Google Cloud Platform