IncubatorTempHumidityTracker
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Quail egg incubator monitoring system built on Val Town. Receives temperature/humidity data from LoRaWAN sensors (RAK7204 and NanoThings NanoTag) via ChirpStack webhooks, stores readings in SQLite, sends email alerts, and displays a React dashboard.
Live URL: https://jhiller--32167624f5bc11f0947042dde27851f2.web.val.run
# Start local development with auto-sync to Val Town vt watch # The app auto-deploys on save - no build step required
- Runs on Deno in a serverless context (not Node.js)
- Entry point:
backend/index.http.tsxexportsapp.fetch - Database: Val Town's hosted SQLite via
https://esm.town/v/stevekrouse/sqlite - Email: Val Town's email service via
https://esm.town/v/std/email - File serving:
https://esm.town/v/std/utilsforreadFileandserveFile
- ChirpStack sends LoRaWAN uplinks to
/webhook/chirpstack?event=up - Webhook routes by DevEUI: RAK7204 (default) or NanoTag (
9c65fafffe02607a) - Payloads decoded: RAK7204 uses Cayenne LPP, NanoTag uses port-based format
- Readings stored in separate SQLite tables per sensor type
- RAK7204 readings trigger alert checks (NanoTag is temperature-only, no alerts)
- Dashboard polls
/api/statusand/api/readingsevery 60 seconds
Defined in shared/constants.ts:
- RAK7204: -2Β°F offset
- NanoTag: +1Β°F offset
- Dashboard displays calibrated values; alerts use calibrated RAK7204 temperature
- 17-day Coturnix quail incubation starting from configured date
- Lockdown phase begins day 15 (higher humidity target)
- Temperature thresholds: ideal 101-102Β°F, warning Β±3Β°F, critical Β±5Β°F
- Alerts rate-limited: critical every 5 min, warning every 30 min
- React 18.2.0 with TailwindCSS (twind)
- Initial data injected into HTML via
window.__INITIAL_DATA__to avoid round-trips - Chart.js for historical temperature/humidity visualization
- Use
https://esm.shfor npm packages (works in both Deno backend and browser) - Pin React to 18.2.0:
https://esm.sh/react@18.2.0 - Start React files with
/** @jsxImportSource https://esm.sh/react@18.2.0 */
shared/must work in both frontend and backend- Cannot use
Denonamespace in shared code - Types and constants live here
- Table names include version suffix (e.g.,
incubator_readings_v1) - Migrations run lazily on first request
- To change schema: create new table with incremented version, don't ALTER
- Use
Responseconstructor for redirects (notResponse.redirect) - Avoid
alert(),prompt(),confirm()browser APIs - Environment variables:
Deno.env.get('KEY')