Skip to main content

Kundli Predict — Vedic Astrology Engine with AI Readings

Computes complete birth charts, dashas, transits and a Hindu calendar in the browser, then has Gemini read the whole chart — so the maths is exact and testable, and only the interpretation is generated.

  • Next.js 15
  • TypeScript
  • Tailwind CSS 4
  • astronomy-engine
  • Google Gemini
  • Dexie / IndexedDB
  • Auth.js v5
  • Vitest

Sign-in is restricted to the owner’s account. Profiles stay on the device; readings send the computed chart to Gemini.

  • Full-stack Development
  • Astronomical Computation Engine
  • LLM Integration (Gemini)
  • Bilingual UI (English/Hindi)
Kundli Predict sign-in screen, showing the bilingual English and Hindi subtitle and the owner-only Google sign-in.

The idea

Most kundli sites are a black box: birth details go to a server and a chart and a paragraph of predictions come back, with no way to check either. I wanted the two halves separated. The astronomy and the classical rules are deterministic, so they run in the browser where they can be tested against reference values. Interpretation is where a language model is genuinely good, so Gemini reads the complete computed chart — and only that part is generated.

What it computes

Everything is derived from first principles rather than fetched. Sidereal positions come from astronomy-engine with the Lahiri ayanamsa applied; the rest is rule evaluation on top of those positions.

  • Charts

    Divisional charts from D1 to D60 in both North and South Indian styles, with nakshatra placement and planetary dignity.

  • Dashas

    Vimshottari timelines down to Pratyantar level, expandable through Maha and Antar periods.

  • Yogas and doshas

    Over 30 combinations, including Gajakesari, Panch Mahapurusha, Kaal Sarp and Sade Sati.

  • Ashtakavarga

    Bindu tables used to score current transits against the natal chart.

  • Hindu calendar

    A panchang month grid with an astronomically drawn moon per day, tithi at local sunrise, festivals, and a personal calendar coloured by each chart’s Tarabala and Chandra Bala.

  • Precision timing

    The classical five-step funnel for a goal: birth-time tolerance, whether the chart promises it, which dashas can deliver it, transit windows, then exact muhurta days.

Exact maths locally, readings from AI

Nothing is fetched to produce a chart: the ephemeris maths runs locally, a 36,000-city database ships with the app so birth places resolve to coordinates and timezones without a lookup, and profiles persist in IndexedDB through Dexie. With the network off, charts, dashas, transits and the calendar all still work.

Answers to questions and period predictions are written by Gemini from the full computed chart — dashas, divisional charts, transits and ashtakavarga together — rather than from a sun or moon sign. The Rashi deep-dive shows the difference directly: the model gives the general forecast for a moon sign, then checks each point against this specific chart and marks it as applying, modified or not applying, naming the placement that decides it.

Chart computation and storage run in the browser; only sign-in and AI readings need the network.
  1. Interface: Next.js 15 (App Router), Tailwind CSS 4 (theming), Bilingual UI (English and Hindi)
  2. Engine: astronomy-engine (sidereal positions), luxon (timezone maths), Rule evaluation (yogas, dashas, transits)
  3. Storage: Dexie (IndexedDB), City database (36,000 entries, bundled)
  4. Online: Auth.js v5 (owner-only sign-in), Google Gemini (reads the whole chart)

Testing an engine with no obvious oracle

Astronomical code fails quietly. An ayanamsa off by an arc-minute still produces a plausible-looking chart, so “it renders” proves nothing. The engine carries 38 Vitest unit tests that check computed values against known reference points — sankranti dates, planetary positions at fixed instants, and ashtakavarga totals verified against classical tables. Those are the tests that catch a wrong answer that still looks right.

When a retired model looks like a bad key

One day every reading failed with “AI is unavailable (offline or no API key)”. The key was fine. Google had retired the model for newly created keys — older keys were still grandfathered onto it — so a routine key rotation took the whole AI path down, and the API’s 404 fell into an error branch that treated every non-rate-limit failure as “no AI configured”. The fix was moving to the current model, verified against the live API with the same request shape. The lesson was the error handling: a message that names the wrong cause costs more time than the fault itself.

Where it stands

Deployed on Vercel as an installable PWA. Sign-in is restricted to my own Google account, so the live link shows the auth screen — the source is on GitHub if you want to read the engine.