Skip to content

Commit 9133420

Browse files
committed
Fix homepage load-scroll jump; make cost page deterministic
- Homepage no longer jumps to the explorer on load: selectApi() only scrolls when the user actually picks an API (card click / "open in explorer"), not during initial boot. - Cost page: domain is a firm $14/year (no per-month figures anywhere), and the dynamic API cost is stated as $0.30 per extra 100,000 requests. Table, body and bottom line all updated to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T5bVC7tV6mXCyUrpsqsr4V
1 parent 8a5ed82 commit 9133420

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

assets/app.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
);
7474
}
7575

76-
function selectApi(api) {
76+
function selectApi(api, scroll) {
7777
state.current = api;
7878
var list = document.getElementById("explorer-list");
7979
list.innerHTML = "";
@@ -89,8 +89,11 @@
8989
});
9090
});
9191
loadRecord(api, api.url, "index");
92-
var exp = document.querySelector(".explorer");
93-
if (exp) exp.scrollIntoView({ behavior: "smooth", block: "center" });
92+
// Only scroll when the user explicitly picks an API — never on initial load.
93+
if (scroll) {
94+
var exp = document.querySelector(".explorer");
95+
if (exp) exp.scrollIntoView({ behavior: "smooth", block: "center" });
96+
}
9497
}
9598

9699
// ---------- API cards + search ----------
@@ -104,7 +107,7 @@
104107
el("p", null, [api.description]),
105108
el("span", { class: "count" }, [fmt(api.count) + " records"]),
106109
]);
107-
card.onclick = function (e) { e.preventDefault(); selectApi(api); };
110+
card.onclick = function (e) { e.preventDefault(); selectApi(api, true); };
108111
return card;
109112
}
110113

@@ -168,7 +171,7 @@
168171
el("pre", { class: "surprise-json", html: highlight(pretty) }),
169172
el("div", { class: "surprise-actions" }, [
170173
(function () { var b = el("button", { class: "btn primary", text: "🎲 Again" }); b.onclick = surprise; return b; })(),
171-
(function () { var b = el("button", { class: "btn ghost", text: "Open in explorer →" }); b.onclick = function () { selectApi(api); }; return b; })(),
174+
(function () { var b = el("button", { class: "btn ghost", text: "Open in explorer →" }); b.onclick = function () { selectApi(api, true); }; return b; })(),
172175
]),
173176
]));
174177
}).catch(function () { out.innerHTML = '<span class="surprise-loading">Hmm, try again.</span>'; });

cost/index.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ <h2>The whole bill</h2>
4343
<tr><td>Static hosting &amp; bandwidth</td><td>Cloudflare Pages (free plan)</td><td>$0 — unlimited</td></tr>
4444
<tr><td>Source &amp; CI/CD</td><td>GitHub + GitHub Actions (public repo)</td><td>$0</td></tr>
4545
<tr><td>TLS, CDN, DDoS protection</td><td>Cloudflare (included)</td><td>$0</td></tr>
46-
<tr><td>Domain name</td><td><code>gratisapi.com</code></td><td>≈ $10–12 / year</td></tr>
47-
<tr><td>Dynamic API compute <em>(planned)</em></td><td>Cloudflare Workers</td><td>free to 100k req/day, then cents</td></tr>
48-
<tr><td class="tot"><strong>To run the site today</strong></td><td class="tot">just the domain</td><td class="tot"><strong>≈ $1 / month</strong></td></tr>
46+
<tr><td>Domain name</td><td><code>gratisapi.com</code></td><td>$14 / year</td></tr>
47+
<tr><td>Dynamic API compute <em>(planned)</em></td><td>Cloudflare Workers</td><td>free tier, then $0.30 / extra 100k requests</td></tr>
48+
<tr><td class="tot"><strong>To run the site today</strong></td><td class="tot">just the domain</td><td class="tot"><strong>$14 / year</strong></td></tr>
4949
</tbody>
5050
</table>
5151
</div>
@@ -58,20 +58,20 @@ <h2>Hosting is genuinely $0</h2>
5858
static: popularity doesn't cost anything.</p>
5959

6060
<h2>The only real cost: the domain</h2>
61-
<p>The one fixed expense is the domain, <code>gratisapi.com</code>on the order of
62-
<strong>ten dollars a year</strong>. It's paid out of pocket, and it's small enough that it
63-
will simply keep being paid. That's the entire recurring cost of running GratisAPI as it
64-
exists today: inexpensive to build, inexpensive to keep alive.</p>
61+
<p>The one fixed expense is the domain, <code>gratisapi.com</code><strong>$14 a
62+
year</strong>. It's paid out of pocket, and it's small enough that it will simply keep
63+
being paid. That's the entire recurring cost of running GratisAPI as it exists today:
64+
inexpensive to build, inexpensive to keep alive.</p>
6565

6666
<h2>The dynamic API changes the math</h2>
6767
<p>A <a href="../tech/">dynamic API</a> (filtering, search, <code>random</code>) needs code
6868
to run on each request, and that's the first time a request costs anything. On Cloudflare
69-
Workers the <strong>first 100,000 requests a day are free</strong>, and beyond that it's a
70-
fraction of a dollar per 100,000 — cheap, but no longer zero. The genuinely hard part isn't
71-
the price; it's that <strong>without API keys it's difficult to stop a single heavy user
72-
from spending the whole budget</strong>. Keys would fix it, but keys are exactly what we
73-
promised never to require. Squaring that circle — generous limits, no accounts — is the
74-
interesting problem we're working on.</p>
69+
Workers there's a free allotment, and beyond it each additional block of requests costs
70+
<strong>about $0.30 per extra 100,000 requests</strong> — cheap, but no longer zero. The
71+
genuinely hard part isn't the price; it's that <strong>without API keys it's difficult to
72+
stop a single heavy user from spending the whole budget</strong>. Keys would fix it, but
73+
keys are exactly what we promised never to require. Squaring that circle — generous limits,
74+
no accounts — is the interesting problem we're working on.</p>
7575

7676
<div class="callout">
7777
<h3>How it's funded</h3>
@@ -89,9 +89,9 @@ <h2>Or make your cost $0 too — fork it</h2>
8989
option, not a fallback — see the <a href="../about/">build guide</a>.</p>
9090

9191
<h2>The bottom line</h2>
92-
<p>GratisAPI costs about a dollar a month to run and nothing to use. It's cheap by design,
93-
open by license, and free by promiseand every one of those three is what keeps the other
94-
two honest.</p>
92+
<p>GratisAPI costs $14 a year to run — one domain renewal — and nothing to use. It's cheap
93+
by design, open by license, and free by promise, and every one of those three is what keeps
94+
the other two honest.</p>
9595

9696
<p style="margin-top:30px"><a class="btn primary" href="../#apis">Start using it — free</a>
9797
&nbsp; <a class="btn ghost" href="../tech/">The technicals →</a></p>

0 commit comments

Comments
 (0)