Find Trash in Indian Cities is an interactive game where players explore random street view locations from top Indian cities and identify whether they see trash. It aims to raise awareness about urban cleanliness and the importance of keeping cities clean.
Cities included in this game:
- Delhi
- Mumbai
- Bangalore
- Kolkata
- Chennai
- Hyderabad
- Pune
- Ahmedabad
- Jaipur
- Lucknow
- Features
- Tech Stack
- Setup Instructions
- Environment Variables
- Deployment
- Proxy Server Details
- How It Works
- Future Enhancements
- License
- ๐ Explore random street views from India's top 10 cities.
- ๐ฏ Identify trash with simple "Yes" and "No" buttons.
- ๐ Tracks your score as you progress through 10 rounds.
- ๐น๏ธ Retro game-inspired design with responsive UI.
- ๐ฅ End screen with an embedded YouTube video to promote awareness.
- ๐ฅ๏ธ Proxy server for securely accessing Google Maps API.
- Frontend:
- HTML, CSS (Retro Design)
- JavaScript
- Google Maps JavaScript API
- Backend:
- Node.js
- Express.js
- Google Street View API
- Deployment:
- Docker
- Google Cloud Run
- GitHub for version control
- Install Node.js and npm.
- Install Docker.
- A Google Cloud Project with Maps API enabled.
- Install gcloud CLI
git clone https://github.com/aditzz073/Trash-view-on-maps.git
cd Trash-view-on-mapsnpm installOption 1: Start both servers with one command
npm run devOption 2: Start servers separately
# Terminal 1 - Start proxy server
npm run start:proxy
# Terminal 2 - Start main server
npm run start:serverVisit http://localhost:3001 in your browser to access the game.
This project uses .env files to securely store API keys. NEVER commit your actual API keys to git!
-
Copy the example files:
cp .env.example .env cp server/.env.example server/.env cp proxy/.env.example proxy/.env
-
Get your Google Maps API Key:
- Go to Google Cloud Console
- Create a new API key or use an existing one
- Enable these APIs:
- Maps JavaScript API
- Street View Static API
- IMPORTANT: Set API key restrictions:
- Application restrictions: HTTP referrers
- Add your domain(s):
yourdomain.com/*,localhost:*(for development)
-
Update your
.envfiles with your actual keys:# Replace with your actual Google Maps API key GOOGLE_MAPS_API_KEY=your-actual-google-maps-api-key-here SIGNING_SECRET=your-optional-signing-secret-here PROXY_URL=http://localhost:3000
- โ
DO: Store API keys in
.envfiles (already gitignored) - โ DO: Set API key restrictions in Google Cloud Console
- โ DO: Use different API keys for development and production
- โ DON'T: Commit
.envfiles with real keys to git - โ DON'T: Share API keys in public forums or code
- โ DON'T: Use unrestricted API keys
Note: The
.envfiles are already included in.gitignoreto prevent accidental commits.
- Build the Docker image:
docker build -t proxy-server . docker build -t trash-detection-game .
- Run the container:
docker run -p 3001:3001 proxy-server docker run -p 3001:3001 trash-detection-game
- Tag your Docker image:
docker tag trash-detection-game asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/trash-detection-game docker tag trash-detection-game asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/proxy-server
- Push the image to Google Cloud Container Registry:
docker push asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/trash-detection-game docker push asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/proxy-server
- Deploy to Cloud Run:
gcloud run deploy trash-detection-game \ --image=asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/trash-detection-game \ --region=asia-south1 \ --platform=managed \ --allow-unauthenticated
gcloud run deploy proxy-server \ --image=asia-south1-docker.pkg.dev/<your-project-id>/<your-repo-name>/proxy-server \ --region=asia-south1 \ --platform=managed \ --allow-unauthenticated --set-env-vars GOOGLE_MAPS_API_KEY=<your-api-key> --set-env-vars SIGNING_SECRET=<your-signing-secret>
The proxy server serves the Google Maps API script and handles signed requests for Google Street View metadata.
- Description: Fetches the Google Maps JavaScript API script via a proxy and serves it to the client. The script initializes the map by calling the
initializeMapcallback. - Method:
GET - Query Parameters:
callback(optional): The name of the callback function. Defaults toinitializeMap.
- Response: The Google Maps JavaScript API script pre-configured with the specified callback.
- Description: Fetches Street View metadata for a specific location.
- Parameters:
location: Latitude and longitude of the desired location.
- Example Usage:
curl "http://localhost:3000/proxy/streetview?location=28.6139,77.2090"
- Description: Serves the Google Maps JavaScript API script via the proxy.
- Parameters:
callback(optional): The name of the callback function. Defaults toinitializeMap.
- Example Usage:
curl "http://localhost:3000/proxy/maps?callback=initializeMap"
- The game fetches 10 random valid Street View locations using Google Maps and Street View APIs.
- Players view the locations and decide if trash is visible by clicking Yes or No.
- A score is tracked across 10 rounds.
- At the end, the game displays the playerโs score along with our YouTube video, raising awareness for a demand on Cleaner Cities.
- ๐ฑ Make the Mobile UI better.
- ๐ Enhance animations and add sound effects for an immersive experience.
This project is licensed under the MIT License. See the LICENSE file for details.