An astrology engine that publishes its error bars
Let me get the awkward part out of the way first, because it decides whether the rest is worth your time. Astrology has no established predictive power. I am not going to argue otherwise, and the site this post is about
Let me get the awkward part out of the way first, because it decides whether
the rest is worth your time.
Astrology has no established predictive power. I am not going to argue
otherwise, and the site this post is about does not claim any. What it does is
narrower and, I think, more interesting to build: it computes where the planets
actually were at a moment and place, and then reports what the classical texts
assign to those positions. Saturn in the 2nd house from the Moon is "time, duty
and what is earned slowly, and the 2nd is money, speech and family". Not
"financial trouble ahead". The first is checkable. The second is a forecast
wearing a lookup's clothes.
That distinction turns out to be an engineering constraint, and most of what
follows comes from taking it seriously.
Why not Swiss Ephemeris
Swiss Ephemeris is the standard library in this field and it is excellent. It
is also AGPL, and the network clause means a hosted service built on it has to
offer its own source. For a project that intends to charge for reports one day,
that is a decision disguised as a dependency, so it was out from the start.
The engine is TypeScript, built on astronomy-engine, in a workspace that does
nothing but arithmetic β no HTTP, no rendering, no strings a reader will see.
An Express API wraps it, and a Next.js site on Cloudflare Workers reads that
API.
How accurate is "accurate"?
Every astrology site says its calculations are accurate. None of them says how
accurate, which is the only part that means anything.
So: every classical graha lands within 10 arcseconds of NASA's JPL
Horizons. That is measured across 50 birth combinations spanning 1954 to 2045
across 10 cities, and the worst case anywhere in it is Saturn at 9.65
arcseconds. The Sun agrees to about one arcsecond. The full per-graha table is
published, along with the dates it was run and the method.
An arcsecond is one 3,600th of a degree, so even the worst case is far finer
than anything the tradition can read. That is the point of publishing it: the
error bar is not impressive because it is small, it is useful because it exists.
Panchang is checked differently, because an ephemeris comparison cannot catch a
calendar mistake. Tithi end times are compared against published almanacs to
the minute, and Sankranti dates against the same. And the significations β the
wording layer β have their own check: every graha in every sign at every degree,
2,723 cases, each verified to produce the reading the texts give rather than the
one the code happens to assemble.
Counts as of today: 620 tests in the calculation engine, 71 on the API, 1,167 on
the site.
The engine emits codes, never sentences
'exalted', 'lord-in-dusthana', distance: 9. Never a phrase.
This sounds like architectural fussiness until you have shipped the bug it
prevents. Words need a locale and an ephemeris has none, so the moment a
calculation returns prose, the prose is in whichever language whoever wrote that
function was thinking in. The Mangal Dosha cancellations once rendered in
English on the Hindi page for exactly this reason. All wording lives in one
message catalogue per locale, and the engine's job ends at the code.
It has a second payoff I did not plan for: a structured fact is also what you
hand a language model when you want it grounded. Sentences are what you hand it
when you want it to improvise.
The CPU bill, which is where it got interesting
Cloudflare Workers' free tier enforces 10 ms of CPU per request. Rendering one
page of this site costs 40 to 70 ms. That arithmetic does not work, which is why
the project pays for Workers β not as a preference, as the only way to serve a
page.
The paid plan includes 30 million CPU-milliseconds a month. Last week it was at
23.31 million with three weeks gone, on traffic that is genuinely small. Those
two facts together are a bug, not a bill.
The cause was a cache that could never hit. The almanac tools accept a date in
the query string β /panchang?city=mumbai&date=2026-11-17 β and a crawler
walking dated URLs asks for a day nobody will ever ask for twice. Measured hit
rates: 1% on the dated panchang, 0% on the dated choghadiya, against
42% on the home page. Every one of those misses paid 439 to 969 ms of CPU to
render a page for an audience of one robot.
Two changes fixed it. The dated query URLs are disallowed in robots.txt β
scoped to the four almanac tools, not a blanket rule, because date is also the
birth date on the chart pages and those must stay crawlable so their noindex
is read. And the undated pages, which are the ones humans actually load, got a
cache lifetime measured in hours instead of minutes.
Same traffic, before and after: 201.8 ms of CPU per request became 100.0
ms. Half the bill, no feature removed.
How do you cache a page for a day when it shows the current minute?
The choghadiya page marks which period is running right now. That claim is true
for 90 minutes, which seems to cap the cache at 90 minutes β and capping the
cache is what was costing the CPU.
The fix was to notice that the server does not need to make the claim. The
rendered HTML now contains every period with its start and end time and no
statement about which one is current. A small client component compares those
times to the reader's clock and marks the running one, ticking every 30 seconds.
A CSS :has() rule styles the row it marks.
The server HTML is now identical for everyone who loads that page today, so it
can be cached for the whole day. The page still shows the current period. Nobody
notices anything, which is the correct outcome.
The bug that only appeared before dawn
The Hindu day runs sunrise to sunrise, not midnight to midnight. So a cached
almanac page was given a lifetime that ran to local midnight β which is right in
the afternoon and wrong at 4 a.m., because a request made before sunrise belongs
to the previous Hindu day and would be served, cached, to everyone who asked
after sunrise.
The cache lifetime is now capped at the next sunrise as well as midnight,
whichever comes first. It is three lines. Finding it took three wrong diagnoses,
because the symptom only existed for the two hours a day nobody was looking.
Privacy, as a constraint rather than a page
Birth details arrive in a query string, so they are in a URL, so they are
everywhere a URL goes. Anything carrying them is no-store β not private,
which still lets the reader's own browser write it to disk where the next person
on a shared machine finds it in the back button. Shared machines are common in
this readership.
The analytics are first-party and store categories only: event name, normalised
path, locale, country, device class, whether the visitor was a browser or a
crawler. No cookie, no identifier, no fingerprint, nothing that narrows to a
person. It is enough to answer "did anyone use this" and not enough to answer
"who".
What it does not do
Lahiri ayanamsa only. No shadbala. No Jaimini. Raw Ashtakavarga bindus, no
reductions. No Varshphal. Those are gaps, listed rather than worded around,
because the alternative is a reader discovering them after trusting something.
And it does not predict anything, which is the limit the whole thing is built
around rather than one it ran into.
The site is free, needs no signup and no phone number, and is in English and
Hindi: astrosiddhant.com. The accuracy table,
the method and the dates it was last run are at
astrosiddhant.com/method β that page is
the one I would read first if I were sceptical, which you should be.
The two calculators the post is really about, if you want to poke at the
output: the birth chart and
the panchang.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.