A production-ready MVP web app for finding sports clubs within a specified drive time from a starting location.
- 🗺️ Interactive map with Mapbox GL JS
- ⏱️ Drive-time isochrone visualization
- 🏐 Multi-sport search (volleyball, track and field, basketball, softball)
- 📊 Synced table view with sorting and filtering
- 📍 Click map pins ↔ highlight table rows
- 📝 Add notes and tags per location (persisted in LocalStorage)
- 📥 Export results to CSV
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Maps: Mapbox GL JS
- Places: Google Places API (New)
- Deployment: Vercel
git clone <your-repo-url>
cd ScoutRadius
npm install- Sign up at mapbox.com
- Get your access token from the account page
- Token should start with
pk.
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Places API (New)
- Create an API key
- Important: Enable billing (required for Places API)
Create .env.local in the project root:
# Server-side (API routes)
MAPBOX_ACCESS_TOKEN=pk.your_mapbox_token_here
GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
# Client-side (browser)
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=pk.your_mapbox_token_hereNote: Use the same Mapbox token for both variables.
npm run dev- Enter starting location: Type an address or lat,lng coordinates (e.g.,
37.7749,-122.4194) - Select drive time: Choose 15, 30, or 45 minutes
- Select sports: Click to toggle volleyball, track and field, basketball, softball
- Click "Search Sports Clubs": Results appear on map and in table
- Interact:
- Click map pins to highlight table rows
- Click table rows to highlight map pins
- Add notes/tags inline in the table
- Filter and sort table columns
- Export filtered results to CSV
git add .
git commit -m "Initial commit"
git push origin main- Go to vercel.com
- Click "Add New Project"
- Import your GitHub repository
- Vercel will auto-detect Next.js settings
In Vercel project settings → Environment Variables, add:
MAPBOX_ACCESS_TOKEN=pk.your_tokenGOOGLE_MAPS_API_KEY=your_keyNEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=pk.your_token(same as above)
Click "Deploy" - Vercel will build and deploy automatically.
ScoutRadius/
├── app/
│ ├── api/
│ │ ├── isochrone/route.ts # Isochrone generation endpoint
│ │ └── search/route.ts # Places search endpoint
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx # Main app page
├── components/
│ ├── Controls.tsx # Location/drive-time/sport controls
│ ├── Map.tsx # Mapbox map component
│ └── ResultsTable.tsx # Table with sorting/filtering
├── lib/
│ ├── csv.ts # CSV export utilities
│ ├── googlePlaces.ts # Google Places API client
│ └── mapbox.ts # Mapbox API client
├── .env.example
├── next.config.js
├── package.json
└── README.md
Generate drive-time isochrone polygon.
Query params:
lng: Longitudelat: Latitudeminutes: Drive time in minutes (default: 15)
Response: GeoJSON FeatureCollection
Search for sports clubs within drive time.
Body:
{
"origin": { "lat": 37.7749, "lng": -122.4194 },
"sports": ["volleyball", "basketball"],
"driveTimeMinutes": 30
}Response:
{
"places": [
{
"place_id": "...",
"name": "...",
"address": "...",
"location": { "lat": ..., "lng": ... },
"driveTime": 25,
"distance": 12.5,
...
}
]
}- Check browser console for errors
- Verify
NEXT_PUBLIC_MAPBOX_ACCESS_TOKENis set in.env.local - Restart dev server after adding env vars
- Verify Google Places API is enabled in Google Cloud Console
- Check billing is enabled (required)
- Verify API key has correct permissions
- Check server logs for API errors
- Ensure all environment variables are set in Vercel dashboard
- Check build logs for specific errors
- Verify
package.jsonhas all dependencies
- Mapbox Directions API is included with Mapbox account
- Check token has correct permissions
- Verify coordinates are valid
- Replace LocalStorage with Supabase/Firebase for notes/tags
- Add user authentication
- Save search history
- Add more sports
- Custom drive time input
- Route visualization on map
- Batch export options
MIT