How renhuai123/ziwei-doushu works
This repository is an open-source Ziwei astrology charting engine with a small demo website and reference libraries. The main user workflow is entering birth details, generating a chart, then viewing its palaces, time-period navigation, and interpretation. Separate routes provide a two-person chart demo, star/topic knowledge pages, and searchable classical texts. The README documents supporting time and school-configuration capabilities, but their runtime wiring is not fully sampled; those links are marked unverified where appropriate.
Main entry points: algorithm.ts Chart generation · chart/page.tsx Chart demo · heming/page.tsx Pair chart demo · BirthForm.tsx Birth form
Components 26
Chart experience
- Chart demo
app/chart/page.tsx - Birth form
components/BirthForm.tsx - Chart board
components/ChartBoard.tsx - Insight panel
components/InsightPanel.tsx - Time navigation
components/TimeNav.tsx - Pair chart demo
app/heming/page.tsx
Chart engine
- Chart generation
lib/ziwei/algorithm.ts - Chart data model
lib/ziwei/types.ts - School brightness data
lib/ziwei/school-data.ts - School configuration
lib/ziwei/school-config.ts - Time adjustment
lib/ziwei/true-solar-time.ts - Lunar conversion
lib/ziwei/lunar-solar.ts - China DST rules
lib/ziwei/dst-cn.ts - Clock adjustment
lib/ziwei/clock-adjust.ts
Knowledge and texts
- Star knowledge pages
app/knowledge/[star]/[topic]/page.tsx - Knowledge content
lib/seo/knowledge.ts - Star analysis data
lib/ziwei/db-analysis.ts - Classical text pages
app/library/page.tsx - Classical text search
app/library/search/page.tsx - Classics catalog and API
lib/classics/index.ts - Classical texts
lib/classics/data/quanshu.ts - Ni Haixia materials
lib/nihai/index.ts
Site experience
- Home page
app/page.tsx - Theme provider
components/ThemeProvider.tsx - Site configuration
lib/site.ts
Other components
- Visitor
Connections 28
- Visitor → Chart demo: opens chart
app/chart/page.tsx - Chart demo → Birth form: renders form
app/chart/page.tsx - Birth form → Chart demo: submits details
app/chart/page.tsx - Chart demo → Chart generation: generates chart
app/chart/page.tsx - Chart generation → Chart demo: returns chart
app/chart/page.tsx - Chart demo → Chart board: renders chart
app/chart/page.tsx - Chart demo → Insight panel: renders insight
app/chart/page.tsx - Chart demo → Time navigation: renders navigation
app/chart/page.tsx - Visitor → Pair chart demo: opens pair demo
app/heming/page.tsx - Pair chart demo → Birth form: renders forms
app/heming/page.tsx - Pair chart demo → Chart generation: generates pair
app/heming/page.tsx - Chart generation → School brightness data: reads brightness
lib/ziwei/algorithm.ts - Chart generation → School configuration: uses configuration
lib/ziwei/algorithm.ts - Chart generation → Time adjustment: supports correction
README.md - Chart generation → Lunar conversion: supports conversion
README.md - Chart generation → China DST rules: uses DST rules
README.md - Chart generation → Clock adjustment: supports adjustment
README.md - Visitor → Star knowledge pages: opens knowledge
app/knowledge/[star]/[topic]/page.tsx - Star knowledge pages → Knowledge content: gets content
app/knowledge/[star]/[topic]/page.tsx - Knowledge content → Star analysis data: reads analysis
lib/seo/knowledge.ts - Visitor → Classical text pages: browses texts
app/library/page.tsx - Visitor → Classical text search: searches texts
app/library/search/page.tsx - Classical text pages → Classics catalog and API: loads catalog
app/library/page.tsx - Classical text search → Classics catalog and API: searches catalog
app/library/search/page.tsx - Classics catalog and API → Classical texts: loads text data
lib/classics/index.ts - Visitor → Home page: opens site
app/page.tsx - Home page → Theme provider: reads theme
app/page.tsx - Ni Haixia materials → Visitor: provides study data