yesno
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: v28View latest version
A yes/no device endpoint that walks through a daily pipeline of habits, each with a predict → confirm pair integrated with Fatebook for calibration tracking.
Each day the pipeline resets at 2am PST (7am São Paulo) and presents habits sequentially:
- yoga? (80%) → creates Fatebook prediction (80% if yes, 20% if no)
- did you yoga? → resolves prediction (auto-advances if Atom Matrix detected yoga)
- 18 burpees? (80%) → creates Fatebook prediction with today's goal
- did 18 burpees? → resolves prediction
- all done!
| Endpoint | Description |
|---|---|
GET /question | Current question text (plain text, ≤30 chars) |
GET /yes | Answer yes, advance pipeline |
GET /no | Answer no, advance pipeline |
GET /reset | Reset to step 0 |
GET /status | Full pipeline state (JSON) |
GET /responses | All logged answers (JSON) |
habits.ts — Habit definitions (add new habits here)
pipeline.ts — Generic state machine, auto-advance, auto-resolve
fatebook.ts — Fatebook API client (graceful skip if no key)
main.ts — HTTP handler (backward compatible)
cron.ts — 2:15am PST auto-resolve unconfirmed predictions as NO
Add an entry to the HABITS array in habits.ts. Each habit needs:
id,label,forecast,tagsgetPredictText()— predict question (≤30 chars)getConfirmText()— confirm question (≤30 chars)getFatebookTitle()— full Fatebook question titlecheckAutoComplete()— optional auto-detection from external source
Add FATEBOOK_API_KEY to this val's environment variables.
Get your key at https://fatebook.io/api-setup