How we built a multilingual AI astrology platform that grounds every answer in a real birth chart
A consumer-scale Vedic astrology product where the AI never hallucinates planetary positions — it answers over a chart we compute ourselves, in 9 Indian languages, with a self-healing report pipeline on serverless.
Visit the live productThe problem
Astrology is one of the largest consumer-intent categories in India, but the AI-era version of it is full of products that simply pipe a birth date into a chat model and let it improvise. That breaks the moment a serious user checks a planetary position, a dasha period, or a dosha against any established almanac — the answers do not reconcile, and trust evaporates on the first wrong fact.
We needed an assistant that feels conversational and intuitive, yet is provably correct on the underlying astronomy. The hard requirement was that every claim the AI makes about a user’s chart must be traceable to a deterministic computation, not to the model’s training data.
On top of that, the addressable market is multilingual. A Tamil or Bengali user expects the experience in their own language, including a premium report they can keep — so the same chart had to render correctly across nine languages without nine separate codebases.
The architecture
- Next.js (App Router) on Vercel serverless for the web app, with Firebase Auth and Firestore as the identity and persistence layer; reports live across two subcollections (generated_reports and topicReports) and are listed from both.
- An in-house Swiss-Ephemeris / Lahiri-ayanamsa kundli computation engine produces the deterministic chart: planetary longitudes, house cusps, nakshatras, vimshottari dasha, and dosha flags. Timezone is auto-derived from birth coordinates rather than hardcoded to IST.
- A conversational "AI Jyotish" layer does RAG over the user’s computed chart — the chart facts are injected as grounded context so the LLM reasons about real positions instead of inventing them.
- A premium report pipeline fans out to Gemini and Claude under cost-smart routing, then renders an A4 PDF/HTML report plus a page-turning flipbook preview, gated by a free-preview → paywall → unlock funnel.
- Payments run on Razorpay for INR with geo-aware USD pricing, selected per visitor via a cookie + /api/geo + a country provider so the currency is correct before first paint.
The AI stack
Engineering challenges
Stopping the model from hallucinating the astronomy
A raw LLM will happily state a wrong planetary position with full confidence. We removed that failure mode by computing the chart deterministically and feeding it to the model as grounded context — RAG over the user’s real chart. The model’s job becomes interpretation and language, never astronomy. We then validated the engine against AstroSage on the Lahiri system and reached a 10/10 match across test charts.
Reports getting stuck "pending" on serverless
Our first report pipeline used fire-and-forget fetches to kick off generation. On Vercel’s serverless model the function can be torn down the instant the response is returned, so the background work silently died and reports hung at status:"pending". We rebuilt it around Next.js after() to keep the work alive past the response, added a paidAt marker, and made the retry and the viewer payment-aware so a paid-but-unfinished report self-heals. The rule we keep: never fire-and-forget on serverless.
Nine languages without nine codebases
The same computed chart has to render in English, Hindi, Tamil, Telugu, Bengali, Marathi and more. We built a single language registry with graceful fallback — thinner languages fall back to English chrome rather than to a wrong-language string — plus precomputed numerics (e.g. Life Path Number) and a guard that clamps runaway LLM repetition loops that non-English generation tends to trigger.
Trusting quality at scale
Once thousands of reports are generated unattended, you cannot eyeball them. A daily "report-sentinel" cron audits report quality against a shared quality module and emails the founder a digest, so regressions in any single SKU surface within a day instead of via a customer complaint.
The result
- Every chart-level answer the AI gives is traceable to a deterministic computation, eliminating the "confidently wrong fact" failure that sinks competing products.
- Kundli engine validated 10/10 against AstroSage on the Lahiri system.
- Premium reports generate reliably on serverless after the after()-based rebuild, with a self-healing path for interrupted jobs.
- Live in 9 Indian languages from one codebase, serving thousands of users.
- A daily quality cron turns unattended generation into a monitored system.
Lessons we'd bring to your build
- For high-stakes consumer AI, ground the model on a deterministic engine you control — RAG-over-facts beats trusting the LLM’s memory every time.
- Serverless changes the rules: any work that outlives the HTTP response must be made durable (after(), markers, payment-aware retries) or it will silently drop.
- Treat localization as a fallback graph, not a translation table — a correct English string beats a broken local one.
- If generation runs unattended, build the quality monitor before you scale, not after the first complaint.
Planning something like this?
We bring the same production discipline to client builds. Tell us the problem you're solving and we'll map an approach.
Book a discovery call