A full-stack weather application built with Microservice architecture and technology MongoDB, Redis, RabbitMQ, and Next.js. This app fetches and displays real-time weather data based on location, with features like data refresh, weather trends visualization, and drag-and-drop functionality for favorite locations.
- Backend: Node.js, Express, MongoDB, Redis, RabbitMQ
- Frontend: Next.js, Redux, Tailwind CSS
- Others: TypeScript, Docker
- Fetch and Display Weather Data: Retrieve and display current weather information based on location.
- Caching with Redis: Store weather data temporarily for optimized performance.
- Microservices with RabbitMQ: Notify users via a message queue when weather data is refreshed.
- Weather Trends Chart: Visualize temperature trends over the next few days using Chart.js.
- Drag-and-Drop Functionality: Allow users to reorder their favorite locations.
Before running this application, ensure the following tools and dependencies are installed:
- Node.js version 16 or later.
- Docker and Docker Compose installed on your system.
- API key from a public weather service, such as OpenWeatherMap.
Create a .env
file in the backend
directory with the following content:
PORT=4000
MONGODB_URI=mongodb+srv://adityamuhamadputra:[email protected]/
MONGO_DB_NAME=test
MONGO_DB_COLLECTION=weather
MONGO_DB_USER=adityamuhamadputra
MONGO_DB_PASSWORD=RywYFwqFqnfVKylU
REDIS_URL=redis://localhost:6379
RABBITMQ_URL=amqp://localhost:5672
OPEN_WEATHER_API_KEY=0734549e2fccaec1f2e6fd38f2752c56
OPEN_WEATHER_API_BASE_URL=https://api.openweathermap.org
Create a .env
file in the frontend
directory with the following content:
NEXT_PUBLIC_API_URL=http://localhost:4000
https://github.com/adityamputra27/weather-app-microservice.git
weather-app-microservice
you can rename all file that contains .production and remove that same file name before
docker-compose up --build
This command will:
- Start Redis, and RabbitMQ containers.
- Launch the Backend service on http://localhost:4000.
- Launch the Frontend service on http://localhost:3000.
Open the app in your browser at http://localhost:3000.
- Enter a location to fetch weather data.
- View:
- Current temperature
- Weather conditions
- Future forecasts
- Use the refresh button to fetch the latest data.
- Drag and drop favorite locations to reorder them.
- Button to change temperature to Celsius and Fahrenheit.