@@ -15,6 +15,31 @@ So any street-level result we show is:
15153 . ** Frontend** (when a listing is selected) calls reverse geocoding to display:
1616 - ` Approx street: <road> ` (clearly labeled approximate).
1717
18+ ## Where to put API keys / env vars
19+ ### Frontend (browser) key
20+ Put your browser key in the repo-root ` .env ` file:
21+ ``` bash
22+ VITE_GOOGLE_MAPS_API_KEY=" YOUR_BROWSER_KEY"
23+ ```
24+
25+ This key is used in the browser for:
26+ - ** Maps JavaScript API** (render the map)
27+ - ** Directions API** (routing: Drive / Bus(Transit) / Walk / Bike)
28+
29+ ### Backend (server) key
30+ Put your server key in the repo-root ` .env ` file:
31+ ``` bash
32+ GOOGLE_MAPS_API_KEY=" YOUR_SERVER_KEY"
33+ GEOCODING_PROVIDER=" google"
34+ ```
35+
36+ This key is used server-to-server for:
37+ - ** Geocoding API** (address → lat/lng)
38+ - reverse geocoding lat/lng → rough location / street name
39+
40+ ### Extension
41+ The extension does not read ` .env ` files. Set its API base URL in Chrome Extension options.
42+
1843## How we extract the map pin coordinates
1944File: ` extension/platforms/airbnb/content.js `
2045
@@ -44,15 +69,15 @@ If you see an error like:
4469` Google Geocoding failed with status REQUEST_DENIED: This API is not activated on your API project `
4570it means the ** Geocoding API is not enabled** (or billing/key restrictions are blocking it).
4671
47- Set these env vars before starting the backend:
72+ Set these env vars in the repo-root ` .env ` (recommended) or your shell before starting the backend:
4873``` bash
49- export GOOGLE_MAPS_API_KEY=" YOUR_KEY"
50- export GEOCODING_PROVIDER=" google"
74+ GOOGLE_MAPS_API_KEY=" YOUR_KEY"
75+ GEOCODING_PROVIDER=" google"
5176```
5277
5378Optional:
5479``` bash
55- export GEOCODING_COUNTRY_CODES=" us"
80+ GEOCODING_COUNTRY_CODES=" us"
5681```
5782
5883Then run:
@@ -67,6 +92,23 @@ uvicorn app.main:app --reload --port 8000
6792 - Restrict by ** API** : allow only ** Geocoding API**
6893 - Optionally restrict by ** IP address** (for local dev, this can be inconvenient)
6994
95+ ## Google Maps UI + routing (frontend)
96+ EasyRelocate’s compare page uses Google Maps Platform in the browser for:
97+ - ** Maps JavaScript API** (render the map)
98+ - ** Directions API** (routing: Drive / Bus(Transit) / Walk / Bike)
99+
100+ ### Frontend env var
101+ Add this to the repo-root ` .env ` :
102+ ``` bash
103+ VITE_GOOGLE_MAPS_API_KEY=" YOUR_KEY"
104+ ```
105+
106+ ### API requirements
107+ If routing fails with errors like ` Route failed: REQUEST_DENIED ` , ensure in Google Cloud Console:
108+ - Billing is enabled
109+ - “Maps JavaScript API” is enabled
110+ - “Directions API” is enabled
111+
70112## Local dev env vars
71113Backend env vars:
72114- ` GOOGLE_MAPS_API_KEY ` (enables Google geocoding)
0 commit comments