We Open-Sourced Our Entire Bazi Toolchain: Introducing bazi-kit
The AskingMing team open-sourced the full Bazi toolchain powering our product: computation engine bazi-engine, bilingual terminology DB bazi-terms, and React chart component bazi-chart. MIT licensed.
Building a Bazi (Four Pillars) product is hard — not because of the interpretation logic, but because there's no clean bilingual terminology database or usable chart UI out there. Most resources are Chinese-only, and every chart component you find is welded to one specific calculation engine. Want to swap engines or show English labels? You're rewriting the entire view layer.
We hit the same wall building AskingMing. So we extracted the entire toolchain that powers our product and open-sourced it as bazi-kit under the MIT license — three npm packages, each usable independently or together:
bazi-engine— Computation layer: pass a birth date, time, location and gender; get a complete chart.bazi-terms— Bilingual terminology database: Heavenly Stems, Earthly Branches, Ten Gods, Na Yin, Shen Sha… structured, translatable, zero dependencies.bazi-chart— React chart component: render any chart data as a clean bilingual UI.
Dependencies flow strictly one-way: bazi-terms ← bazi-engine / bazi-chart. The renderer never depends on the engine — bring your own or use ours.
bazi-engine: From Birth Data to a Complete Chart
This is the heaviest layer, and the most underestimated. Chart computation looks like table lookups, but getting true solar time, historical DST, and city coordinates right is far more work than it seems.
import { computeBazi } from 'bazi-engine';
const result = computeBazi({
solar: '1990-03-24 09:54',
gender: 'male',
location: { city: 'Guangzhou' },
});
// result.pillars, result.daYun, result.solarTime …
computeBazi is a pure function: identical input always produces byte-identical output. No IO, no Date.now(), no global state. It enables true solar time correction by default (using the Meeus equation-of-time formula) and handles historical DST via the IANA timezone database — China was UTC+9 in summer 1988, a detail no static offset table can express.
v1 capabilities:
- Four Pillars (stems, branches, hidden stems), Ten Gods (stem + hidden-stem level)
- Na Yin, Xun/Kong (void branches), Growth Stages, Self-sitting
- Luck Pillars with ten gods and Na Yin
- True Solar Time (Meeus / approximate algorithms)
- Built-in coordinate and timezone mapping for 88 cities
Interactions, Shen Sha, and Five-Element scores are planned for v2.
bazi-terms: Every Concept, Translatable and Searchable
Every term a chart uses is structured data:
- Heavenly Stems
STEMS(10), Earthly BranchesBRANCHES(12) - Five Elements (with cycles)
ELEMENTS,ELEMENT_CYCLES - Ten Gods (incl. Day Master)
TEN_GODS(11) - Growth Stages
GROWTH_STAGES, Shen ShaSHEN_SHA(38) - Sixty Jiazi Na Yin
NA_YIN(30 melodies / 60 pairs) - Interactions
INTERACTION_TYPES(8), General TermsGENERAL_TERMS(40+)
Each entry carries key, zh, en, optional pinyin, and an English definition you can paste into a tooltip. The workhorse translate() never throws — unrecognized input passes through unchanged, so you can safely pipe raw engine output straight through it:
import { translate, t, naYinOf } from 'bazi-terms';
t('dayMaster'); // 'Day Master'
translate('元男'); // 'Day Master' (aliases auto-resolved)
translate('甲子'); // 'Sea Gold' (Na Yin by sexagenary pair)
naYinOf('甲子')?.en; // 'Sea Gold'
Different engines name the same concept differently. bazi-terms normalizes them all through aliases and dedicated resolvers, so one zh → key mapping serves every engine.
bazi-chart: Render Any Chart, Bilingually
Feed your chart data to <BaziChart />. It auto-detects the input shape, normalizes it, and renders — no extra configuration needed.
import { BaziChart } from 'bazi-chart';
export default function Reading({ engineOutput }) {
return <BaziChart data={engineOutput} lang="both" theme="light" />;
}
It renders the full picture: Four Pillars, Five-Element score bars, interactions panel, Luck Pillar timeline, and auxiliary palaces. Styling is inline-only — no CSS import, SSR-safe, works with any meta-framework (Next.js, Remix, Astro).
Already have your own engine? bazi-chart auto-detects the two most common community shapes and also accepts a hand-built NormalizedChart.
Install & Compose
Use any package alone or combine as needed:
npm install bazi-engine bazi-chart # Full stack
npm install bazi-chart # Render only
npm install bazi-terms # Terminology only
All ship ESM + CJS dual builds with full TypeScript declarations.
Why Open-Source the Entire Chain
Most Bazi projects open-source either the algorithm or the UI, leaving a gap that forces you to adapt to someone's proprietary format. We opened all three layers because each has independent reuse value:
- Building a Bazi app? Use
bazi-engine+bazi-chart— save months of infrastructure work. - Already have an engine? Install
bazi-chart— it's engine-agnostic. - Writing Bazi articles and need accurate bilingual terms?
bazi-termsis zero-dependency, grab and go.
Our hope: stop reinventing wheels, make the basics public infrastructure, and focus energy on differentiated interpretation and product experience.
About AskingMing
bazi-kit is the toolchain open-sourced from AskingMing — an AI-powered Bazi insight and personal growth product (the site you're reading this on). But these tools are designed for anyone building in this space, independent of the product itself.
It's early (v0.1.x), and feedback is genuinely welcome: missing terms, wrong translations, edge cases, new chart shapes, or non-React renderer needs — reach out via GitHub issues or PRs.
Want to see what this chart renderer actually looks like? Enter your birth date and time to generate your own Bazi chart instantly: Free Bazi Chart.
GitHub: https://github.com/favkit/bazi-kit · npm: bazi-engine / bazi-terms / bazi-chart
Recommended reading
Yin Yang and the Five Elements: A Beginner's Guide
What are yin yang and the Five Elements? Learn the core framework of Chinese metaphysics and how yin yang and the Five Elements shape every bazi chart.
Sep 1, 2026Heavenly Stems & Earthly Branches: Bazi's Time System
What are Heavenly Stems and Earthly Branches? Learn how China's 60-cycle calendar builds your bazi chart — the four pillars of your birth moment.
Aug 25, 2026BaZi vs Zi Wei Dou Shu: Core Differences Between Two Chinese Destiny Systems
BaZi reads five-element interactions while Zi Wei Dou Shu maps stars across twelve palaces. Compare the two major Chinese destiny systems — chart structure, analysis style, and which one fits your question.
Aug 17, 2026Can BaZi Reveal Your Career and Relationship Patterns? A Practical Guide
The Ten Gods in BaZi reflect your core drivers in career and relationships. Learn how each Ten God type shapes your work style, relationship needs, and life priorities.
Jul 20, 2026What Makes a Good AI BaZi Reading? Four Standards to Judge Quality
Not all AI fortune-telling tools are equal. Learn how to evaluate whether an AI BaZi reading is genuinely chart-based or just generic text dressed up in mystical language.
Jul 18, 2026BaZi vs Star Sign vs Chinese Zodiac: Which Compatibility Method Is Most Useful?
A side-by-side comparison of BaZi marriage compatibility, Western astrology synastry, and Chinese zodiac pairing — covering analytical depth, data requirements, and practical value.
Jul 15, 2026
