First, install the dependencies:
npm i
Second, run the development server:
npm run dev
FYI there are two API keys needed for this repo to work locally. Ask or supply you're own.
Open http://localhost:3000 with your browser to see the result.
Site is live at https://greatest-weather-app.vercel.app/
This is just a simple (functionality focused) application.
This is a Next.js project bootstrapped with create-next-app
.
Libraries and apis used in this repository:
- Typescript
- ReactJS
- NodeJS
- NextJS
- Tailwind CSS
- Zustand
- eslint
- Prettier
- Google Places API
- Google Geocoding API
- OpenWeatherMap API
- AWS Lambda
- AWS Gateway
Client code lives in directories.
- /pages
- /components
- /public
- /stores
- /styles
- /types
API (AWS Lambdas) live in directory: /pages/api/**.
Next uses React as it's engine for manipulating the client browser. Next has conventions and configurations built in that abstracts much of the the compiling/transpiling decisions from the developer. If you want to know more, visit https://nextjs.org/.
Next, as seen in this repository, has the ability to write aws lambdas which serve as an API for the project.
The Server deployments TLDR is:
- Next build step builds and bundles API and Client in to a .next folder.
- Builds serverless functions, each api routes located under pages/api. This will include a light http wrapper for each function.
- Packages the lambda function code with the necessary nodejs runtime all in a ZIP file that AWS lambda requires.
- Deploys these functions with a simple API GATEWAY layer in front of the the Lambda functions. This will route all http calls to their appropriate lambda functions.
- When an HTTP request is made to an API route, API Gateway receives the request and triggers the corresponding Lambda function. The Lambda function executes in a stateless, containerized environment, processing the request and returning a response. The response is then relayed back to the client through API Gateway.
The Client deployments TLDR is:
- Next build step builds (transpiles) static assets and javascript.
- Vercel and other tools like so will put these static assets on their CDNs.
- Next supports SSR, SSG, and Client side rendering. All cases are a little different. SSR requests are made back to AWS API GATEWAY + Lambda. SSG hydrates dynamic html at build step to build a static html SEO friendly. CSR, CDN will render upon initial domain request, after that, dynamic client side js will handle all routing.
Using a company like Vercel, Supabase or Netlify, can simplify these processes.