# oris7767/chiem-tinh-ve-dic architecture

> Architecture diagram of the GitHub repository oris7767/chiem-tinh-ve-dic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oris7767/chiem-tinh-ve-dic
- Repository: https://github.com/oris7767/chiem-tinh-ve-dic

## Overview

1. **Overall shape**
   - This is a **Vite + React + TypeScript** single-page application with a largely client-rendered architecture.
   - The repo is split into feature pages, reusable UI components, domain-specific calculation logic, and a small Supabase backend layer.

2. **App shell and routing**
   - `src/main.tsx`, `src/App.tsx`, and `src/pages/*` form the top-level navigation structure.
   - Pages cover the main product areas: home/landing, Vedic chart, Panchang, numerology, Luc Nham, trading view, blog, login/admin, and a not-found route.
   - `src/components/NavBar.tsx`, `MobileMenu.tsx`, `Footer.tsx`, `Breadcrumbs.tsx`, and `SEO.tsx` provide the global page chrome and metadata.

3. **Feature boundaries**
   - The app is organized by domain rather than by technical layer.
   - Major feature groups are:
     - **Vedic astrology**: `src/components/VedicAstrology/*`, `src/services/vedicAstroService.ts`, `src/services/birthChartService.ts`
     - **Panchang**: `src/components/panchang/*`, `src/hooks/usePanchang.ts`, `src/services/panchangService.ts`
     - **Numerology**: `src/pages/NumerologyPage.tsx`, `src/pages/NumerologyAdminPage.tsx`, and multiple calculation/meaning utilities under `src/utils/*`
     - **Luc Nham**: `src/pages/LucNhamPage.tsx`, `src/utils/lucNhamEngine.ts`, `src/utils/lucNhamPersonalLogic.ts`, and `src/data/lucNham/*`
     - **Blog/admin**: `src/pages/Blog*`, `src/components/blog/*`, `src/context/BlogContext.tsx`

4. **Data flow in the astrology features**
   - User input starts in form components such as `BirthChartForm.tsx`, `LocationSelector.tsx`, and `AuthForms.tsx`.
   - Calculation logic is then handled in service/util layers, especially `birthChartService.ts`, `vedicAstroService.ts`, and `src/utils/vedicAstrology/*`.
   - Results are rendered as charts and tables (`VedicChart.tsx`, `SouthIndianChart.tsx`, `PlanetDetailsTable.tsx`, `HouseDetailsTable.tsx`, `DashaCalculator.tsx`, etc.).
   - This keeps input collection, computation, and presentation separated.

5. **Panchang and transit pipeline**
   - Panchang-related pages use hooks and services to fetch or derive calendar/astronomical data.
   - `usePanchang.ts`, `useTransits.ts`, and `panchangService.ts` feed components like `SolarEvents.tsx`, `LunarInfo.tsx`, `PlanetaryTransits.tsx`, and `AstrologicalInfo.tsx`.
   - `src/mocks/panchangMock.ts` suggests a local fallback/mock path for development or offline use.

6. **Numerology and Luc Nham are mostly local computation**
   - Numerology logic lives in utility modules such as `numerologyCalculator.ts`, `numberDetailedMeanings/*`, `careerMeanings.ts`, `relationshipMeanings.ts`, and `strengthsAndChallenges.ts`.
   - Luc Nham is similarly self-contained, with rule/interpretation data in `src/data/lucNham/*` and engine logic in `src/utils/lucNhamEngine.ts`.
   - These features appear to be computed on the client from local rule sets rather than relying on a backend API.

7. **Blog and admin subsystem**
   - Blog UI is split between public display pages (`BlogPage.tsx`, `BlogPostPage.tsx`) and admin/auth flows (`BlogLoginPage.tsx`, `NumerologyAdminPage.tsx`, `SubscribersAdminPage.tsx`).
   - Context providers (`BlogContext.tsx`, `SubscriberContext.tsx`) likely manage shared state and persistence for posts/subscribers.
   - The blog feature uses its own component set (`PostForm.tsx`, `PostsList.tsx`, `PostHeader.tsx`, etc.), indicating a separate content-management boundary inside the app.

8. **Backend and serverless functions**
   - The only clear backend integration is **Supabase**: `src/integrations/supabase/*` plus `supabase/`.
   - Supabase edge functions support:
     - `calculate-vedic-chart`
     - `send-email-verification`
     - `auth-email-handler`
   - This means the app is not purely static; some operations, especially chart calculation or email/auth workflows, are delegated to server-side functions.

9. **Shared UI and design system**
   - `src/components/ui/*` is a shadcn-style component library used across all feature areas.
   - These primitives provide the consistent interaction layer for forms, dialogs, tables, tabs, dropdowns, toasts, and navigation.
   - `src/lib/utils.ts`, `src/lib/schemas.ts`, and `src/hooks/use-toast.ts` support common UI behavior and validation.

10. **Internationalization and content data**
   - The app has bilingual content support through `src/locales/en.json`, `src/locales/vi.json`, and `src/context/LanguageContext.tsx`.
   - Shared i18n helpers live in `src/utils/i18n.ts`.
   - Static/content-heavy assets are stored in `public/` and `src/data/*`, including images, videos, PDFs, localized meanings, and exportable resources.

11. **Charts, exports, and media**
   - Charting is a first-class presentation layer: `TradingViewChart.tsx`, `AdvancedTradingViewChart.tsx`, and `src/components/ui/chart.tsx`.
   - There are helper utilities for exporting images/SVGs: `imageExportUtils.ts` and `svgExportUtils.ts`.
   - The presence of `public/videos/diya-flame.mp4`, `public/images`, and `lovable-uploads` indicates heavy use of static media in the UI.

12. **SEO, sitemap, and deployment**
   - SEO is treated explicitly via `SEO.tsx`, `src/utils/seo.tsx`, `src/api/sitemap.ts`, and `src/utils/sitemap.ts`, with `public/robots.txt` and `public/sitemap.xml`.
   - Deployment is configured for static hosting with Netlify (`netlify.toml` and `public/_redirects`), while `vite.config.ts` and Tailwind config files define the build/tooling layer.
   - The architecture is therefore: mostly static client app, with Supabase for backend capabilities and Netlify for hosting/routing.

Main entry points: [`src/pages`](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/pages) (Pages), [`src/App.tsx`](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/App.tsx) (App), [`src/services`](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/services) (Astro Services), [`src/services/panchangService.ts`](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/services/panchangService.ts) (Panchang Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app_shell["App Shell"]
  node_main["main.tsx<br/>entry<br/>[main.tsx]"]
  node_app["App<br/>router shell<br/>[App.tsx]"]
  node_pages["Pages<br/>routes"]
  node_chrome["Chrome<br/>layout ui"]
end

subgraph group_vedic_astrology["Vedic Astrology"]
  node_vedic_forms["Input Forms<br/>chart input"]
  node_vedic_calc["Astro Services<br/>calculation service"]
  node_vedic_views["Chart Views<br/>chart ui"]
end

subgraph group_time_features["Panchang & Transits"]
  node_panchang_hooks["Panchang Hooks<br/>data hooks"]
  node_panchang_service["Panchang Service<br/>calendar service<br/>[panchangService.ts]"]
  node_panchang_ui["Panchang Views<br/>calendar ui"]
end

subgraph group_divination["Numerology & Luc Nham"]
  node_numerology_pages["Numerology Pages<br/>feature pages<br/>[NumerologyPage.tsx]"]
  node_numerology_utils["Numerology Logic<br/>rule engine"]
  node_lucnham_page["Luc Nham<br/>feature page<br/>[LucNhamPage.tsx]"]
  node_lucnham_engine["Luc Nham Engine<br/>interpretation engine"]
  node_lucnham_data["Luc Nham Data<br/>domain data"]
end

subgraph group_content_admin["Content & Admin"]
  node_blog_pages["Blog Pages<br/>content pages<br/>[BlogPage.tsx]"]
  node_blog_components["Blog UI<br/>content ui"]
  node_blog_context["Blog State<br/>context"]
end

subgraph group_platform["Platform"]
  node_shared_ui["UI System<br/>component library"]
  node_platform_i18n["Platform Services<br/>shared services"]
  node_supabase["Supabase<br/>backend"]
end

node_main -->|"renders"| node_app
node_app -->|"routes to"| node_pages
node_app -->|"wraps with"| node_chrome
node_pages -->|"uses"| node_vedic_forms
node_vedic_forms -->|"submits input to"| node_vedic_calc
node_vedic_calc -->|"feeds"| node_vedic_views
node_pages -->|"loads"| node_panchang_hooks
node_panchang_hooks -->|"calls"| node_panchang_service
node_panchang_service -->|"drives"| node_panchang_ui
node_pages -->|"contains"| node_numerology_pages
node_numerology_pages -->|"calculates with"| node_numerology_utils
node_pages -->|"contains"| node_lucnham_page
node_lucnham_page -->|"evaluates"| node_lucnham_engine
node_lucnham_engine -->|"reads"| node_lucnham_data
node_pages -->|"contains"| node_blog_pages
node_blog_pages -->|"composes"| node_blog_components
node_blog_components -->|"shares state with"| node_blog_context
node_chrome -->|"built from"| node_shared_ui
node_pages -->|"uses"| node_shared_ui
node_pages -->|"depends on"| node_platform_i18n
node_vedic_calc -->|"integrates with"| node_supabase
node_blog_context -->|"persists via"| node_supabase
node_panchang_service -.->|"may fetch from"| node_supabase

click node_main "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/main.tsx"
click node_app "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/App.tsx"
click node_pages "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/pages"
click node_chrome "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components"
click node_vedic_forms "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/VedicAstrology"
click node_vedic_calc "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/services"
click node_vedic_views "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/VedicAstrology"
click node_panchang_hooks "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/hooks"
click node_panchang_service "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/services/panchangService.ts"
click node_panchang_ui "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/panchang"
click node_numerology_pages "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/NumerologyPage.tsx"
click node_numerology_utils "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils"
click node_lucnham_page "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/LucNhamPage.tsx"
click node_lucnham_engine "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils"
click node_lucnham_data "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/data/lucNham"
click node_blog_pages "https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/BlogPage.tsx"
click node_blog_components "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/blog"
click node_blog_context "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/context"
click node_shared_ui "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/ui"
click node_platform_i18n "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils"
click node_supabase "https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/integrations/supabase"

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_main,node_app,node_pages,node_chrome toneBlue
class node_vedic_forms,node_vedic_calc,node_vedic_views toneAmber
class node_panchang_hooks,node_panchang_service,node_panchang_ui toneMint
class node_numerology_pages,node_numerology_utils,node_lucnham_page,node_lucnham_engine,node_lucnham_data toneRose
class node_blog_pages,node_blog_components,node_blog_context toneIndigo
class node_shared_ui,node_platform_i18n,node_supabase toneTeal
```

## Components

### App Shell

Client entry, routing, chrome, and global page composition.

- [main.tsx](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/main.tsx): entry · Bootstraps the React app. · `src/main.tsx`
- [App](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/App.tsx): router shell · Top-level routing and app composition. · `src/App.tsx`
- [Pages](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/pages): routes · Feature pages for home, charts, content, and admin flows. · `src/pages`
- [Chrome](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components): layout ui · Global navigation, footer, breadcrumbs, and SEO metadata. · `src/components`

### Vedic Astrology

Birth chart flow, calculations, and chart presentation.

- [Input Forms](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/VedicAstrology): chart input · Birth chart and auth/location input capture. · `src/components/VedicAstrology`
- [Astro Services](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/services): calculation service · Birth chart and Vedic astrology computation services. · `src/services`
- [Chart Views](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/VedicAstrology): chart ui · Charts, tables, and result presentation for Vedic astrology. · `src/components/VedicAstrology`

### Panchang & Transits

Calendar, lunar, and transit data pipeline.

- [Panchang Hooks](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/hooks): data hooks · Hooks that fetch and derive Panchang and transit data. · `src/hooks`
- [Panchang Service](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/services/panchangService.ts): calendar service · Calendar and astronomical data source/derivation layer. · `src/services/panchangService.ts`
- [Panchang Views](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/panchang): calendar ui · Solar, lunar, transit, and astrological Panchang displays. · `src/components/panchang`

### Numerology & Luc Nham

Local calculation engines and domain data for divination features.

- [Numerology Pages](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/NumerologyPage.tsx): feature pages · Public and admin numerology entry points. · `src/pages/NumerologyPage.tsx`
- [Numerology Logic](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils): rule engine · Number calculations and meaning lookup utilities. · `src/utils`
- [Luc Nham](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/LucNhamPage.tsx): feature page · Luc Nham user-facing interpretation page. · `src/pages/LucNhamPage.tsx`
- [Luc Nham Engine](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils): interpretation engine · Rule-based Luc Nham calculation and personal logic. · `src/utils`
- [Luc Nham Data](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/data/lucNham): domain data · Rule and interpretation datasets for Luc Nham. · `src/data/lucNham`

### Content & Admin

Blog, subscribers, login, and admin-oriented content flows.

- [Blog Pages](https://github.com/oris7767/chiem-tinh-ve-dic/blob/main/src/pages/BlogPage.tsx): content pages · Public blog and post routes plus login/admin entry points. · `src/pages/BlogPage.tsx`
- [Blog UI](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/blog): content ui · Blog forms, lists, headers, and login UI. · `src/components/blog`
- [Blog State](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/context): context · Shared blog and subscriber state management. · `src/context`

### Platform

Shared UI system, localization, SEO, and backend integration.

- [UI System](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/components/ui): component library · Reusable design-system primitives used across the app. · `src/components/ui`
- [Platform Services](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/utils): shared services · Localization, schemas, SEO, exports, and common helpers. · `src/utils`
- [Supabase](https://github.com/oris7767/chiem-tinh-ve-dic/tree/main/src/integrations/supabase): backend · Client integration and edge functions for auth and chart calculation. · `src/integrations/supabase`

## Connections

- main.tsx → App: renders · App entry mounts the router shell.
- App → Pages: routes to · Top-level routing selects feature pages.
- App → Chrome: wraps with · Global layout and metadata are applied around pages.
- Pages → Input Forms: uses · Astrology pages collect chart input and auth details.
- Input Forms → Astro Services: submits input to · User input drives chart calculation services.
- Astro Services → Chart Views: feeds · Computed chart data is rendered in charts and tables.
- Pages → Panchang Hooks: loads · Panchang pages hydrate from hooks and derived data.
- Panchang Hooks → Panchang Service: calls · Hooks source calendar and astronomical data.
- Panchang Service → Panchang Views: drives · Service output is shown in Panchang components.
- Pages → Numerology Pages: contains · Numerology routes expose public and admin views.
- Numerology Pages → Numerology Logic: calculates with · Client-side numerology calculations power the pages.
- Pages → Luc Nham: contains · Luc Nham page is a dedicated route.
- Luc Nham → Luc Nham Engine: evaluates · Page uses the rule engine for interpretations.
- Luc Nham Engine → Luc Nham Data: reads · Engine is backed by local rules and interpretations.
- Pages → Blog Pages: contains · Blog and admin routes live in the page layer.
- Blog Pages → Blog UI: composes · Blog pages reuse dedicated content-management UI.
- Blog UI → Blog State: shares state with · Blog UI relies on context for content and subscribers.
- Chrome → UI System: built from · Layout and navigation use shared UI primitives.
- Pages → UI System: uses · Feature pages build on the common component library.
- Pages → Platform Services: depends on · Pages use shared localization, SEO, and helper utilities.
- Astro Services → Supabase: integrates with · Backend functions support chart and auth workflows.
- Blog State → Supabase: persists via · Content/admin state is likely backed by Supabase.
- Panchang Service → Supabase: may fetch from · Calendar data can be backed by remote services.
