@sanvika/astro
v1.7.0
Published
Sanvika Astro SDK — thin S2S HTTP client for astro.sanvikaproduction.com. Vedic Kundli, Manglik, 36-guna Ashtakoota + explainable pair scoring. Zero in-process ephemeris/engine math in consumers; compute is owned by the sanvika-astro service.
Maintainers
Readme
@sanvika/astro
Thin S2S HTTP client for the Sanvika Astro service
(astro.sanvikaproduction.com). Vedic Kundli, Manglik, 36-guna Ashtakoota and
explainable pair scoring — all compute is owned by the service. This package
contains zero ephemeris / engine math (fleet rule §4.1a / §20).
Install
pnpm add @sanvika/astroEnv (server-side only — never NEXT_PUBLIC_)
ASTRO_URL=https://astro.sanvikaproduction.com
ASTRO_CLIENT_ID=<your registered clientId>
ASTRO_CLIENT_SECRET=<plain secret from the astro admin panel>
# Optional Tier-1 fleet trust:
SANVIKA_SERVICE_KEY=<shared fleet service key>Usage (server / Next.js API route)
import { SanvikaAstroClient } from "@sanvika/astro/server";
const astro = SanvikaAstroClient.fromProcessEnv();
// 1) Upsert a user's birth → service computes + stores the chart (SSOT)
const up = await astro.upsertProfile({
uid: "u_123",
birth: { date: "1995-08-15", time: "14:30", place: "Varanasi, India", gender: "male" },
});
// up.ok, up.profile.astroReady, up.profile.summary.moonRashiName …
// 2) Read a stored profile summary
const got = await astro.getProfile({ uid: "u_123" });
// 3) Pair compatibility by two stored uids (matchmaking)
const pair = await astro.scorePair({ uidA: "u_123", uidB: "u_456" });
// pair.result.astroScore (0..100), pair.result.gunaTotal, pair.result.reasons[{key,params}]
// Stateless compute (no storage):
await astro.computeChart({ birth: { /* … */ } });
await astro.gunaMilan({ boy: { /* … */ }, girl: { /* … */ } });
await astro.manglik({ birth: { /* … */ } });Every method is error-safe: it returns { ok: true, … } on success or
{ ok: false, code, status?, message? } on failure (never throws on network /
service errors).
Types + display constants
import { RASHIS, NAKSHATRAS, rashiName, nakshatraName } from "@sanvika/astro";
import type { PairScoreResult, AstroProfileSummary, BirthInput } from "@sanvika/astro/types";Reason keys are returned as { key, params } — resolve them in your app via
@sanvika/lang / t(key, params).
