# miounet11/life-kline architecture

> Architecture diagram of the GitHub repository miounet11/life-kline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miounet11/life-kline
- Repository: https://github.com/miounet11/life-kline

## Overview

Life K-Line turns birth details into a BaZi reading, AI interpretation, and life-timeline K-line visualization. The main documented journey runs from the home form through chart calculation and AI analysis to the report and chart; the application also provides fortunes, profiles, celebrity cases, knowledge, community, and account/pricing features. The README supports the high-level analysis flow, while sampled source confirms selected database, caching, profile, and UI relationships. Several feature modules were not sampled, so their internal connections are omitted.

Main entry points: [`App.tsx`](https://github.com/miounet11/life-kline/blob/main/App.tsx) (Application routes), [`server/database.js`](https://github.com/miounet11/life-kline/blob/main/server/database.js) (Application database), [`server/coreDocumentEngine.js`](https://github.com/miounet11/life-kline/blob/main/server/coreDocumentEngine.js) (Core document), [`services/geminiService.ts`](https://github.com/miounet11/life-kline/blob/main/services/geminiService.ts) (AI analysis API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and analysis"]
  node_app["Application routes<br/>[App.tsx]"]
  node_home["Birth input<br/>[HomePage.tsx]"]
  node_form["BaZi form<br/>[BaziForm.tsx]"]
  node_result["Analysis report"]
end

subgraph group_engine["Analysis engine"]
  node_chartcalc["Pillar calculation<br/>[baziCalculator.js]"]
  node_analysis["AI analysis API<br/>[geminiService.ts]"]
  node_unified["Unified analyzer<br/>[unifiedAnalyzer.js]"]
  node_core["Core document"]
  node_cache[("Analysis cache<br/>[cacheManager.js]")]
end

subgraph group_insights["Destiny insights"]
  node_kline["Life K-line charts<br/>[LifeKLineChart.tsx]"]
  node_fortune["Fortune features<br/>[DailyFortune.tsx]"]
  node_cases["Celebrity cases<br/>[CasesLibrary.tsx]"]
  node_similarity["BaZi similarity"]
end

subgraph group_community["Content and community"]
  node_knowledge["Knowledge hub<br/>[KnowledgeHub.tsx]"]
  node_search["Content search<br/>[SearchPage.tsx]"]
  node_feed["Community feed<br/>[index.tsx]"]
end

subgraph group_account["Accounts and operations"]
  node_database[("Application database<br/>[database.js]")]
  node_profiles["Profile management<br/>[ProfileManager.tsx]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_points["Points management<br/>[pointsManager.js]"]
  node_pricing["Pricing management<br/>[pricingManager.js]"]
  node_email["Email subscriptions"]
end

node_user(("User"))
node_model{{"AI model service"}}

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_home -.->|"collects birth data"| node_form
node_form -.->|"submits birth details"| node_chartcalc
node_chartcalc -.->|"provides BaZi data"| node_analysis
node_analysis -.->|"requests analysis"| node_unified
node_unified -.->|"queries model"| node_model
node_analysis -.->|"streams results"| node_result
node_result -.->|"renders timeline"| node_kline
node_core -->|"calculates timeline"| node_chartcalc
node_core -->|"reads and writes"| node_cache
node_core -->|"updates profiles"| node_database
node_cache -->|"persists cache"| node_database
node_pricing -->|"reads and writes"| node_database
node_points -->|"uses database"| node_database
node_app -->|"routes to"| node_fortune
node_app -->|"routes to"| node_profiles
node_app -->|"routes to"| node_cases
node_cases -.->|"compares charts"| node_similarity
node_app -->|"routes to"| node_knowledge
node_app -->|"routes to"| node_search
node_app -.->|"routes to"| node_feed
node_app -.->|"authenticates"| node_auth
node_app -.->|"offers subscriptions"| node_email
node_pricing -->|"stores pricing"| node_database

click node_app "https://github.com/miounet11/life-kline/blob/main/App.tsx"
click node_home "https://github.com/miounet11/life-kline/blob/main/pages/HomePage.tsx"
click node_form "https://github.com/miounet11/life-kline/blob/main/components/BaziForm.tsx"
click node_chartcalc "https://github.com/miounet11/life-kline/blob/main/server/baziCalculator.js"
click node_analysis "https://github.com/miounet11/life-kline/blob/main/services/geminiService.ts"
click node_unified "https://github.com/miounet11/life-kline/blob/main/server/unifiedAnalyzer.js"
click node_core "https://github.com/miounet11/life-kline/blob/main/server/coreDocumentEngine.js"
click node_cache "https://github.com/miounet11/life-kline/blob/main/server/cacheManager.js"
click node_database "https://github.com/miounet11/life-kline/blob/main/server/database.js"
click node_result "https://github.com/miounet11/life-kline/blob/main/components/ProgressiveAnalysisResult.tsx"
click node_kline "https://github.com/miounet11/life-kline/blob/main/components/LifeKLineChart.tsx"
click node_fortune "https://github.com/miounet11/life-kline/blob/main/components/fortune/DailyFortune.tsx"
click node_profiles "https://github.com/miounet11/life-kline/blob/main/components/profile/ProfileManager.tsx"
click node_cases "https://github.com/miounet11/life-kline/blob/main/pages/CasesLibrary.tsx"
click node_similarity "https://github.com/miounet11/life-kline/blob/main/services/baziSimilarityService.ts"
click node_knowledge "https://github.com/miounet11/life-kline/blob/main/pages/KnowledgeHub.tsx"
click node_search "https://github.com/miounet11/life-kline/blob/main/pages/SearchPage.tsx"
click node_feed "https://github.com/miounet11/life-kline/blob/main/components/feed/index.tsx"
click node_auth "https://github.com/miounet11/life-kline/blob/main/server/auth.js"
click node_points "https://github.com/miounet11/life-kline/blob/main/server/pointsManager.js"
click node_pricing "https://github.com/miounet11/life-kline/blob/main/server/pricingManager.js"
click node_email "https://github.com/miounet11/life-kline/blob/main/components/email/EmailSubscriptionManager.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_app,node_home,node_form,node_result,node_user toneBlue
class node_chartcalc,node_analysis,node_unified,node_core,node_cache toneAmber
class node_kline,node_fortune,node_cases,node_similarity toneMint
class node_knowledge,node_search,node_feed toneRose
class node_database,node_profiles,node_auth,node_points,node_pricing,node_email,node_model toneIndigo
```

## Components

### App and analysis

- [Application routes](https://github.com/miounet11/life-kline/blob/main/App.tsx): `App.tsx`
- [Birth input](https://github.com/miounet11/life-kline/blob/main/pages/HomePage.tsx): `pages/HomePage.tsx`
- [BaZi form](https://github.com/miounet11/life-kline/blob/main/components/BaziForm.tsx): `components/BaziForm.tsx`
- [Analysis report](https://github.com/miounet11/life-kline/blob/main/components/ProgressiveAnalysisResult.tsx): `components/ProgressiveAnalysisResult.tsx`

### Analysis engine

- [Pillar calculation](https://github.com/miounet11/life-kline/blob/main/server/baziCalculator.js): `server/baziCalculator.js`
- [AI analysis API](https://github.com/miounet11/life-kline/blob/main/services/geminiService.ts): `services/geminiService.ts`
- [Unified analyzer](https://github.com/miounet11/life-kline/blob/main/server/unifiedAnalyzer.js): `server/unifiedAnalyzer.js`
- [Core document](https://github.com/miounet11/life-kline/blob/main/server/coreDocumentEngine.js): `server/coreDocumentEngine.js`
- [Analysis cache](https://github.com/miounet11/life-kline/blob/main/server/cacheManager.js): `server/cacheManager.js`

### Destiny insights

- [Life K-line charts](https://github.com/miounet11/life-kline/blob/main/components/LifeKLineChart.tsx): `components/LifeKLineChart.tsx`
- [Fortune features](https://github.com/miounet11/life-kline/blob/main/components/fortune/DailyFortune.tsx): `components/fortune/DailyFortune.tsx`
- [Celebrity cases](https://github.com/miounet11/life-kline/blob/main/pages/CasesLibrary.tsx): `pages/CasesLibrary.tsx`
- [BaZi similarity](https://github.com/miounet11/life-kline/blob/main/services/baziSimilarityService.ts): `services/baziSimilarityService.ts`

### Content and community

- [Knowledge hub](https://github.com/miounet11/life-kline/blob/main/pages/KnowledgeHub.tsx): `pages/KnowledgeHub.tsx`
- [Content search](https://github.com/miounet11/life-kline/blob/main/pages/SearchPage.tsx): `pages/SearchPage.tsx`
- [Community feed](https://github.com/miounet11/life-kline/blob/main/components/feed/index.tsx): `components/feed/index.tsx`

### Accounts and operations

- [Application database](https://github.com/miounet11/life-kline/blob/main/server/database.js): `server/database.js`
- [Profile management](https://github.com/miounet11/life-kline/blob/main/components/profile/ProfileManager.tsx): `components/profile/ProfileManager.tsx`
- [Authentication](https://github.com/miounet11/life-kline/blob/main/server/auth.js): `server/auth.js`
- [Points management](https://github.com/miounet11/life-kline/blob/main/server/pointsManager.js): `server/pointsManager.js`
- [Pricing management](https://github.com/miounet11/life-kline/blob/main/server/pricingManager.js): `server/pricingManager.js`
- [Email subscriptions](https://github.com/miounet11/life-kline/blob/main/components/email/EmailSubscriptionManager.tsx): `components/email/EmailSubscriptionManager.tsx`

### Other components

- **User**
- **AI model service**

## Connections

- User → Application routes: opens
- Application routes → Birth input: routes to (evidence: `App.tsx`)
- Birth input → BaZi form: collects birth data
- BaZi form → Pillar calculation: submits birth details
- Pillar calculation → AI analysis API: provides BaZi data
- AI analysis API → Unified analyzer: requests analysis
- Unified analyzer → AI model service: queries model
- AI analysis API → Analysis report: streams results
- Analysis report → Life K-line charts: renders timeline
- Core document → Pillar calculation: calculates timeline (evidence: `server/coreDocumentEngine.js`)
- Core document → Analysis cache: reads and writes (evidence: `server/coreDocumentEngine.js`)
- Core document → Application database: updates profiles (evidence: `server/coreDocumentEngine.js`)
- Analysis cache → Application database: persists cache (evidence: `server/cacheManager.js`)
- Pricing management → Application database: reads and writes (evidence: `server/pricingManager.js`)
- Points management → Application database: uses database (evidence: `server/pointsManager.js`)
- Application routes → Fortune features: routes to (evidence: `App.tsx`)
- Application routes → Profile management: routes to (evidence: `App.tsx`)
- Application routes → Celebrity cases: routes to (evidence: `App.tsx`)
- Celebrity cases → BaZi similarity: compares charts
- Application routes → Knowledge hub: routes to (evidence: `App.tsx`)
- Application routes → Content search: routes to (evidence: `App.tsx`)
- Application routes → Community feed: routes to
- Application routes → Authentication: authenticates
- Application routes → Email subscriptions: offers subscriptions
- Pricing management → Application database: stores pricing (evidence: `server/pricingManager.js`)
