Note: Dark Sky had been bought by Apple and is no longer accepting new signups. For more information, read this news here.
When you have a Dark Sky Account, follow the instructions described in-detail here or below to set up the project locally on your machine.
- Clone the
local-setup
branch in the repository
git clone -b local-setup https://github.com/iamsainikhil/weather-react.git
- Install the packages using the command
npm install
- 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>
That's it! You can run the below available scripts to get up and running on the localhost. If you want to dive deeper into the codebase, I recommend you to check the architecture documentation to customize this application as your wish.
These instructions are very important to avoid the Blank Page issue when running the application on
http://localhost:3000
.
In the project directory, you can run:
npm run start
Runs the app in the development mode.Open [http://localhost:3000](http://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.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
For more info, check here: https://facebook.github.io/create-react-app/docs/code-splitting
For more info, check here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
For more info, check here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
For more info, check here: https://facebook.github.io/create-react-app/docs/advanced-configuration
For more info, check here: https://facebook.github.io/create-react-app/docs/deployment
For more info, check here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
I started learning React in February 2020 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.
-
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
tocss
-
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.
-
Build a proxy server using Express for Dark Sky API requests
-
Unit Testing
-
Publish this project as an NPM package that can be consumed elsewhere.
-
Update Favorites UI
-
Add documentation for components using Storybook
-
Develop desktop application using Electron
-
Develop Android and iOS app using React Native
-
Open pull request with improvements.
-
If you have any new idea, check the feature request template to create a request.
-
If you found any issue or a bug, check the bug report template to create a report.
Have a look at the license file for details
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: contact@iamsainikhil.com
See the Acknowledgements page on the wiki for a list of Acknowledgements for Weather React codebase.