From the team behind AskingMing — AI-powered Bazi (八字) readings.
Open-source building blocks for rendering Bazi / Four Pillars of Destiny (八字·四柱) charts on the web. BaziKit gives you the two things a raw calculation rarely ships with:
- a complete bilingual (中文 / English) terminology database, and
- a ready-to-drop React chart component.
Feed the component a chart and it renders a complete, bilingual Four Pillars layout — pillars, hidden stems, Na Yin, growth stages, Shen Sha, Five-Element scores, interactions (刑冲合会), the Luck Pillar (大运) timeline and auxiliary palaces — with inline styles only (SSR-safe, zero CSS build step).
| Package | What it is | Dependencies |
|---|---|---|
bazi-terms |
Bilingual terminology database — Heavenly Stems, Earthly Branches, Ten Gods, Shen Sha, Na Yin, Growth Stages, interactions and general chart vocabulary. Framework-agnostic. | zero |
bazi-chart |
<BaziChart /> React component + adapters that normalize raw chart data into one model. Inline styles, SSR-safe, light/dark, zh / en / both. |
react (peer) |
npm install bazi-chart<BaziChart /> renders the chart data you pass in — it never calculates anything itself. Give it either:
- raw output from your Bazi engine — the two most common community shapes are auto-detected (a top-level Chinese
八字object, or apillarsmap keyed by year/month/day/hour), or - a pre-normalized
NormalizedChartyou build yourself, for any other source.
import { BaziChart } from 'bazi-chart';
// `data` = raw engine output (auto-detected) or a NormalizedChart.
export default function Chart({ data }) {
return <BaziChart data={data} lang="both" theme="light" />;
}Build the chart object yourself when your source is not auto-detected:
import { BaziChart } from 'bazi-chart';
import type { NormalizedChart } from 'bazi-chart';
const chart: NormalizedChart = {
meta: { engine: 'normalized' },
dayMaster: { char: '戊' },
pillars: [
{ position: 'year', ganZhi: '庚午', stem: '庚', branch: '午', hiddenStems: [] },
{ position: 'month', ganZhi: '己卯', stem: '己', branch: '卯', hiddenStems: [] },
{ position: 'day', ganZhi: '戊子', stem: '戊', branch: '子', hiddenStems: [] },
{ position: 'hour', ganZhi: '丁巳', stem: '丁', branch: '巳', hiddenStems: [] },
],
daYun: [],
interactions: [],
};
export default () => <BaziChart chart={chart} lang="en" />;npm install bazi-termsimport { t, translate, tenGodByZh, naYinOf, stemByChar } from 'bazi-terms';
t('dayMaster'); // 'Day Master'
t('dayMaster', 'zh'); // '日主'
translate('元男'); // 'Day Master' (engine alias → canonical term)
translate('午子相冲'); // 'Clash' (Chinese description → term)
translate('海中金'); // 'Sea Gold'
naYinOf('甲子')?.en; // 'Sea Gold'
tenGodByZh('偏官')?.en; // 'Seven Killings' (alias of 七杀)
stemByChar('庚')?.element; // 'metal'- Presentation + terminology, not calculation. BaziKit never recalculates a chart — it renders what your engine produced, so the astrology stays entirely in your control.
- Zero-dependency core.
bazi-termsis pure data with no runtime dependencies, usable in any framework or on the server. - Normalize once, render anywhere. Adapters convert a supported input shape into a single
NormalizedChart; raw Chinese values are preserved and translated at render time, so unknown output never breaks the UI. - SSR-safe, no CSS build step. The component uses inline styles only — drop it into Next.js, Remix, Astro or plain React without a stylesheet pipeline.
pnpm install
pnpm -r build # tsup: ESM + CJS + .d.ts for every package
pnpm -r test # vitest (terms consistency + adapter/render golden tests)
pnpm -r typecheck # tsc --noEmitAdapters are tested against golden fixtures — real, verified chart output captured into packages/bazi-chart/fixtures/.
BaziKit intentionally stops at the chart. It does not provide an interpretation engine, scoring conclusions or AI reading text — that judgment layer is the hard-won craft we keep in our own product.
MIT © 2026 AskingMing.
Want an interpretation, not just a chart? → Get a full AI-powered Bazi reading on AskingMing.