A modern, feature-rich weather application built with React 18, TypeScript, and TailwindCSS. Get comprehensive weather information including current conditions, 5-day forecasts, and interactive temperature charts for cities worldwide.
- Real-time current weather conditions
- 5-day detailed weather forecast
- Comprehensive meteorological data (humidity, pressure, wind, visibility)
- Sunrise and sunset times
- Temperature trends with "feels like" data
- Interactive temperature charts with Recharts
- Daily temperature trends
- Visual weather icons for all conditions
- Responsive charts that adapt to screen size
- Clean, modern design with TailwindCSS
- Smooth animations with Framer Motion
- Fully responsive layout (mobile-first)
- Optimized desktop layout with side-by-side charts
- Loading states and error handling
- Intuitive geolocation functionality
- Mobile-optimized interface
- Desktop layout with efficient space usage
- Tablet-friendly intermediate layouts
- Cross-browser compatibility
- Node.js (v18 or higher)
- npm or yarn
- OpenWeatherMap API key (Get one here)
-
Clone the repository
git clone <repository-url> cd clima
-
Install dependencies
npm install
-
Set up environment variables Create a
.env.localfile in the root directory:VITE_API_KEY_WEATHER=your_api_key_here
-
Start the development server
npm run dev
-
Open your browser Navigate to http://localhost:5173
npm run dev- Start development server with hot reloadnpm run build- Build optimized production bundlenpm run preview- Preview production build locallynpm run lint- Run ESLint for code quality checks
src/
βββ components/
β βββ Header.tsx # App header with navigation
β βββ Form.tsx # Search form with geolocation
β βββ Weather.tsx # Main weather display component
β βββ Forecast.tsx # 5-day forecast component
β βββ TemperatureChart.tsx # Interactive temperature charts
β βββ Error.tsx # Error handling component
βββ types/
β βββ index.ts # TypeScript type definitions
βββ App.tsx # Main app component & API logic
βββ main.tsx # App entry point
βββ index.css # Global styles with TailwindCSS
βββ vite-env.d.ts # Vite environment types
- React 18.2.0 - Latest React with hooks and concurrent features
- TypeScript 5.2.2 - Type safety and enhanced developer experience
- Vite 5.2.0 - Lightning-fast build tool and dev server
- TailwindCSS 3.4.17 - Utility-first CSS framework
- Framer Motion 12.23.7 - Production-ready animations
- Lucide React 0.525.0 - Beautiful, customizable icons
- Recharts 3.1.0 - Composable charting library
- Date-fns 4.1.0 - Modern date utility library
- OpenWeatherMap API - Comprehensive weather data source
- PostCSS & Autoprefixer - CSS processing and browser compatibility
- ESLint - Code quality and consistency
- TypeScript Strict Mode - Enhanced type checking
The app integrates with OpenWeatherMap API endpoints:
- Current Weather:
https://api.openweathermap.org/data/2.5/weather - 5-Day Forecast:
https://api.openweathermap.org/data/2.5/forecast
- Temperature (current, min, max, feels like)
- Weather conditions and descriptions
- Humidity, pressure, visibility
- Wind speed and direction
- Sunrise and sunset times
- 5-day forecast with 3-hour intervals
- Primary: Sky blue variants (
sky-400tosky-600) - Accents: Semantic colors for different weather metrics
- Backgrounds: Glass-morphism with backdrop blur
- Text: Gray scale for optimal readability
- Mobile-first responsive design
- Grid-based layouts for consistent spacing
- Card-based components for content organization
- Smooth animations for enhanced user experience
- Mobile: < 768px (single column)
- Tablet: 768px - 1024px (transitional layouts)
- Desktop: > 1024px (multi-column with sidebars)
- Large Desktop: > 1280px (optimized wide layouts)
-
Clone and setup (see Installation above)
-
Environment Configuration
# Required environment variable VITE_API_KEY_WEATHER=your_openweathermap_api_key -
Start development server
npm run dev # App will be available at http://localhost:5173
# Create optimized production build
npm run build
# Preview production build locally
npm run previewThe build artifacts will be stored in the dist/ directory.
# Run linting
npm run lint
# TypeScript type checking
npx tsc --noEmit- Optimized bundle size with Vite's tree shaking
- Lazy loading of chart components
- Efficient API calls with proper error handling
- Responsive images and icons
- Fast refresh during development
- Production-ready optimizations
The app structure supports easy internationalization:
- Date formatting with
date-fns - Consistent text structure in components
- Semantic HTML for accessibility
- ARIA labels for screen readers
vite.config.ts- Vite build configurationtailwind.config.js- TailwindCSS customizationpostcss.config.js- PostCSS plugins configurationtsconfig.json- TypeScript compiler options
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Follow the coding standards:
- Use TypeScript for type safety
- Follow the existing component structure
- Add proper error handling
- Include responsive design considerations
- Test your changes thoroughly
- Commit changes (
git commit -m 'feat: add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- TypeScript: Strict mode enabled
- Components: Functional components with hooks
- Styling: TailwindCSS utility classes
- State: React hooks for local state management
- API: Async/await with proper error handling
The app can be deployed to various platforms:
npm install -g vercel
vercelnpm run build
# Upload dist/ folder to Netlifynpm install --save-dev gh-pages
npm run build
npx gh-pages -d dist-
API Key Issues
- Ensure your OpenWeatherMap API key is valid
- Check the
.env.localfile exists and has correct variable name - Verify the API key has proper permissions
-
Build Issues
- Clear node_modules:
rm -rf node_modules && npm install - Clear Vite cache:
rm -rf node_modules/.vite
- Clear node_modules:
-
TypeScript Errors
- Update TypeScript:
npm update typescript - Check tsconfig.json configuration
- Update TypeScript:
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenWeatherMap API Documentation
- React 18 Documentation
- Vite Documentation
- TailwindCSS Documentation
- TypeScript Documentation
- Framer Motion Documentation
- Recharts Documentation
- Weather data provided by OpenWeatherMap
- Icons by Lucide
- Charts powered by Recharts
- Animations by Framer Motion
Made with β€οΈ and modern web technologies