Weekend project

A frost warning
before bed.

I built Frost Alert over a weekend to solve a small morning problem: finding ice on the windscreen when the school run is already rushed. It checks the overnight forecast and sends a push while there is still time to cover the car.

Try Frost Alert ↗

The product

One decision, made the evening before

The user gives a postcode, chooses an evening alert time and allows notifications. There is no password or mandatory email. The first seven days are free; a one-off £5 winter pass keeps alerts running to the end of April.

A production alert reached my Android phone on 8 November: possible frost, forecast low 1.32C. That checked the whole route from a saved time and weather lookup to a notification on a real device.

I kept the architecture close to that job. A static app handles signup. One scheduled function finds the people due a check. People in the same area share the same forecast.

Nuxt PWA served by S3 and CloudFront calls API Gateway and Lambda. DynamoDB stores subscribers, alert-time index and forecast cache. An EventBridge rule invokes the dispatcher every fifteen minutes. It reads due subscribers, fetches OpenWeather on a cache miss and sends through a browser push service. Stripe's webhook updates pass access.
The app, scheduled check and payment flow. Arrows into Lambda are invocations; the return push is delivered through the browser's push service. Open the image for the full-size diagram.

Frontend

A static app, with notifications

The frontend is Nuxt 3, the Vue framework, generated as static files. SST, an infrastructure-as-code tool, defines the AWS resources alongside the TypeScript application. S3 stores the files; CloudFront serves them from its content delivery network. API Gateway routes requests to Lambda functions, code AWS runs on demand. There is no Nuxt server to keep running.

A progressive web app (PWA) adds a service worker, a browser script that can receive a push when the page is closed. On iPhone, users add the app to their Home Screen and open it there before signing up. The install instructions come before the notification check so Safari does not wrongly tell them the device is unsupported.

The push subscription is the identity. The browser supplies a delivery endpoint and encryption keys; the backend stores them with a generated subscriber ID. Status and unsubscribe requests must match both that ID and endpoint. Email is optional, with separate consent for next-season marketing.

Scheduling

Query the people due now

An EventBridge rule, AWS's scheduled event service, invokes one dispatcher every 15 minutes. The dispatcher rounds the current London time down to a quarter-hour. A 17:00 selection means a check in the 17:00 quarter-hour.

DynamoDB, AWS's key-value database, stores subscribers and cached forecasts in one table. Each subscriber has a primary key such as SUB#<id> and a PROFILE sort key. A global secondary index (GSI), an alternate lookup over the table, groups them by alert slot: SLOT#17:00.

The dispatcher queries that slot rather than scanning everyone. It then keeps subscribers with the FROST rule and valid trial or paid access. The rule list leaves room for other alert types without building them now.

The trade-off is deliberate: one schedule and a queryable time slot are easier to operate than a separate scheduler resource for each subscriber.

Weather

Fetch once for the area

Signup resolves the postcode, rounds latitude and longitude to two decimal places, then discards the full postcode. This is roughly kilometre-scale location, not a street address. The dispatcher groups subscribers by that rounded cell.

Production uses OpenWeather One Call 3.0 for hourly temperature, cloud and wind. The assessment covers 18:00 tonight to 09:00 tomorrow in local time. A minimum at or below 0C produces a frost alert; up to 2C produces a possible-frost alert. Clear, calm hours add context to the message. The thresholds flag conditions worth preparing for.

A CELL#<grid> / NIGHT#<date> record caches the assessment for that night. Another subscriber in the cell reuses it, even if they chose a later slot. DynamoDB's time-to-live field marks the cache for automatic removal after about 36 hours.

Forecast work grows with distinct cells needing a fresh check, not directly with subscriber count. The code also caps fresh lookups per run and per night, alongside the weather account's daily limit. A lookup failure sends a check-failed notification rather than leaving the user to interpret silence.

Delivery

Let the browser deliver the push

The web-push library encrypts the payload and sends it to the browser's push service. VAPID is the key pair that identifies the application sending the notification. Its public key goes into the frontend; the private key stays in a deployment secret. Each preview has its own stable pair, separate from production.

The service worker displays the title and forecast, then opens the app when tapped. A push-service response saying the subscription is gone removes the dead endpoint. Unsubscribe marks the subscriber inactive so alerts stop while the record remains available for history.

Payments

A one-off winter pass

Stripe Checkout takes a one-off payment. A webhook, an HTTP callback from Stripe, confirms the completed checkout to the backend. The handler verifies Stripe's signature before setting the subscriber's paid-until date. Access is granted by the verified webhook.

The app reads access status from the backend after checkout. That same response now returns the saved alert time: an early test caught the confirmation showing the default 17:30 after a page reload, even though 17:00 was correctly stored. The fix was to show persisted state, not a form default.

Preview stages use Stripe test credentials and separate webhook secrets. Production uses live credentials. The deployment script checks that the price is an active, one-off £5 GBP payment before deploying.

What shipped

Small enough to finish in a weekend

The useful part was completing the loop: signup, saved time, overnight assessment, device notification and an optional winter pass. Static hosting and one dispatcher kept the moving parts manageable.

There are choices to revisit as usage grows: caching for a whole night favours fewer API calls over the latest forecast; a quarter-hour slot favours a simple scheduler over exact timing. Those choices kept the scope small enough to get a real alert onto a phone.

The next deep dive, in your inbox.

The desk duck

Small duck. Second opinion.

AI answers from published work. Leave private details out.

A penny for your thoughts.
A quack for mine.

Ask me about Harry's projects.
I'll stick to what he's published.

Just the published work. Questions are saved for 30 days. Privacy0/500