WaterTrack uses the browser’s built-inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mr-sunset/watertracker/llms.txt
Use this file to discover all available pages before exploring further.
localStorage as its only data store — no cookies, no IndexedDB, no server. Every drink you log and every running total is persisted entirely in two keys, both of which hold JSON-serialised values. Because there is no backend, all data lives on the device in the browser that recorded it.
water_total_intake
| Property | Value |
|---|---|
| Type | JSON number |
| Default | 0 (missing key is treated as 0) |
| Updated | Every time a drink is logged |
logDrink() adds the new amount to the existing value and immediately writes it back via saveToLs.
Read it from the browser console:
water_logged_drinks
| Property | Value |
|---|---|
| Type | JSON array of { amount: number, time: string } objects |
| Default | [] (missing key is treated as an empty array) |
| Updated | Every time a drink is logged (new entry prepended at index 0) |
unshift(), so the most recent drink is always at index 0. Each entry has two fields:
amount— integer oz value logged for that drink.time— locale-formatted time string produced bytoLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }).
Clearing all data
The following two lines are equivalent to pressing the Reset button in the settings panel. They remove both keys so the app returns to its zero state on the next render:Internal helper functions
Two private functions insidescript.js handle all localStorage reads and writes. They are not part of a public API, but understanding them is helpful when debugging unexpected behaviour.
saveToLs(name, item)
JSON-serialises item and writes it to localStorage under the key name using localStorage.setItem(name, ...). The entire operation is wrapped in a try/catch; if serialisation or the write fails, the error is logged to the console and the call returns silently.
loadfromLs(name)
Reads the raw string stored at name with localStorage.getItem(name), parses it with JSON.parse, and returns the resulting value. Returns null on any failure (missing key, invalid JSON, etc.) rather than throwing. Callers use the || 0 and || [] fallback pattern to substitute safe defaults when null is returned.
localStorage is scoped to the browser origin. Data stored while running WaterTrack on
localhost is not accessible from a deployed URL (e.g. https://example.com) and vice versa.