Open source metaphysics engine

Bazi with the edge cases handled.

@openfate/bazi-engine is the TypeScript calculation layer behind accurate Four Pillars software: True Solar Time correction, lunar conversion, Da Yun cycles, and branch interaction detection in one package.

24 Solar Terms handled with minute-level precision.
100+ Regression cases spanning DST, leap months, and global timezones.
1 Deterministic data layer you can wire into your own app or workflow.
單獨開啟雙盤對照

Why this package exists

Most Bazi calculators get the tricky parts wrong. This engine exists for teams that need reproducible chart output inside apps, automations, CRM tooling, research workflows, and AI analysis products.

True Solar Time built in

Longitude correction and equation-of-time adjustments are integrated instead of treated as an afterthought.

Lunar and solar input

Accept standard solar input or lunar dates, including leap months, without bolting on a second conversion layer.

Structured output for software

Return pillars, day master, cycles, and interactions in JSON-ready shapes that are easy to render or hand off to AI systems.

Best fit

The engine works especially well when you need deterministic calculations first and interpretation second.

1

Consulting platforms

Generate accurate charts inside dashboards, CRMs, or client-reporting systems.

2

Compatibility products

Compare charts for matchmaking, relationship analysis, or team-fit workflows.

3

AI agents

Feed structured chart data into your own prompt stack or reasoning pipeline.

4

Education and research

Use explainable output for teaching, auditing, and reproducible experimentation.

Shipping on GitHub Pages

This microsite is designed to be deployed directly from the repository using GitHub Pages, so the repo has a public documentation surface beyond the README.

  • Normal HTML links on this page point to the main OpenFate product and package surfaces.
  • The site is lightweight, static, and easy to keep consistent with the README.
  • You can later replace this with a richer demo without changing the Pages URL.

Next moves

If you want more than a landing page, the natural next step is an interactive browser demo that runs the engine directly and publishes example charts.