Skip to content

A robust ☁️ weather application to provide current and 24 hour 7 day weather forecast for any city in the world built with ❤️ using React. Weather forecast data is powered by Dark Sky and city search data is ⚡powered by Teleport.

License

Notifications You must be signed in to change notification settings

kritik123/Weather-Forecasting

Repository files navigation

logo - Copy

Weather Forecasting

🚀 Getting Started

Note: Dark Sky had been bought by Apple and is no longer accepting new signups. For more information, read this news here.

  • Install Nodejs here on the local machine. (Required)

*Follow the instructions given below to set up the project locally on your machine.*

Basic Setup

  • Clone the local-setup branch in the repository
git clone -b local-setup https://github.com/kritik123/weather-forecasting.git
  • Install the packages using the command npm install

Environment File

  • Create a .env file in the root directory of the project. Add the following properties in it:
REACT_APP_DARKSKY_API_KEY=<your Dark Sky API Key>
  • Obtain the API key mentioned in the .env by following below steps:
  • Get API tokens:

  • You can obtain a Dark Sky API key **here (Required)

These instructions are very important to avoid the Blank Page issue when running the application on http:https://localhost:3000.

Available Scripts

In the project directory, you can run:

npm run start

Runs the app in the development mode.Open [http:https://localhost:3000](http:https://localhost:3000/) to view it in the browser. The page will reload if you make edits. You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode. See the section about

running tests for more information.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes. Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However, we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

For more info, check here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

For more info, check here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

For more info, check here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

For more info, check here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

For more info, check here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

For more info, check here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

💡 Motivation

I started learning React in May 2019 and thought of putting knowledge into reality by developing an application. I am interested in building an application that is API resource-intensive to challenge me writing efficient code keeping performance, UX, maintainability, scalability, and optimization in mind.

There are so many weather-related applications out in the wild. So, the goal is to create a UI that is beautiful yet simple and effective for any user to use.

📖 Architecture

Weather React Application Architecture

💻 Technologies

  • This application is created with Create React App

  • React (v16.12)

  • Styling syntax was written in SCSS and using TailwindCSS

  • There are bunch of scripts that run when you start application to compile scss to css

😢 Challenges

  • First, I used the OpenWeatherMap API to fetch the weather forecast data. However, 5-day forecast data was not reliable i.e. when a user on 14th March 2020 at 7:00 PM EST tries to fetch 5-day forecast data, will get forecast data starting 15th March 2020 at 12:00 AM UTC. This posed a big problem of categorizing 5-day data into individual days since the data is not always consistent and is based on UTC and not based on the user timezone. Finally, I switched to Dark Sky API which is more reliable and provides a robust data model. However, there is a limit of 1000 calls/day.

  • Dark Sky API needs a proxy server to send and receive a response which was easy in the development stage using a browser extension like this to enable CORS in the browser. However, I can't ask every user to install this extension in their browser to check the weather forecast. So, I overcome this issue temporarily for now using the cors-anywhere library which you can get more info by checking here.

📃 License

Have a look at the license file for details

📧 Contact

Whether you’d like to discuss a project, ask me about my website or simply say “hello”, I’d love to hear from you.

Email: [email protected]

Screenshot

screenshot_2

screenshot_1

About

A robust ☁️ weather application to provide current and 24 hour 7 day weather forecast for any city in the world built with ❤️ using React. Weather forecast data is powered by Dark Sky and city search data is ⚡powered by Teleport.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published