
紫微斗数
Open-source Zi Wei Dou Shu (purple star astrology) chart engine with an interpretation dataset, in Chinese.Renhuai123/ziwei-doushu
- Stars
- 13.8k
- Forks
- 2.7k
- Licence
- MIT
- Language
- TypeScript
- Last update
- 4 days ago
- Type
- Library
What it is
This is an open-source engine that calculates Zi Wei Dou Shu (紫微斗数), a traditional Chinese astrology chart, based on the Ni Haixia 'Tianji' teaching system. It also publishes a large dataset of pre-generated charts with Chinese interpretive text. The README says the engine includes the chart algorithm, the four transformations system, a pattern knowledge base, and classical text data.
- Calculate a Zi Wei Dou Shu chart for a given birth date, hour index, and gender using the engine
- Study how the chart algorithm and four transformations are implemented in the TypeScript source
- Query the published interpretation dataset for charts by year, using the release files
Great for
- Developers who want to study or reuse a Zi Wei Dou Shu chart calculation engine in TypeScript
- Researchers or students of traditional Chinese astrology who read Chinese
- People who want to browse or analyze the pre-generated chart interpretation dataset
Not ideal for
- Readers who need English-language interpretations, since the README is primarily in Chinese and the interpretation text is Chinese
- People looking for scientifically validated predictions, since the README itself notes the system has limits, for example for family-relationship judgments
- Users who want a polished end-user app, since the README says the bundled interface is only a demo
How to get it
- 1
Clone and build from source
You'll need: Node.js (version not stated in the README excerpt) · npm
Clone the repository
git clone https://github.com/Renhuai123/ziwei-doushuRun the regression tests
npm test - 2
Run it
- Clone the repository and change into its directory
- Install dependencies with npm, following the README's setup section
- Run npm test to confirm the regression tests pass
- Call the chart engine from the TypeScript source, or open the bundled demo interface
- 3
Get the most out of it
- Use the release files for specific years instead of the full archive to save disk space, as the README describes
- Verify downloaded dataset files with the SHA256SUMS.txt file, as the README describes
- Read the README's notes on true solar time and the clock-adjust module before entering birth times for overseas cities
- Check the README's section on the bundled demo interface, which the README says is not the same as the hosted site
Downloads
Strengths
- MIT-licensed code, with the dataset under CC BY 4.0 according to the README
- The README documents known data issues and a changelog, which makes its limits easier to check
- Includes regression tests and continuous integration, according to the README
Trade-offs
- The README says the bundled interface is a demo and differs from the hosted website
- Some dataset figures and interpretations may not match the latest engine default, per the README's notes
- Quoted Ni Haixia lecture text is under a separate non-commercial license, as the README states
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| ziwei-doushu (this) | 13.8k | Library | intermediate | 4 days ago | Developers who want to study or reuse a Zi Wei Dou Shu chart calculation engine in TypeScript |
| swr | 32.5k | Library | intermediate | 21 days ago | React developers who fetch data from APIs in components |
| fumadocs | 13.5k | Library | intermediate | 4 days ago | React developers who want to build a documentation site |
| ui | 127k | Library | intermediate | 4 days ago | Developers building React or Next.js interfaces who want full control over component code |
| trpc | 40.8k | Library | intermediate | 4 days ago | TypeScript teams building a web app where the frontend and backend are both written in TypeScript |
| CopilotKit | 38.5k | Library | intermediate | 4 days ago | Developers adding an AI assistant or agent interface to a React or Next.js app |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.