A Next.js application that tracks local business rankings for specific keywords and locations using the Google Places API.
- Search for businesses by keyword and location
- Display ranked results with business details
- Show ratings, reviews, price levels, and business types
- Responsive design with Tailwind CSS
- Real-time search with loading states
-
Install dependencies:
npm install
-
Get Google Places API Key:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Places API
- Create credentials (API Key)
- Restrict the API key to Google Places API for security
-
Configure environment variables:
- Update
.env.localwith your Google Places API key:
GOOGLE_PLACES_API_KEY=your_actual_api_key_here - Update
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
- Enter a keyword (e.g., "pizza", "dentist", "coffee shop")
- Enter a location (e.g., "New York, NY" or "10001")
- Click "Search Business Rankings"
- View the ranked results with business details
src/
├── app/
│ ├── api/
│ │ └── search/
│ │ └── route.ts # Google Places API integration
│ ├── components/
│ │ ├── SearchForm.tsx # Search input form
│ │ └── BusinessResults.tsx # Results display component
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main page component
POST /api/search- Search for businesses using Google Places API- Body:
{ keyword: string, location: string } - Returns:
{ businesses: Business[] }
- Body:
- Next.js 15 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Google Places API - Business data
- Rankings are based on Google Places API results and may differ from actual search engine rankings
- Results are ordered by relevance and proximity to the searched location
- API usage is subject to Google Places API quotas and pricing
- Always keep your API key secure and restrict its usage appropriately