Demo Link: weaget.vercel.app
This project is a website written primarily in Typescript using Nextjs (a react framework) and Material UI (a UI library). The website allows a user to find minutely, hourly and daily weather information at any location as well as pollution details.
- A search engine with autocomplete.
- Responsive Design.
- Temperature & Measurement conversion options.
- Weather & nearby places at your current location.
- Rainfall Graph w/ heuristic to show the most meaningful graph.
- Skeleton framework while weather data is being fetched.
- Custom weather icons.
- Advanced server/client side caching.
- The website is mostly web accessible.
In order to reduce costs, this website uses free services from various providers. The following are the APIs used in this project:
- Google's Geocoding API - To find the latitude (lat) and longitude (lng) of a location.
- Google's Places Autocomplete API - To complete and suggest locations you type.
- IPinfo API - To get local location details of the user including city/country/lat/lng.
- Geonames's findNearby API - To find nearby city locations for a particular lat/lng.
- AQICN's Pollution API - To find the pollution level of a particular location.
- OpenWeatherMap's One Call API - To find the minutely/hourly/daily weather details.
- Register API keys for the API services mention above.
- Store API keys in .env.local found in the root folder of this project.
- Install pnpm from the command line.
npm install -g pnpm
- Install all pnpm dependencies.
pnpm install
- Run the website.
pnpm run dev
Open http://localhost:3000 with your browser to see the result.
Command | Description |
---|---|
pnpm test |
Runs all test cases and reveals coverage. |
pnpm lint |
Reports and fixes the linting errors. |
pnpm type-lint |
Reports any type errors generated from typescript. |
pnpm storybook |
Provides a visual library of most of the components. |
- Login systems for customisation such as local weather location.
- Pollution based on daily weather. (currently waiting for pollution API)
- Smart caching mechanism on both server and client.
- Improves the user experience with faster load times.
- Reduces the odds of hitting the rate limit of API credentials without the need to rate limit.
- All API services are called server side.
- Protects API keys from being stolen but slows down site significantly.
- Allows for the implementation of rate limiting to prevent API abuse.
-
Dark Mode Flicker: Setting the system theme to dark mode causes the UI to flicker for first time renders which impacts the UX for users with slower network speeds.
- This is a known issue in Material UI and the fix is still highly experimental and thus has not been implemented in this project yet.
- Ref:
-
Performance and SEO: Currently, we cannot take advantage of SSR, loading all JS scripts in the client which negatively impacts the performance and SEO of the website.
- Our styling css-in-js (emotion) library recommended by Material UI doesn't currently support server side rendering, but this will be changed with zero run-time Pigment CSS when it gets integrated in Material UI v6.
- Ref: