π Live Demo β’ Try it now at weather-lite-three.vercel.app
A modern, lightweight weather application built with Next.js 15, TypeScript, and Tailwind CSS. Weather Lite provides real-time weather updates with a beautiful, responsive interface and seamless user experience.
- Real-time Weather Data: Current conditions and 5-day forecast
- Smart Location Detection:
- Browser geolocation API (GPS) with reverse geocoding
- IP-based location fallback
- Default location configuration
- Automatic city and country name resolution
- City Search: Global city search with autocomplete
- Auto-refresh: Configurable automatic data updates
- Offline Support: Graceful degradation with cached data
- Network Status Detection: Real-time online/offline awareness
- Dark/Light Mode: System-aware theme with manual toggle
- Responsive Design: Optimized for all screen sizes
- Loading States: Skeleton screens for smooth transitions
- Error Handling: User-friendly error messages
- Performance: In-memory LRU cache for API responses
- Location Display: Shows city and country names in the weather card
- Visual Feedback: Disabled states and loading indicators for all actions
This project was built using cutting-edge AI-assisted development tools and methodologies:
- Intelligent Project Management: The entire development process was orchestrated using TaskMaster AI, which parsed a comprehensive Product Requirements Document (PRD) and automatically generated a structured task hierarchy
- Task Breakdown: 12 main tasks with 50+ subtasks were systematically generated and executed using AI-driven task analysis and complexity assessment
- Progress Tracking: Real-time task completion tracking with dependency management and automated status updates
- Cursor Integration: Built entirely within Cursor, leveraging Claude Sonnet 3.5 for intelligent code completion, debugging, and feature implementation
- Iterative Refinement: Each component was developed through AI-assisted iteration, ensuring code quality and best practices
- Problem Solving: Complex challenges like reverse geocoding, unified location systems, and responsive design were solved through AI-guided analysis and implementation
- Architecture Design: AI assistance in designing the component architecture, state management, and API integration patterns
- Error Handling: Comprehensive error handling and edge cases identified and implemented through AI analysis
- Performance Optimization: Bundle optimization, caching strategies, and performance improvements guided by AI recommendations
This approach demonstrates the power of combining human creativity with AI capabilities to rapidly build production-quality applications.
- Node.js 18.17 or later
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/yourusername/weather-lite.git
cd weather-lite- Install dependencies:
npm install- Create environment variables:
cp .env.example .env.local- Start the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run build
npm startThis project is ready for deployment on Vercel with minimal configuration:
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard (copy from
.env.local) - Deploy with automatic builds on each commit
The included vercel.json provides optimal configuration for the deployment.
- Next.js 15 - React framework with App Router
- TypeScript - Type safety
- Tailwind CSS - Utility-first CSS
- shadcn/ui - Modern UI components
- Radix UI - Headless UI primitives
- Zod - Runtime validation
- next-themes - Theme management
- LRU Cache - Performance optimization
- Open-Meteo - Weather data only
- OpenStreetMap Nominatim - All geocoding (forward search & reverse lookup)
- IP-API - IP-based coordinate detection
- Cursor - AI-powered code editor with integrated AI assistance
- TaskMaster AI - Intelligent project management and task orchestration
- Claude Sonnet 3.5 - Advanced AI model for code generation and problem-solving
- Git - Version control system
- npm - Package manager and build tooling
- ESLint - Code linting and quality enforcement
- Prettier - Code formatting
- Vercel - Deployment platform (ready for deployment)
- Turbopack - Ultra-fast bundler for development
- Webpack 5 - Production bundling
- PostCSS - CSS processing and optimization
- TypeScript Compiler - Type checking and compilation
weather-lite/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β β βββ weather/ # Weather data proxy endpoint
β βββ error.tsx # Error boundary
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # React components
β βββ ui/ # shadcn/ui components
β βββ weather/ # Weather-specific components
β βββ current-weather.tsx
β βββ forecast-card.tsx
β βββ location-selector.tsx
β βββ offline-indicator.tsx
β βββ refresh-button.tsx
β βββ weather-display.tsx
βββ lib/ # Utility functions
β βββ cache.ts # LRU cache implementation
β βββ constants.ts # App constants
β βββ env.ts # Environment validation
β βββ location.ts # Location detection & reverse geocoding
β βββ utils.ts # Helper functions
β βββ weather.ts # Weather API integration
β βββ hooks/ # Custom React hooks
β βββ use-network-status.ts # Network connectivity hook
βββ public/ # Static assets
Create a .env.local file with the following variables:
# Default Location
NEXT_PUBLIC_DEFAULT_CITY="San Francisco, California"
NEXT_PUBLIC_DEFAULT_LAT=37.7749
NEXT_PUBLIC_DEFAULT_LON=-122.4194
# Temperature Unit (celsius or fahrenheit)
NEXT_PUBLIC_TEMP_UNIT=celsius
# API Timeouts (milliseconds)
NEXT_PUBLIC_API_TIMEOUT=10000
NEXT_PUBLIC_GEO_TIMEOUT=5000
# Cache Settings
NEXT_PUBLIC_CACHE_TTL=600000 # 10 minutes
# Refresh Settings
NEXT_PUBLIC_REFRESH_INTERVAL=600000 # 10 minutes
# Feature Flags
NEXT_PUBLIC_ENABLE_AUTO_REFRESH=true
NEXT_PUBLIC_ENABLE_DARK_MODE=true
NEXT_PUBLIC_ENABLE_CACHE=trueThe app uses CSS custom properties for theming. Edit app/globals.css to customize colors:
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
/* ... other variables */
}Weather conditions are mapped to emoji icons in lib/constants.ts. Customize the WEATHER_ICONS object to use different icons.
The app provides a proxy endpoint for weather data:
GET /api/weather?lat={latitude}&lon={longitude}&city={city}&country={country}
lat(required): Latitudelon(required): Longitudecity(optional): City name for displaycountry(optional): Country name for displayforceRefresh(optional): Bypass cache
{
"success": true,
"data": {
"location": {
"name": "New York",
"country": "USA",
"latitude": 40.7128,
"longitude": -74.0060
},
"current": {
"temperature": 22,
"apparentTemperature": 20,
"weatherCode": 0,
"humidity": 65,
"windSpeed": 15,
"windDirection": 180,
"pressure": 1013,
"uvIndex": 5,
"visibility": 10000
},
"forecast": [
{
"date": "2024-01-15",
"dayOfWeek": "Monday",
"temperatureMax": 25,
"temperatureMin": 18,
"weatherCode": 1,
"condition": "Mainly Clear",
"icon": "βοΈ",
"precipitationProbability": 10
}
],
"timestamp": 1704931200000,
"source": "api"
},
"cached": false
}# Development
npm run dev # Start development server
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript compiler- Default Location Updated: Changed default fallback location from Tbilisi, Georgia to San Francisco, California for improved user experience
- Completely Unified Location System: ALL location operations (GPS, IP, manual search, default) now use exclusively OpenStreetMap Nominatim for both forward geocoding (search) and reverse geocoding (coordinate β city/country names)
- Enhanced Location Display: All coordinates are automatically reverse geocoded to show standardized city and country names from the same authoritative source
- Consistent Location Names: No more discrepancies between different location detection methods - all use identical naming conventions
- Conditional UI Rendering: Location section only displays when location data is available
- Network-Aware Features: Refresh button is disabled when offline
- Improved Error Handling: Better fallback mechanisms for location detection with graceful degradation
- Cache Management: Added comprehensive cache clearing functionality with UI controls
The project uses:
- ESLint for code linting
- Prettier for code formatting
- TypeScript strict mode
- Components: Add to
components/weather/for weather-specific components - API Integration: Extend
lib/weather.tsfor new weather data - Styling: Use Tailwind CSS utilities and shadcn/ui components
- State Management: Use React hooks and context where needed
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
- Open-Meteo for providing free weather data
- OpenStreetMap Nominatim for geocoding services
- IP-API for IP-based location detection
- shadcn/ui for beautiful UI components
- Tailwind CSS for utility-first styling
- Weather icons inspired by various emoji sets
- Cursor for revolutionizing the development experience with AI
- TaskMaster AI for intelligent project orchestration
- Anthropic Claude for advanced AI assistance
- Vercel for Next.js framework and hosting platform
For support, please open an issue in the GitHub repository or contact the maintainers.
- Add hourly forecast view
- Implement weather alerts and notifications
- Add weather map integration
- Support for multiple saved locations
- Progressive Web App (PWA) features
- Weather widgets for different platforms
Weather Lite - Simple, fast, and beautiful weather updates.