{"slug": "i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai", "title": "I built a detention-pay calculator for truckers in a day — unglamourous niches beat another AI wrapper", "summary": "A developer built a free, no-signup detention-pay calculator for truck drivers in a single day, using a single HTML file with vanilla JavaScript. The tool calculates the money brokers owe drivers for waiting past free time at loading docks, then generates a claim PDF — with a watermark that markets the tool to logistics companies. The project targets an unglamorous niche where existing solutions are all paid or email-gated, offering a frictionless web alternative that runs instantly on a trucker's phone.", "body_md": "Every \"what should I build\" thread on here is full of AI wrappers fighting over the same five SaaS founders. Meanwhile there's a guy sitting at a loading dock right now, doing arithmetic in his head, who is about to undercharge his broker by a few hundred bucks because nobody built him a 30-second tool.\n\nI built that tool. It's a free **detention-pay calculator** for truck drivers. This is the build log — the niche-selection, the single-file stack, and two decisions (an SVG gauge and a no-mail-service auth scheme) that were more interesting than the app deserves.\n\nI'm not a trucker. I build small free web tools for industries other may find unglamourous or not enticing enough. That honesty matters later.\n\nTruckers get a \"free time\" window at a dock — usually 2 hours. Past that, the broker owes **detention pay** (~$50–100/hr). Drivers leave an estimated $2,000–6,000/year of it unclaimed, mostly because the math + the paperwork is annoying enough to skip.\n\nSo the spec wrote itself:\n\nThe mistake I almost made: assume the niche is empty because *I'd* never heard of it. I checked. It is **not** empty — DockClaim ($49/mo, GPS tracking), Detention Buddy, a couple of $9.99/mo App Store apps, even a free email-gated web calculator or two.\n\nThat killed my first instinct (\"be the only one\") but clarified the real wedge: **everything is a paid app download or email-gated.** The opening was a genuinely free, no-signup, instant *web* version that also generates the claim PDF. Not \"the only detention tool\" — the one with the least friction. I'll say more on why I'm careful about that claim at the end.\n\nLesson: validate to find your *angle*, not just a go/no-go. \"Crowded but all friction-heavy\" is a fine market.\n\nNo framework. The whole app is a single self-contained `.html`\n\n— markup, CSS, vanilla JS, `jsPDF`\n\nfrom a CDN. It deploys as a static asset. Cold-loads instantly on a trucker's phone on dock wifi, which is the only performance budget that matters here.\n\nThe core math is anticlimactic, which is the point — including the one edge case people forget, the **overnight** dock wait:\n\n``` js\nfunction detentionOwed(arriveMin, leaveMin, freeHrs, rate) {\n  let wait = leaveMin - arriveMin;\n  if (wait < 0) wait += 24 * 60;            // crossed midnight at the dock\n  const billable = Math.max(0, wait / 60 - freeHrs);\n  const charged = Math.ceil(billable);      // brokers bill by the hour\n  return charged * rate;\n}\n```\n\nThe PDF is the actual product. `jsPDF`\n\n, a few `doc.text()`\n\ncalls laying out a claim, and a footer line — `\"Generated free at quackbuilds.com…\"`\n\n. That watermark is the entire distribution strategy: every claim a driver emails a broker carries the tool into a logistics company's inbox. The artifact does the marketing.\n\nThe audience reads dashboards all day, so the result is a round gauge — a dim \"free-clock\" arc that hands off to a glowing amber \"billable\" arc, with a seven-segment LED readout ([DSEG font](https://github.com/keshikan/DSEG)) in the center.\n\nThe trick is splitting one dial into two arcs with `stroke-dasharray`\n\n+ `stroke-dashoffset`\n\n. A 270° sweep, the free segment first, the billable segment offset to start exactly where free ends:\n\n``` js\nconst R = 84, C = 2 * Math.PI * R, ARC = 0.75 * C; // 270° of the circle\n\nconst freeLen = (Math.min(freeMin, wait) / wait) * ARC;\nconst billLen = (Math.max(0, wait - freeMin) / wait) * ARC;\n\ngaugeFree.setAttribute(\"stroke-dasharray\", `${freeLen} ${C}`);\ngaugeBill.setAttribute(\"stroke-dasharray\", `${billLen} ${C}`);\ngaugeBill.setAttribute(\"stroke-dashoffset\", `${-freeLen}`); // negative = start later\n```\n\nBoth `<circle>`\n\ns are `transform=\"rotate(135 100 100)\"`\n\nso the gap sits at the bottom. CSS `transition`\n\non the dash properties animates the fill for free. No charting lib.\n\nUsers wanted their saved loads to survive across phone → laptop. That needs identity. The repo's other apps use crypto wallet connect — great, except truckers are roughly the least crypto-native audience alive. And there was **no mail service** wired up, so magic-links were off the table without adding (and paying for) one.\n\nSo: **email + a recovery code.** On first backup the server mints a high-entropy code, returns it once, and stores only an HMAC of it. Restore = email + code. Cheap, no mail provider, and the code is the secret so it's not guessable like a bare email would be.\n\n``` js\nconst hash = (email: string, code: string) =>\n  createHmac(\"sha256\", PEPPER)\n    .update(`${email.toLowerCase()}:${code.toUpperCase()}`)\n    .digest(\"hex\");\n\n// store `hash` only; on restore compare with timingSafeEqual()\n```\n\nWallet connect is still there as a second option for the few who want it. Everyone else types an email and copies a code.\n\nThe repo's shared Supabase client uses the **anon** key. Convenient — and it means *any* table that client touches is reachable through public PostgREST. Fine for public data; not fine for a table of user logs. Someone could enumerate rows with the anon key that ships in the browser bundle.\n\nFix was two lines: route the API through the **service-role** client, and in the migration `alter table … enable row level security;`\n\nwith **no policies**. No policies = anon/authenticated denied entirely; the service role bypasses RLS. The table becomes reachable only through the server route that mediates the code check. Easy to forget, easy to verify — I had the API smoke-tested for `bad_code`\n\n, `not_found`\n\n, and the happy path before trusting it.\n\nThree things fall out of picking an unglamorous niche:\n\nIt shipped in about a day as a single file plus one API route and one migration.\n\nWhen I drafted the launch post I wrote \"the only free no-signup web version.\" Then I checked, found a couple of free web calculators, and cut the claim. If you're going to build in public, the fastest way to torch your credibility is a superlative someone disproves in a reply. \"Mostly paid apps or email-gated, so I made a free no-login one that also generates the claim PDF\" is true and still sells. Ship the true version of the pitch. Only reason for your email or crypto wallet address is strictly for persistence across browser closes or swapping devices (Other than those two use cases) it is not needed at all.\n\nIf you want to poke at it: ** detention-pay calculator** — type 08:00 → 12:30 and watch the gauge.\n\nWhat's the most unglamourous-but-real niche you've shipped for? I'm collecting them. They very well may be my next tool to hit my page!\n\n[www.QuackBuilds.com](http://www.QuackBuilds.com) - Built by [@itsevilduck](https://dev.to/itsevilduck)", "url": "https://wpnews.pro/news/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai", "canonical_source": "https://dev.to/itsevilduck/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-beat-another-ai-1e9d", "published_at": "2026-05-30 21:43:54+00:00", "updated_at": "2026-05-30 22:11:41.738912+00:00", "lang": "en", "topics": ["ai-products", "ai-tools", "ai-startups"], "entities": ["DockClaim", "Detention Buddy"], "alternates": {"html": "https://wpnews.pro/news/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai", "markdown": "https://wpnews.pro/news/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai.md", "text": "https://wpnews.pro/news/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai.txt", "jsonld": "https://wpnews.pro/news/i-built-a-detention-pay-calculator-for-truckers-in-a-day-unglamourous-niches-ai.jsonld"}}