Weather app using HTML, Bootstrap, and JavaScript with a Node.js API proxy and Redis caching.
Search UI
Forecast Results
- Search by city or zip code.
- Forecast day selector supports up to 5 days in the current UI and backend cap.
- Default forecast request is 5 days when no explicit selection is made.
- Forecast cards show daily high and low temperatures aggregated from each day of 3-hour forecast entries.
- Temperatures render with the degree symbol only (example: 72° in UI).
- Weather condition icons shown for current and forecast entries.
- API key stays server-side (not exposed to browser).
- Redis caching reduces repeated OpenWeather API pulls.
- Cache schema uses key version
weather:v2.
index.html- frontend UI markup.assets/css/styles.css- custom styles.assets/js/app.js- frontend behavior.server/src/server.js- Express app bootstrap.server/src/routes/weather.js- API routes.server/src/services/openweatherClient.js- OpenWeather integration and daily forecast normalization.server/src/services/cache.js- Redis caching helpers.docker-compose.yml- web + api + redis services.
- Create an account at https://openweathermap.org.
- Go to API keys: https://home.openweathermap.org/api_keys.
- Create a key or copy an existing one.
- Wait a few minutes for activation if the key is newly created.
- Create local env file and add your key:
cp .env.example .envOPENWEATHER_API_KEY=your_real_api_key
CACHE_TTL_SECONDS=600
MAX_FORECAST_DAYS=5
MOCK_MODE=false- Start the stack:
docker compose up --build- Open the app:
- Endpoint:
GET /api/weather?query=<city_or_zip>&days=<1-10> - Current setup caps days to
MAX_FORECAST_DAYS(default5) and UI cap is 5. - Response includes request metadata indicating whether day count was capped.
X-Cachevalues:MOCKwhenMOCK_MODE=trueMISSon first live fetchHITfor Redis cache hitCOALESCEDwhen request de-duplication reused an in-flight request
- Ensure
.envis ignored before first commit:
git check-ignore -v .env- Initialize git and commit:
git init
git add .
git commit -m "Initial commit"- Create a new empty GitHub repository, then connect and push:
git branch -M main
git remote add origin https://github.com/<your-username>/<your-repo>.git
git push -u origin main- If
.envwas ever tracked, stop tracking it before pushing:
git rm --cached .env
git commit -m "Stop tracking .env"- Keep secrets only in
.env. - Commit only
.env.example. - Rotate your OpenWeather API key immediately if it was ever exposed.

