routineTrackerApp
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.
Viewing readonly version of main branch: v178View latest version
Single-user routine checklist app for after-school tasks, with optional timers and per-action parent PIN checks.
main.tsx: HTTP entrypoint (export default app.fetch)backend/index.ts: Hono app + routes + HTML bootstrapbackend/parentAuth.ts: parent PIN verification helpersbackend/schedule.ts: global routine schedule store + active routine calculationbackend/weather.ts: Open-Meteo fetch + cached "today" weather summaryfrontend/index.html: app shellfrontend/index.tsx: React UI with boundary-driven refreshshared/routines.ts: routine labels, task lists, and default schedule windowsshared/types.ts: shared TypeScript contracts
Protected tasks require a 4-digit environment variable:
- Env key:
ROUTINE_PARENT_PIN - Value format: exactly 4 digits (example:
9854)
There is no parent unlock session. Each protected action requires entering the parent PIN.
The client does a coarse watchdog refresh on an interval controlled by:
- Env key:
ROUTINE_REFRESH_INTERVAL_SECONDS - Default:
1800(30 minutes) - Valid range:
5to86400seconds
Suggested values:
- Development kiosk:
15or30 - Stable display:
1800
When this heartbeat runs, the app also checks the deployed build ID and automatically reloads the page if code has changed.
Routine timing is globally controlled by one Blob key:
- Blob key:
routine_schedule_config_v1 - Default timezone:
Asia/Tokyo - Default windows:
- Morning:
06:30-08:30(daily) - After school:
15:00-19:00(Mon-Fri) - Bedtime:
20:00-21:30(daily)
- Morning:
On first run, the app auto-creates this config if missing.
The UI does not poll every minute. It refreshes by:
- scheduling one timer for
nextChangeAt - re-syncing on
visibilitychange,focus, andonline - coarse 30-minute watchdog refresh
Weather uses a separate 30-minute refresh in the client and a 15-minute server cache in backend/weather.ts.
POST /api/parent/verify: verify parent PIN for a protected actionGET /api/routine/active: active routine, tasks, and next boundaryGET /api/routine/schedule: current global schedule configGET /api/weather/today: today weather for Kyoto (current temp, high/low, sunrise/sunset, and next rain time/probability in the next 24 hours)