A clean and modern single-page weather dashboard built with React and TypeScript. Search for any city worldwide and get real-time weather information including temperature, weather conditions, humidity, and wind speed.
- 🔍 City Search: Search for weather by city name with real-time validation
- 🌡️ Current Weather Data: Temperature, feels-like, humidity, and wind speed
- 🎨 Dynamic Backgrounds: Background color changes based on temperature (cold, mild, hot)
- 📱 Fully Responsive: Works beautifully on mobile, tablet, and desktop
- ⚡ Fast & Modern: Built with Vite for lightning-fast development and builds
- 🎯 Clean UI: Simple, intuitive interface with smooth animations
- React 18 with TypeScript
- Vite for fast builds and hot module replacement
- Plain CSS for styling (no frameworks)
- OpenWeatherMap API for weather data
- Google Fonts (Inter)
- Node.js (v14 or higher)
- npm or yarn
- OpenWeatherMap API key (free tier available)
-
Clone the repository
git clone <YOUR_GIT_URL> cd <YOUR_PROJECT_NAME>
-
Install dependencies
npm install
-
Configure API Key
Get your free API key from OpenWeatherMap:
- Sign up for a free account
- Navigate to the API keys section
- Copy your API key
Then update the API key in
src/config/api.ts:export const WEATHER_API_CONFIG = { BASE_URL: 'https://api.openweathermap.org/data/2.5', API_KEY: 'YOUR_API_KEY_HERE', // Replace with your actual API key UNITS: 'metric', };
Note: New API keys may take a few minutes to activate.
-
Start the development server
npm run dev
-
Open your browser
Navigate to
http://localhost:8080to see the app running.
- Enter a city name in the search bar
- Click "Search" or press Enter
- View current weather conditions
- Notice the background color changes based on temperature:
- 🥶 Cold (≤10°C): Blue gradient
- 😊 Mild (10-25°C): Neutral gradient
- 🔥 Hot (>25°C): Warm gradient
src/
├── components/
│ ├── SearchBar.tsx # Search input and button component
│ ├── SearchBar.css # SearchBar styles
│ ├── WeatherCard.tsx # Weather display component
│ └── WeatherCard.css # WeatherCard styles
├── config/
│ └── api.ts # API configuration
├── App.tsx # Main app component
├── App.css # Global app styles
└── main.tsx # App entry point
This app uses the OpenWeatherMap Current Weather Data API.
Endpoint: https://api.openweathermap.org/data/2.5/weather
Parameters:
q: City nameappid: Your API keyunits: Temperature units (metric/imperial)
npm run buildThe optimized production build will be in the dist/ directory.
Lovable Project: https://lovable.dev/projects/7b8dbf70-562b-470c-a2fa-86f3f7f1eef7
You can edit this project in several ways:
Via Lovable: Visit the Lovable Project and start prompting.
Locally: Clone the repo and edit with your preferred IDE.
GitHub Codespaces: Launch a Codespace for cloud-based development.
Simply open Lovable and click on Share -> Publish.
Yes, you can!
To connect a domain, navigate to Project > Settings > Domains and click Connect Domain.
Read more here: Setting up a custom domain