Skip to content

Guram12/starmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 StarMap

A modern, full-stack Next.js application that revolutionizes place discovery through intelligent filtering and interactive mapping. StarMap helps users find restaurants, hotels, tourist attractions, shopping centers, and healthcare facilities based on personalized preferences including star ratings, location proximity, and place types.

✨ Key Highlights

  • πŸ—ΊοΈ Interactive Maps: Advanced Google Maps integration with custom markers and rich info windows
  • πŸ” Smart Search: Advanced place discovery with real-time filtering and caching
  • πŸ‘€ User Accounts: Secure authentication with JWT tokens and persistent search history
  • πŸ“± Mobile-First: Responsive design with touch interactions and burger menu navigation
  • 🌍 Global Coverage: Search any city or region worldwide with geocoding support
  • πŸš€ Performance: Optimized API calls with debouncing, caching, and smart result limits

πŸš€ Features

Core Functionality

  • βœ… Advanced Search Engine: Multi-criteria place discovery with real-time results
  • βœ… Interactive Map Interface: Google Maps with custom advanced markers and info windows
  • βœ… Intelligent Filtering: Filter by place type, star ratings (1-5), and search radius (1-10km)
  • βœ… Global Location Support: Search any city/region worldwide or use GPS location
  • βœ… Rich Place Details: Photos, ratings, addresses, and direct Google Maps navigation

User Experience

  • βœ… Secure Authentication: JWT-based login/register with HTTP-only cookies
  • βœ… Persistent Preferences: Cloud storage for authenticated users, local storage for guests
  • βœ… Search History: Database-stored search history with detailed statistics and replay
  • βœ… Responsive Design: Mobile-optimized with animated burger menu and touch interactions
  • βœ… Performance Optimization: Smart caching, debouncing, and API call optimization
  • βœ… Accessibility: Keyboard navigation, screen reader support, and semantic HTML

Technical Features

  • βœ… Real-time Geocoding: Convert addresses to coordinates with intelligent caching
  • βœ… Advanced Markers: Custom Google Maps markers with info windows and photos
  • βœ… State Management: React Context API with custom hooks for complex state
  • βœ… Error Handling: Comprehensive error boundaries and user-friendly error messages
  • βœ… SEO Optimization: Structured data, meta tags, and OpenGraph integration
  • βœ… Analytics Ready: Google Analytics integration and performance monitoring

πŸ› οΈ Tech Stack

πŸ› οΈ Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript/JavaScript
  • Database: PostgreSQL with Prisma ORM
  • Authentication: JWT tokens with HTTP-only cookies
  • Maps: Google Maps API with Places API
  • Styling: CSS Modules
  • State Management: React Context API + Hooks (useState, useEffect)
  • Storage: localStorage (client-side) + PostgreSQL (server-side)
  • Icons: Lucide React Icons
  • Animations: Framer Motion & GSAP
  • Spinners: React Spinners
  • Fonts: Geist Sans & Geist Mono

πŸ“ Project Structure

πŸ“ Project Structure

src/app/
β”œβ”€β”€ layout.tsx                    # Root layout with global header and AuthProvider
β”œβ”€β”€ page.tsx                      # Home page with landing content
β”œβ”€β”€ MainPageClient.tsx            # Client component for home page animations
β”œβ”€β”€ globals.css                   # Global styles and CSS variables
β”œβ”€β”€ AuthProvider.tsx              # Authentication context provider
β”œβ”€β”€ StructuredData.tsx            # SEO structured data component
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Header.tsx               # Navigation header with auth and mobile menu
β”‚   β”œβ”€β”€ Header.module.css        # Header styles with responsive design
β”‚   └── Logo.tsx                 # Logo component
β”œβ”€β”€ preferences/
β”‚   β”œβ”€β”€ page.tsx                 # Server component with metadata
β”‚   β”œβ”€β”€ PreferencesClient.tsx    # Client component for preferences form
β”‚   └── Preferences.module.css   # Preferences styles
β”œβ”€β”€ map/
β”‚   β”œβ”€β”€ page.tsx                 # Server component with metadata
β”‚   β”œβ”€β”€ MapClient.tsx            # Interactive map with markers and sidebar
β”‚   └── Map.module.css           # Map styles
β”œβ”€β”€ history/
β”‚   β”œβ”€β”€ page.tsx                 # Server component with metadata
β”‚   β”œβ”€β”€ HistoryClient.tsx        # Search history management
β”‚   └── History.module.css       # History styles
β”œβ”€β”€ auth/
β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”œβ”€β”€ page.tsx            # Login server component
β”‚   β”‚   β”œβ”€β”€ LoginClient.tsx     # Login form with validation
β”‚   β”‚   └── Login.module.css    # Login styles
β”‚   └── register/
β”‚       β”œβ”€β”€ page.tsx            # Register server component
β”‚       β”œβ”€β”€ RegisterClient.tsx  # Registration form
β”‚       └── Register.module.css # Registration styles
└── api/
    β”œβ”€β”€ auth/
    β”‚   β”œβ”€β”€ login/route.ts      # Login API endpoint
    β”‚   β”œβ”€β”€ register/route.ts   # Registration API endpoint
    β”‚   └── me/route.ts         # User profile endpoint
    └── search-history/
        └── route.ts            # Search history CRUD operations

src/hooks/
β”œβ”€β”€ useGoogleMap.tsx             # Google Maps initialization and management
β”œβ”€β”€ usePlacesSearch.tsx          # Places API with caching and optimization
β”œβ”€β”€ useSearchHistory.tsx         # Search history database operations
└── useIsMobile.tsx              # Mobile breakpoint detection hook

src/lib/
β”œβ”€β”€ CookieBanner.tsx             # GDPR cookie consent banner
└── auth.ts                      # JWT token utilities

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm, yarn, pnpm, or bun

Installation

  1. Clone the repository:
git clone <repository-url>
cd starmap
  1. Install dependencies:
npm install
# or
yarn install
# or
pnpm install
  1. Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
  1. Open http://localhost:3000 in your browser.

πŸ“– How to Use

  1. Set Preferences: Visit /preferences to configure your search criteria

    • Choose your region/city or use current location
    • Select place types (restaurants, hotels, tourist attractions, shopping, healthcare)
    • Set minimum star rating (1-5 stars)
    • Define search radius (1-10 km)
    • Click "Save & Search" to find places
  2. View Map: Go to /map to see places matching your criteria

    • Interactive map with custom markers
    • Click markers to see place details with photos
    • Direct links to Google Maps for navigation
    • Responsive sidebar with place list
  3. Search History: Register/login to save your searches

    • View past searches at /history
    • Click any search to reload those results
    • Clear history or view statistics
  4. Authentication: Optional but recommended

    • Register at /auth/register for automatic login
    • Login at /auth/login to access saved searches
    • All preferences sync between devices

πŸ”§ Environment Variables

Create a .env.local file in the root directory:

# Google Maps API Keys
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_google_maps_api_key
NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID=your_google_maps_map_id

# Database
DATABASE_URL=postgresql://username:password@localhost:5432/starmap_db

# Authentication
JWT_SECRET=your_jwt_secret_key

# SEO & Analytics
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_GOOGLE_MEASUREMENT_ID=your_ga_measurement_id
NEXT_PUBLIC_GOOGLE_VERIFICATION=your_google_verification_code

πŸ—οΈ Architecture

Data Flow

  1. User Input β†’ Preferences form with validation
  2. Geocoding β†’ Convert locations to coordinates (cached)
  3. Places API β†’ Search places with filters (debounced)
  4. Map Rendering β†’ Display results with advanced markers
  5. Storage β†’ Save to localStorage + database (if authenticated)

Key Hooks

  • useGoogleMap: Manages Google Maps instance and initialization
  • usePlacesSearch: Handles Places API calls with caching and optimization
  • useSearchHistory: Manages database operations for search history
  • useAuth: Authentication state and user management
  • useIsMobile: Responsive design breakpoint detection

Performance Optimizations

  • API Call Reduction: Intelligent caching with 10-minute TTL
  • Request Debouncing: 1-second delay to prevent excessive API calls
  • Result Limiting: Maximum 15 results per search to control costs
  • Smart Radius: Automatic radius optimization (max 10km)
  • Coordinate Detection: Direct coordinate parsing to skip geocoding

πŸ—ΊοΈ Roadmap

Phase 1: Core Functionality βœ…

  • Basic routing and navigation
  • Preferences management
  • Local storage integration
  • Responsive design

Phase 2: Map Integration βœ…

  • Google Maps integration
  • Place search API integration
  • Real-time place filtering
  • Place details with photos

Phase 3: User System βœ…

  • User authentication
  • Cloud preferences sync
  • User profiles
  • Search history

Phase 4: Future Enhancements 🚧

  • Favorite places system
  • Advanced filters (price level, opening hours)
  • Place reviews and ratings
  • Social features and place sharing
  • Offline mode with cached data
  • Mobile app (React Native)

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


Status: 🚧 In Development | Version: 0.1.0 | Last Updated: January 2025

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published