This is a Weather App built with Node.js, React, and Redis caching. It allows users to retrieve weather information for a specific location and demonstrates the use of Redis for caching weather data.
- Retrieve current weather information for a given location.
- Redis caching to improve response times for frequently requested weather data.
- Responsive design for a seamless user experience on desktop and mobile devices.
- Redis
- React
- SASS (for styling)
- Node.js
- Express.js
- Docker
- Axios (for making API requests)
- TypeScript
Before you can run this application, ensure you have the following dependencies installed:
- Node.js (https://nodejs.org/)
- Redis (https://redis.io/)
-
Clone the repository to your local machine:
git clone https://github.com/ErtanOzdemir/weather-app-with-redis-cache cd weather-app-with-redis-cache
-
Install the backend dependencies and start the Node.js server:
cd backend npm install
-
Set up your environment variables by creating a
.env.development file in the root of the
backend` folder. Add your variables like this:OPEN_WEATHER_API_KEY=your_api_key_here PORT=4000 REDIS_PORT=6379 REDIS_HOST=localhost or redis (if you run with docker)
-
Run the backend.
npm run start:dev
-
In a new terminal, navigate to the frontend directory:
cd ../frontend
-
Install the frontend dependencies and start the React app:
npm install
-
Set up your environment variables by creating a
.env
file in the root of thefrontend
folder. Add your variables like this:REACT_APP_API_URL=http://localhost:4000
-
Run the frontend.
npm run start
-
Open your web browser and go to
http://localhost:3000
to access the Weather App.
- Enter the name of a city or location in the search bar.
- Click on one of the cities shown to retrieve the current weather data for that location.
- The app will check if the weather data is cached in Redis.
- If the data is in the cache, it will be displayed immediately. Otherwise, a request will be made to the weather API, and the response will be cached in Redis for future use.
This Weather App utilizes Redis caching to improve performance and reduce the load on external weather APIs. When you search for weather data for a location, the app first checks if the data is available in the Redis cache. If found, it is retrieved from Redis, eliminating the need to make an external API request. This caching mechanism helps reduce response times for frequently requested weather data.
Mobile Screenshot | Desktop Screenshot |
---|---|
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to OpenWeather for providing the weather data API.
- This project was created as a demonstration of using Redis caching in a Node.js and React application.