8000 GitHub - dcooney/local-weather: ⛈ A weather app using Next.js, Mantine, Edge API Routes, and the OpenWeatherMap and Google Maps API's.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

⛈ A weather app using Next.js, Mantine, Edge API Routes, and the OpenWeatherMap and Google Maps API's.

License

Notifications You must be signed in to change notification settings

dcooney/local-weather

 
 

Repository files navigation

Weather

A weather app using Next.js, Mantine, Edge API Routes, and the OpenWeatherMap and Google Maps API's.

⛈ View your local weather forecast: https://localwx.vercel.app/


Table of Contents


Development Setup

Generate API Keys

OpenWeatherMap API

First, you'll need an OpenWeatherMap API Key. If you don't have an account, you can create one for free.

Google Maps API

Next, you'll need to generate a Google Maps API Key.

After you've generated a key, visit the Credentials page and follow the instructions below:

  1. Set application restrictions to "None"
  2. Select "Restrict key"
  3. Choose "Geocoding" and "Places" from the dropdown
  4. Save

screenshot of google api settings


Install

Setup Next.js

Use create-next-app to get up and running quickly:

npx create-next-app local-weather --example https://github.com/gregrickaby/local-weather

Set ENV Variables

Rename .env.sample to .env in the root of the project. Add the API keys you generated earlier to the following ENV Vars:

// .env
GOOGLE_MAPS_API_KEY="YOUR-KEY"
OPENWEATHER_API_KEY="YOUR-KEY"

Working with Next.js

Folder Structure

├── components
|  ├── Alerts.tsx
|  ├── Footer.tsx
|  ├── Forecast.tsx
|  ├── etc...
├── lib
|  ├── helpers.ts
|  ├── hooks.ts
|  ├── types.d.ts
|  ├── etc...
├── pages
|  ├── api
|  |  ├── places.ts
|  |  └── weather.ts
|  ├── _app.tsx
|  ├── _document.tsx
|  └── index.tsx
├── public
|  ├── icons/
|  ├── favicon.ico
├── .env.sample
├── .gitignore
├── package.json
├── next.config.js
├── etc...

Components - This folder contains React components.

Lib - This folder contains internal hooks and function files.

Pages - This folder contains standard Next.js pages and /api middleware routes.

Public - This folder contains all of the static assets.


NPM Scripts

Start local dev server:

npm run dev

Lint code:

npm run lint

Test a build prior to deployment:

npm run build && npm start

Credits


Contributing

Please see CONTRIBUTING for more information.


About

⛈ A weather app using Next.js, Mantine, Edge API Routes, and the OpenWeatherMap and Google Maps API's.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.4%
  • JavaScript 1.6%
0