Coffee owner-operator - closing-time calculator - hourly margin against hourly cost of staying open, and the numbers pick the hour
Please build me a single-file HTML closing-time
calculator for an independent coffee shop. It opens
straight in the browser, no network, no dependencies,
data stored locally only.
Put this background in the tool's intro: what hour you
close shouldn't be a feeling or an imitation. One more
open hour adds one more hour of standing costs (labor +
utilities + equipment idling); what comes back is that
hour's margin. Line the two up slot by slot and the
closing hour has an answer. The tool handles both when
to close at night and when to open in the morning.
Data it takes in:
1. Per-slot trading data (filled after exporting from
the POS): for each hourly slot (e.g. 17:00-18:00,
18:00-19:00... with mornings symmetric at 7:00-8:00,
8:00-9:00): average cups over the last [4] weeks,
average ticket, margin per cup (or slot revenue x
the shop's own margin-rate basis)
2. Hourly standing costs, two lines:
- Labor basis, pick one: A. schedulable hours that
shrink with closing time (enter the wage [ ]/hour;
extending service costs real money); B. fixed
full shift (enter 0 for labor, and the UI must
display: "under basis B the labor you save is the
staff going home early, not money")
- Utilities basis: hourly operating electricity [ ]
(espresso machine idling, lighting, HVAC combined,
derived from this shop's power bill)
3. Confounder notes (excluded from the math, surfaced on
the results page): fields to note things like "this
slot is delivery-heavy" or "the Wednesday reading
group packs the room"
Core behavior:
- Per-slot contribution table: slot / average cups /
slot margin / slot standing cost / contribution
(margin - cost), green positive, red negative
- Suggested closing time: scanning backward from the
evening end, find the slot where contribution turns
consecutively negative; output the suggested close
and that slot's actual numbers. Mornings output the
suggested opening symmetrically
- The basis-B labor prompt: fixed line on the results
page - "labor in this calculation is fixed-shift;
if staffing can actually be shortened, the true cost
of a negative slot is higher than shown"
- Confounder check: the results page lists my notes
and asks, per note, "does this slot still hold if
the factor is stripped out?" - I tick the answer
myself and the tool recomputes a comparison view
Output: a one-page decision card - suggested close and
open times, the per-slot table, the cost-basis notes,
and the confounder check results.
Constraints (for the coding agent):
- Slot cup counts come only from input; the tool
contains no "typical coffee-shop hourly curve"
for backfill or comparison
- Fewer than [4] weeks of data may still compute, but
the results page must state "sample weeks short -
holidays mixed with ordinary weeks will skew the
conclusion"
- Single file, English UI, localStorage persistence,
print-friendly; no accounts, no login, no cloud sync
Why it is written this way
Closing time is one of the least-computed decisions an independent shop makes: someone set "until 8pm" at opening, and nobody has asked why since. Yet it is a pure marginal question - rent is already paid, the equipment already sits there, and the incremental cost of another open hour is just labor and utilities, against that hour's margin as the incremental revenue. Line the two sides up per slot and "what time to close" turns from a feelings question into a read-the-table question. The tool handles the morning open symmetrically because the first hour of an office-district shop's rush and a community shop's last hour are often the same problem in mirror.
Making labor an A/B choice is the tool's key honesty design: many mom-and-pop shops run a fixed shift - "I'm here anyway" - where closing earlier saves no wages, only the owner's own time. Under that reality the marginal labor is zero, and forcing an hourly wage would fabricate savings. But basis B must carry the fixed prompt "what you save is going home early, not money," because that un-computed, reminder-only sentence is the actual variable the owner weighs when deciding whether closing early is worth it.
The confounder notes stay out of the math and land on the results page as an admission of the limits of hourly averages: a slot's mean cup count may be propped up by a once-a-week event, and pure numbers would cheerfully cut a slot that actually has a following. Listing the notes and having the owner tick "does it hold without the factor?" and then recomputing a comparison draws the boundary - numbers give the direction, the human rules on it - in plain sight, which is more honest than pretending an algorithm can weigh a reading group.
Variables
| Variable | Notes |
|---|---|
| Per-slot cups and margin | Hour-slot data exported from the POS for recent weeks; the main input |
| Labor basis | A hourly wage (schedulable) / B fixed shift (zero, with prompt) - decides what a negative slot means |
| Hourly operating electricity | Machine idling + lighting + HVAC per hour, derived from the power bill |
| Sample weeks | Weeks of data coverage; short samples trigger the downgraded note on the results page |