iztro: a TypeScript library for Zi Wei Dou Shu charts, next to a separate hosted AI service
A lightweight kit for generating astrolabes for Zi Wei Dou Shu (The Purple Star Astrology), an ancient Chinese astrology system, letting you get your horoscope and personality analysis. A lightweight, multi-language JavaScript library.
At a glance
- What is it?
- iztro is an MIT-licensed library that computes Zi Wei Dou Shu astrolabes from a birth date, time and gender, with chained queries, plugins and six output languages. The same README also advertises four paid-looking hosted AI models that are not part of the npm package.
- Who is it for?
- iztro suits developers who need Zi Wei Dou Shu charts computed in JavaScript or TypeScript, with querying across palaces, stars and time periods, and who may want to adjust school-specific rules through configuration and plugins. It does not suit anyone who expects the npm package to include AI interpretation or Qimen charts, because those come from separate hosted models that need an API key.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- SylarLong/iztro4,443 ★ · +265
| Repository | 2026-09-23 | 2026-11-25 |
|---|---|---|
| SylarLong/iztro | 4.2k | 4.4k |
265 Stars in the last 63 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The npm package is a chart calculator, and the AI models are a different product
iztro is a JavaScript open source library for generating Zi Wei Dou Shu astrolabes, an ancient Chinese astrology system. The README now begins with a different offer: four public hosted AI models, iztro-ziwei-v3, iztro-qimen-v3, and fast variants of each, which call server-side astrology tools for the user.
A note in the README separates the two. The npm package iztro remains the open source Zi Wei Dou Shu charting library. The AI models are used through an API or an Agents SDK, and the Qimen capability is not a local Qimen charting module. So installing the package gives you chart data and query functions only. Interpretation of the chart and any Qimen analysis require the hosted service and its key.
From birth data to twelve palaces, periods and floating stars
The input is a birth date, either solar or lunar, a birth time and a gender. From that the library returns the star data for the twelve palaces, the Chinese zodiac animal, the Western constellation, and the four pillars of the birth time written in the sexagenary system. It also returns data for the decadal, minor, yearly, monthly, daily and hourly periods, along with the floating stars of the decadal and yearly periods.
The long feature list is mostly query functions: whether a palace holds certain stars, whether its three-direction and four-corner palaces hold stars or transformations, whether a star has a transformation or a given brightness, which palace a star sits in, the opposite palace, and whether a palace is empty. Flying-star functions report whether a palace flies a transformation into a target palace and which palaces its transformations land in.
Queries chain from a star to its surrounding palaces
The query API is chained. To ask whether the Zi Wei star has a taboo transformation in its three-direction and four-corner palaces, the example is:
import { astro } from 'iztro';
const astrolabe = astro.bySolar('2000-8-16', 2, '男', true, 'zh-CN');
astrolabe.star('紫微').surroundedPalaces().haveMutagen('忌');The call builds the chart from a solar date with a time argument, a gender, a flag and an output language, then walks from a star to its surrounding palaces and checks for a transformation. Star and transformation names are passed as Chinese strings in this example, so your code needs to use the same terms for the language you chose. The chain keeps chart logic readable, but the semantics rest on the Zi Wei rules built into the library.
Schools disagree, so configuration and plugins arrived in 2.3.0
Zi Wei Dou Shu has many schools, and they differ slightly on the four transformations and on star brightness. To serve different schools, version 2.3.0 added a global configuration and third-party plugins. The documentation for them is on a separate site.
The consequence is that default output reflects one set of rules. If your audience follows a school that places a star's brightness or a transformation differently, the default chart will disagree with their expectations, and the fix is configuration or a plugin, not a bug report. The README also offers an online charting tool, ziwei.pub, for anyone who wants to see results without writing code.
Six output languages, with English translated by meaning
The library accepts input in mixed languages from several countries and regions and outputs in a chosen one. The supported languages are Simplified Chinese, Traditional Chinese, English, Japanese, Korean and Vietnamese. The author notes that English translations have no standard yet, so most terms are translated by meaning.
Because of that, English strings may differ from other sources, and the author invites pull requests from people fluent in astrology translation. If you build an English product on iztro, treat the English labels as a good-faith choice rather than an industry vocabulary, and test them with your own users. The package description is itself bilingual, in Chinese and English.
Install through any package manager, or load a minified file from a release
You can install with npm, yarn or pnpm:
# npm
npm install iztro -S
# yarn
yarn add iztro
# pnpm
pnpm install iztro -SFor static HTML pages there is a standalone build: download iztro-min-js.tar.gz from the release assets, which holds a minified script and a source map. The standalone library has existed since v2.0.4. The README recommends the versioned file name, for example iztro-v2.6.0.min.js, loaded with a script tag, and keeps iztro.min.js for older references. The package.json lists lib/index.js as main and points the unpkg and jsdelivr entries at dist/iztro.min.js.
The hosted Chat API needs a server-side key and a session for every conversation
The Chat API requires an API key, which the README says to keep in a server environment variable named ZIWEI_API_KEY and never in browser code. You create a session, then post messages to it. A Qimen session is created with the model name:
curl https://chat-api.iztro.com/v2/platform/sessions \
-H "Authorization: Bearer $ZIWEI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_user_id": "user_123",
"model": "iztro-qimen-v3"
}'Qimen asks about one specific matter at a time and needs no birth information. It uses the request time by default, so pass current_datetime with a UTC offset if the user's time zone differs or you need reproducible results. Candidate dates are triggers combined with the whole reading, not a guarantee that a day will succeed. The Agents SDK wraps the OpenAI Agents SDK in Python and TypeScript, under the package name openai-iztro-agents.
Frequent 2.6 releases and a MIT license, with WeChat support offered
The newest releases are v2.6.4 on 2026-11-02, v2.6.3 on 2026-10-16 and v2.6.2 on 2026-10-12, and the last push was on 2026-11-02. The license is MIT, and the repository carries a changelog, a security policy, contributing guidelines and Jest tests, with a coverage flag in the test script.
For help, the README points to the documentation site, GitHub discussions, issues and a Discord invite, and an important note offers the author's WeChat for technical questions and invites you to modify the code freely. The build scripts run lint and tests before publishing, so releases pass those checks first.
Editorial conclusion
iztro suits developers who need Zi Wei Dou Shu charts computed in JavaScript or TypeScript, with querying across palaces, stars and time periods, and who may want to adjust school-specific rules through configuration and plugins. It does not suit anyone who expects the npm package to include AI interpretation or Qimen charts, because those come from separate hosted models that need an API key. Check which Zi Wei school your users follow before trusting the default four transformations and star brightness.
Frequently asked questions
What is iztro?
iztro is a lightweight, multi-language JavaScript library for generating Zi Wei Dou Shu astrolabes from a birth date, time and gender. It is MIT licensed and available on npm.
How do I install iztro?
Run npm install iztro -S, yarn add iztro or pnpm install iztro -S. For static HTML pages, download iztro-min-js.tar.gz from the release assets and load the minified file with a script tag.
Does the iztro package include AI interpretation?
No. The npm package is the open source charting library. The AI models are hosted services reached through a Chat API or an Agents SDK, and they need an API key.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/sylarlong-iztro)Star history chart for your README
[](https://hysenlabs.com/projects/sylarlong-iztro)Was this useful?