This quickstart guide will take you from installation to viewing your first interactive coffee shop map in under 5 minutes.
Prerequisites
Before you begin, ensure you have one of the following package managers installed:Clone and install dependencies
First, navigate to your project directory and install all required dependencies.
Start the development server
Launch the development server on port 3000.Open http://localhost:3000 in your browser to see the application running.
The development server includes hot module replacement (HMR), so changes to your code will automatically refresh in the browser.
Grant location permissions
When you first load the application, your browser will request permission to access your location.Click Allow when prompted. The app will:
- Request your current coordinates using
navigator.geolocation - Center the map on your location
- Automatically fetch nearby coffee shops within an 8km radius
Explore the coffee shop map
Once your location is detected, Coffee Finder displays:
- Interactive map - Powered by Leaflet with OpenStreetMap tiles
- Coffee shop markers - Each marker represents a nearby café
- Shop details panel - Shows ratings, distance, hours, and contact info
- View modes
- Shop information
The app offers three discovery modes:
- All - Shows all nearby coffee shops sorted by distance
- Popular - Highlights top-rated shops with most reviews
- Trending - Smart algorithm combining ratings, hours, and engagement
Search and filter coffee shops
Use the search bar at the top to find specific coffee shops by name.The search:
src/app/page.tsx
- Filters results in real-time using the Overpass API
- Supports case-insensitive matching
- Maintains your current location context
- Press Enter or click the search button to execute
Interact with the map
Click on any coffee shop in the sidebar or on a map marker to:Click phone icons to call directly or globe icons to visit shop websites.
- Pan the map to that location with smooth animation
- Zoom in for a closer view (zoom level 17)
- Highlight the shop in the sidebar
- View detailed information including contact options
src/app/page.tsx
Understanding the API
Coffee Finder uses the Overpass API to fetch real coffee shop data from OpenStreetMap.How the coffee shop API works
How the coffee shop API works
The
Example request:Response format:The API automatically:
/api/coffee-shops endpoint accepts the following parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Your latitude coordinate |
lng | number | Yes | Your longitude coordinate |
query | string | No | Search term to filter shop names |
radius | number | No | Search radius in meters (default: 8000m) |
src/app/api/coffee-shops/route.ts
- Queries OpenStreetMap via Overpass API
- Calculates distances using the Haversine formula
- Sorts results by proximity
- Limits results to 60 shops
- Falls back to mock data if Overpass is unavailable
Common features
Real-time geolocation
Uses the browser’s native Geolocation API with high accuracy mode enabled
Live data from OpenStreetMap
Fetches real coffee shop data including hours, ratings, and contact info
Smart discovery modes
Filter by all shops, popular spots, or trending cafés with custom scoring
Interactive Leaflet maps
Pan, zoom, and click markers to explore coffee shops visually
Troubleshooting
Location permission denied
Location permission denied
If you accidentally denied location access:
- Click the location icon in your browser’s address bar
- Change the permission to Allow
- Refresh the page or click the Refresh button in the app header
No coffee shops appearing
No coffee shops appearing
If the map loads but shows no coffee shops:
- Check your location - The app searches within 8km radius
- Verify internet connection - Overpass API requires connectivity
- Wait a moment - Initial queries can take 5-10 seconds
- Try a different search - Use broader terms or clear the search field
Map not displaying
Map not displaying
If you see a blank map area:
- Check console for errors - Open browser DevTools (F12)
- Verify Leaflet loaded - Look for JavaScript errors
- Try a hard refresh - Press Ctrl+Shift+R (Cmd+Shift+R on Mac)
- Clear browser cache - Old cached assets may cause issues
Development server won't start
Development server won't start
If
bun run dev fails:Next steps
Now that you have Coffee Finder running, explore these resources:Customize the UI
Learn how to modify colors, themes, and component styles
Deploy to production
Deploy your Coffee Finder instance to Vercel, Netlify, or Docker
API reference
Explore the full API documentation and integration options
Configuration guide
Configure search radius, map settings, and data sources