A small collection of browser-based experiments, utilities, and prototypes.
Live site: https://playground.thinkingsystems.co.uk/
Legacy GitHub Pages URL: https://davidjcole.github.io/playground/
This repository contains a set of lightweight HTML, CSS, and JavaScript mini-projects, including:
index.htmlandstyles.css: landing page for the playgroundreadability/: a Gunning Fog Index readability calculatorwordcounter/: a richer word counter with readability and keyword density metricsweather/: a weather lookup tool with clothing suggestionszuzu-booker/: a booking cost calculator with holiday-aware pricingjokes/,drawtheline/,recycle/,prompt-examples/: other small experiments and utilities
The site is hosted on Railway at: https://playground.thinkingsystems.co.uk/
Railway now serves the static site and also runs a small Node server for the weather proxy. That proxy keeps the WeatherAPI key out of the browser by reading it from an environment variable on the server.
Relevant files:
server.js: serves the site and proxies/api/weatherpackage.json: start script for Railwayrailway.json: Railway deploy configuration
The weather lookup requires this Railway environment variable:
WEATHER_API_KEY: WeatherAPI key used by the server-side/api/weatherproxy
The current Railway-hosted setup includes a few basic security controls:
- WeatherAPI key is stored server-side in
WEATHER_API_KEYand is not exposed in browser-delivered JavaScript /api/weathervalidates and normalizes theqlocation parameter before calling the upstream API/api/weatherincludes simple per-IP rate limiting to reduce abuse and quota burn- Successful weather responses are cached briefly on the server to reduce repeated upstream requests
- Static files and API responses include security-oriented headers such as:
Content-Security-PolicyX-Content-Type-Options: nosniffX-Frame-Options: DENYReferrer-Policy: strict-origin-when-cross-originPermissions-Policy: geolocation=(), microphone=(), camera=()
- Weather data is rendered into the DOM using DOM node creation and
textContentrather than injecting third-party values withinnerHTML
Install dependencies:
npm installStart the local server:
npm startThe app will run on http://localhost:3000 by default, or on the port provided by Railway via PORT.
- Most of the site is plain static HTML/CSS/JavaScript.
- The weather page should call the local
/api/weatherendpoint rather than talking directly to WeatherAPI from client-side code. - Static assets are served by
server.js, which also applies security headers to responses. - This repo is intended as a sandbox for trying out ideas, so different folders may vary in polish and structure.