# sylarlong/react-iztro architecture

> Architecture diagram of the GitHub repository sylarlong/react-iztro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sylarlong/react-iztro
- Repository: https://github.com/sylarlong/react-iztro

## Overview

1. **Repository role**
   - This is a **React component library**, not a standalone app.
   - Its purpose is to render a **Zi Wei Dou Shu astrolabe / star chart** based on the astrology engine from **`iztro`**.
   - The main integration boundary is: **consumer app passes birth and horoscope props into the library; the library returns a fully rendered chart**.

2. **Public entry points**
   - `src/index.ts` is the top-level export surface.
   - Each component folder also has its own `index.ts`, so the package likely supports both **primary top-level usage** and **selective component imports**.
   - The main public component is **`Iztrolabe`**.

3. **Core composition**
   - `Iztrolabe` is the orchestrator for the whole chart.
   - It composes the other UI subsystems into one astrolabe layout:
     - **`Izpalace`** for each palace cell
     - **`IzpalaceCenter`** for the center/overlay controls and indicators
     - **`Izstar`** for star rendering
   - This is the main visual aggregation layer of the repo.

4. **Palace rendering subsystem**
   - `src/Izpalace` contains the component and types for an individual palace.
   - This is the repeating structural unit in the chart, responsible for displaying palace-level information such as names, stems, stars, and state-specific markings.
   - `Izpalace.css` indicates the palace is heavily styled as a visual grid/card element.

5. **Center/interaction subsystem**
   - `src/IzpalaceCenter` contains `IzpalaceCenter.tsx`, plus `Item.tsx` and `Line.tsx`.
   - This subsystem likely renders the chart’s **central control area**, including:
     - period / limit indicators
     - directional or relationship lines
     - interactive items/buttons mentioned in the README
   - It is the chart’s main **dynamic overlay** region rather than a simple static display.

6. **Star rendering subsystem**
   - `src/Izstar` is the star marker/label unit.
   - It has its own type file, which suggests stars are treated as first-class domain entities with structured metadata.
   - This component is reused inside palaces to render star names, highlights, and visual states.

7. **Domain typing and shared config**
   - `src/config/types.ts` and the per-component `*.type.ts` files define the domain model used across the library.
   - This is the repo’s main **internal contract boundary**: chart data, palace props, star props, and locale/config values are kept consistent here.
   - Architecturally, the types layer is important because the UI is driven by a rich astrology domain model rather than generic list/grid data.

8. **Localization layer**
   - `src/locales` contains language packs for:
     - `en-US`
     - `ja-JP`
     - `ko-KR`
     - `vi-VN`
     - `zh-CN`
     - `zh-TW`
   - `src/locales/index.ts` aggregates these strings for lookup.
   - This means the chart UI is designed to be **language-aware** at the component level, not just via external app translation.

9. **Styling and theming**
   - Styling is split across component-scoped CSS files plus `src/theme/default.css`.
   - The architecture is therefore **CSS-driven and themeable**, with a default visual baseline that consumers can override.
   - The README also suggests many UI elements can be shown/hidden or restyled by overriding defaults rather than changing logic.

10. **Data flow**
   - The consumer passes birth and horoscope inputs to `Iztrolabe`.
   - The library uses the underlying astrology model to derive palace/star/limit information.
   - That derived model is then rendered through:
     - palace cells
     - star badges
     - center indicators and lines
     - localized labels
   - So the flow is: **props in → astrolabe model → composed chart UI out**.

11. **Runtime and dependency boundary**
   - This package is a **frontend React/TypeScript library**.
   - It depends on the external **`iztro`** astrology library for the domain calculation layer, while this repository focuses on rendering and UI behavior.
   - There is no sign of backend services, persistence, or network orchestration in this repo.

12. **Development and documentation surface**
   - `.storybook` and `Iztrolabe.stories.tsx` show that **Storybook is the primary local development and visual verification environment**.
   - The repository also includes Babel, TypeScript, and ESLint configs, indicating a library build/quality pipeline rather than an application runtime.
   - `.nojekyll` suggests docs/demo hosting support, likely for GitHub Pages style publication.

13. **How to draw the architecture**
   - Draw one outer boundary for the **consumer app** and one inner boundary for the **react-iztro library**.
   - Inside the library, place:
     - **Iztrolabe** as the top-level coordinator
     - **Izpalace / IzpalaceCenter / Izstar** as the rendering subsystems
     - **locales / theme / types** as shared support layers
   - Show **`iztro`** as the external domain-engine dependency feeding data into the component tree.

Main entry points: [`src/Iztrolabe/Iztrolabe.tsx`](https://github.com/sylarlong/react-iztro/blob/main/src/Iztrolabe/Iztrolabe.tsx) (Iztrolabe), [`src/index.ts`](https://github.com/sylarlong/react-iztro/blob/main/src/index.ts) (Public API), [`src/IzpalaceCenter/IzpalaceCenter.tsx`](https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/IzpalaceCenter.tsx) (IzpalaceCenter), [`src/Izpalace/Izpalace.tsx`](https://github.com/sylarlong/react-iztro/blob/main/src/Izpalace/Izpalace.tsx) (Izpalace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_consumer["Consumer app"]
  node_consumer_app["Consumer app<br/>host"]
end

subgraph group_library["react-iztro"]
  node_index_root["Public API<br/>entrypoint<br/>[index.ts]"]
  node_iztrolabe["Iztrolabe<br/>chart orchestrator<br/>[Iztrolabe.tsx]"]
  node_izpalace["Izpalace<br/>palace view<br/>[Izpalace.tsx]"]
  node_izpalace_center["IzpalaceCenter<br/>center overlay<br/>[IzpalaceCenter.tsx]"]
  node_center_item(("Item<br/>[Item.tsx]"))
  node_center_line(("Line<br/>connector<br/>[Line.tsx]"))
  node_izstar(("Izstar<br/>star marker<br/>[Izstar.tsx]"))
end

subgraph group_support["Shared support"]
  node_palace_types["Palace types<br/>domain types<br/>[Izpalace.type.ts]"]
  node_star_types["Star types<br/>domain types<br/>[Izstar.type.ts]"]
  node_core_types["Config types<br/>domain schema<br/>[types.ts]"]
  node_locales_index["Locales<br/>i18n pack<br/>[index.ts]"]
  node_theme_default["Default theme<br/>theme css<br/>[default.css]"]
end

subgraph group_dev["Dev surface"]
  node_storybook_main["Storybook<br/>dev tool<br/>[main.ts]"]
  node_iztrolabe_story["Iztrolabe story<br/>demo story"]
end

node_iztro_engine["iztro<br/>astrology engine"]

node_consumer_app -->|"props in"| node_iztrolabe
node_iztro_engine -->|"domain data"| node_iztrolabe
node_index_root -->|"exports"| node_iztrolabe
node_index_root -->|"exports"| node_izpalace
node_index_root -->|"exports"| node_izpalace_center
node_index_root -->|"exports"| node_izstar
node_iztrolabe -->|"composes"| node_izpalace
node_iztrolabe -->|"composes"| node_izpalace_center
node_iztrolabe -->|"renders"| node_izstar
node_iztrolabe -->|"localizes"| node_locales_index
node_iztrolabe -->|"styles"| node_theme_default
node_izpalace -->|"typed by"| node_palace_types
node_izstar -->|"typed by"| node_star_types
node_izpalace_center -->|"uses"| node_center_item
node_izpalace_center -->|"uses"| node_center_line
node_iztrolabe_story -->|"shows"| node_iztrolabe
node_storybook_main -->|"loads"| node_iztrolabe_story
node_iztrolabe -.->|"shared schema"| node_core_types

click node_index_root "https://github.com/sylarlong/react-iztro/blob/main/src/index.ts"
click node_iztrolabe "https://github.com/sylarlong/react-iztro/blob/main/src/Iztrolabe/Iztrolabe.tsx"
click node_izpalace "https://github.com/sylarlong/react-iztro/blob/main/src/Izpalace/Izpalace.tsx"
click node_izpalace_center "https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/IzpalaceCenter.tsx"
click node_center_item "https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/Item.tsx"
click node_center_line "https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/Line.tsx"
click node_izstar "https://github.com/sylarlong/react-iztro/blob/main/src/Izstar/Izstar.tsx"
click node_palace_types "https://github.com/sylarlong/react-iztro/blob/main/src/Izpalace/Izpalace.type.ts"
click node_star_types "https://github.com/sylarlong/react-iztro/blob/main/src/Izstar/Izstar.type.ts"
click node_core_types "https://github.com/sylarlong/react-iztro/blob/main/src/config/types.ts"
click node_locales_index "https://github.com/sylarlong/react-iztro/blob/main/src/locales/index.ts"
click node_theme_default "https://github.com/sylarlong/react-iztro/blob/main/src/theme/default.css"
click node_storybook_main "https://github.com/sylarlong/react-iztro/blob/main/.storybook/main.ts"
click node_iztrolabe_story "https://github.com/sylarlong/react-iztro/blob/main/src/Iztrolabe/Iztrolabe.stories.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer_app toneBlue
class node_index_root,node_iztrolabe,node_izpalace,node_izpalace_center,node_center_item,node_center_line,node_izstar toneAmber
class node_palace_types,node_star_types,node_core_types,node_locales_index,node_theme_default toneMint
class node_storybook_main,node_iztrolabe_story toneRose
class node_iztro_engine toneNeutral
```

## Components

### Consumer app

Host application passes birth and horoscope props into the library.

- **Consumer app**: host · Application that supplies birth and horoscope inputs to the chart component.

### react-iztro

React component library that renders the Zi Wei Dou Shu astrolabe.

- [Public API](https://github.com/sylarlong/react-iztro/blob/main/src/index.ts): entrypoint · Top-level package export surface for primary and selective imports. · `src/index.ts`
- [Iztrolabe](https://github.com/sylarlong/react-iztro/blob/main/src/Iztrolabe/Iztrolabe.tsx): chart orchestrator · Main component that composes the full astrolabe layout from domain props. · `src/Iztrolabe/Iztrolabe.tsx`
- [Izpalace](https://github.com/sylarlong/react-iztro/blob/main/src/Izpalace/Izpalace.tsx): palace view · Repeating palace cell component for palace names, stars, stems, and markings. · `src/Izpalace/Izpalace.tsx`
- [IzpalaceCenter](https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/IzpalaceCenter.tsx): center overlay · Central chart area for indicators, controls, and directional overlays. · `src/IzpalaceCenter/IzpalaceCenter.tsx`
- [Item](https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/Item.tsx): center item · Reusable element for interactive or labeled items inside the center overlay. · `src/IzpalaceCenter/Item.tsx`
- [Line](https://github.com/sylarlong/react-iztro/blob/main/src/IzpalaceCenter/Line.tsx): connector · Line element used to draw relationships or directional markers in the center. · `src/IzpalaceCenter/Line.tsx`
- [Izstar](https://github.com/sylarlong/react-iztro/blob/main/src/Izstar/Izstar.tsx): star marker · Star rendering unit used to display star labels and visual states. · `src/Izstar/Izstar.tsx`

### Shared support

Types, locales, and theme assets used across the component tree.

- [Palace types](https://github.com/sylarlong/react-iztro/blob/main/src/Izpalace/Izpalace.type.ts): domain types · Type definitions for palace props and palace-level domain data. · `src/Izpalace/Izpalace.type.ts`
- [Star types](https://github.com/sylarlong/react-iztro/blob/main/src/Izstar/Izstar.type.ts): domain types · Type definitions for star entities and display metadata. · `src/Izstar/Izstar.type.ts`
- [Config types](https://github.com/sylarlong/react-iztro/blob/main/src/config/types.ts): domain schema · Shared chart and configuration types used across the library. · `src/config/types.ts`
- [Locales](https://github.com/sylarlong/react-iztro/blob/main/src/locales/index.ts): i18n pack · Aggregated language packs for chart labels and localized text. · `src/locales/index.ts`
- [Default theme](https://github.com/sylarlong/react-iztro/blob/main/src/theme/default.css): theme css · Baseline theme and styling defaults for the rendered chart. · `src/theme/default.css`

### Dev surface

Storybook and package-level tooling for development and verification.

- [Storybook](https://github.com/sylarlong/react-iztro/blob/main/.storybook/main.ts): dev tool · Visual development and component verification environment. · `.storybook/main.ts`
- [Iztrolabe story](https://github.com/sylarlong/react-iztro/blob/main/src/Iztrolabe/Iztrolabe.stories.tsx): demo story · Storybook entry showcasing the main chart component. · `src/Iztrolabe/Iztrolabe.stories.tsx`

### Other components

- **iztro**: astrology engine · External domain engine that provides astrology calculations and chart data.

## Connections

- Consumer app → Iztrolabe: props in · Birth and horoscope inputs flow from the host application into the chart component.
- iztro → Iztrolabe: domain data · Astrology calculations and chart model data feed the renderer.
- Public API → Iztrolabe: exports · Top-level package surface re-exports the main component.
- Public API → Izpalace: exports · Package surface exposes selective palace imports.
- Public API → IzpalaceCenter: exports · Package surface exposes selective center imports.
- Public API → Izstar: exports · Package surface exposes selective star imports.
- Iztrolabe → Izpalace: composes · The chart is assembled from repeated palace cells.
- Iztrolabe → IzpalaceCenter: composes · The chart uses a central overlay for indicators and interactions.
- Iztrolabe → Izstar: renders · Stars are rendered as part of the composed astrolabe.
- Iztrolabe → Locales: localizes · Labels and UI text are resolved through the locale packs.
- Iztrolabe → Default theme: styles · Default theme provides the baseline visual presentation.
- Izpalace → Palace types: typed by · Palace rendering is driven by palace domain types.
- Izstar → Star types: typed by · Star rendering is driven by star domain types.
- IzpalaceCenter → Item: uses · Center overlay is built from reusable items.
- IzpalaceCenter → Line: uses · Center overlay draws connector lines and relationships.
- Iztrolabe story → Iztrolabe: shows · Storybook demonstrates the main component in isolation.
- Storybook → Iztrolabe story: loads · Storybook configuration includes the chart story.
- Iztrolabe → Config types: shared schema · Shared config and chart types connect the orchestration layer to the rest of the components.
