A simple Node + Express backend with a static frontend. The backend proxies requests to OpenWeatherMap so the API key is kept on the server.
Quick start
- Copy
.env.exampleto.envand set yourOPENWEATHER_API_KEY.
cp .env.example .env
# edit .env to set OPENWEATHER_API_KEY- Install dependencies
npm install- Run locally
npm run dev # for development (nodemon)
npm start # for productionDeployment notes
- Provide the
OPENWEATHER_API_KEYenvironment variable on the host (Render, Vercel Serverless functions, Fly, etc.). - The app uses
PORTfrom the environment if provided.
Example Render setup
- Build command:
npm install - Start command:
npm start - Set an environment variable named
OPENWEATHER_API_KEYwith your key
Security
- Do not commit your real
.envfile with the API key to version control. Use.env.exampleas a template.