# ninjvalenz/ninjpurnima architecture

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

- Interactive diagram: https://gitdiagram.com/ninjvalenz/ninjpurnima
- Repository: https://github.com/ninjvalenz/ninjpurnima

## Overview

Ninj Purnima is a cross-platform full-moon tracker. The primary workflow starts on the home tab, loads moon data through the moon service, and displays the current phase, next-full-moon countdown, rise/set times, and cache or connectivity status; users can request a refresh. The service can use cached data, fetch WeatherAPI data, or fall back to an offline estimate. The repository also includes an Explore example screen and shared themed UI. Service details come from a partial excerpt, so connections not shown there are omitted.

Main entry points: [`app/(tabs)/explore.tsx`](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/explore.tsx) (Explore screen), [`components/ui/collapsible.tsx`](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/ui/collapsible.tsx) (Collapsible panel), [`app/(tabs)/_layout.tsx`](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/_layout.tsx) (Tab navigation), [`hooks/use-theme-color.ts`](https://github.com/ninjvalenz/ninjpurnima/blob/main/hooks/use-theme-color.ts) (Theme color hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_tabs["Tab navigation<br/>[_layout.tsx]"]
  node_home["Moon tracker<br/>[index.tsx]"]
  node_explore["Explore screen<br/>[explore.tsx]"]
  node_root["Root layout<br/>[_layout.tsx]"]
  node_modal["Modal screen<br/>[modal.tsx]"]
end

subgraph group_moon["Moon data"]
  node_service["Moon data service<br/>[moonService.ts]"]
  node_weather["WeatherAPI"]
  node_cache[("AsyncStorage cache")]
  node_moon_types["Moon data types<br/>[moon.ts]"]
end

subgraph group_ui["Shared UI"]
  node_parallax["Parallax scroll view"]
  node_collapsible["Collapsible panel<br/>[collapsible.tsx]"]
  node_external_link["External link<br/>[external-link.tsx]"]
  node_haptic_tab["Haptic tab<br/>[haptic-tab.tsx]"]
  node_themed_text["Themed text<br/>[themed-text.tsx]"]
  node_themed_view["Themed view<br/>[themed-view.tsx]"]
  node_icon["Icon symbols<br/>[icon-symbol.tsx]"]
  node_hello_wave["Hello wave<br/>[hello-wave.tsx]"]
end

subgraph group_theme["Theme system"]
  node_theme_hook["Theme color hook<br/>[use-theme-color.ts]"]
  node_color_scheme["Color scheme hook"]
  node_theme_constants["Theme constants<br/>[theme.ts]"]
end

node_user(("App user"))

node_user -->|"opens"| node_home
node_home -->|"loads or refreshes"| node_service
node_service -->|"fetches astronomy"| node_weather
node_service -->|"reads and writes"| node_cache
node_service -->|"uses data types"| node_moon_types
node_home -->|"renders typed data"| node_moon_types
node_user -->|"selects tab"| node_tabs
node_tabs -->|"routes to"| node_home
node_tabs -->|"routes to"| node_explore
node_explore -->|"renders"| node_parallax
node_explore -->|"renders"| node_collapsible
node_explore -->|"renders"| node_external_link
node_explore -->|"renders"| node_themed_text
node_explore -->|"renders"| node_themed_view
node_explore -->|"renders"| node_icon
node_parallax -->|"renders"| node_themed_view
node_parallax -->|"reads theme color"| node_theme_hook
node_parallax -->|"reads scheme"| node_color_scheme
node_collapsible -->|"renders"| node_themed_text
node_collapsible -->|"renders"| node_themed_view
node_collapsible -->|"renders"| node_icon
node_collapsible -->|"reads colors"| node_theme_constants
node_collapsible -->|"reads scheme"| node_color_scheme
node_themed_text -->|"reads text color"| node_theme_hook
node_themed_view -->|"reads background color"| node_theme_hook
node_theme_hook -->|"reads scheme"| node_color_scheme
node_theme_hook -->|"selects palette"| node_theme_constants
node_tabs -->|"uses tab button"| node_haptic_tab
node_tabs -->|"uses tab icons"| node_icon
node_root -->|"reads scheme"| node_color_scheme
node_modal -->|"renders"| node_themed_text
node_modal -->|"renders"| node_themed_view

click node_tabs "https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/_layout.tsx"
click node_home "https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/index.tsx"
click node_explore "https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/explore.tsx"
click node_root "https://github.com/ninjvalenz/ninjpurnima/blob/main/app/_layout.tsx"
click node_modal "https://github.com/ninjvalenz/ninjpurnima/blob/main/app/modal.tsx"
click node_service "https://github.com/ninjvalenz/ninjpurnima/blob/main/services/moonService.ts"
click node_moon_types "https://github.com/ninjvalenz/ninjpurnima/blob/main/types/moon.ts"
click node_parallax "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/parallax-scroll-view.tsx"
click node_collapsible "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/ui/collapsible.tsx"
click node_external_link "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/external-link.tsx"
click node_haptic_tab "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/haptic-tab.tsx"
click node_themed_text "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/themed-text.tsx"
click node_themed_view "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/themed-view.tsx"
click node_icon "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/ui/icon-symbol.tsx"
click node_hello_wave "https://github.com/ninjvalenz/ninjpurnima/blob/main/components/hello-wave.tsx"
click node_theme_hook "https://github.com/ninjvalenz/ninjpurnima/blob/main/hooks/use-theme-color.ts"
click node_color_scheme "https://github.com/ninjvalenz/ninjpurnima/blob/main/hooks/use-color-scheme.ts"
click node_theme_constants "https://github.com/ninjvalenz/ninjpurnima/blob/main/constants/theme.ts"

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_tabs,node_home,node_explore,node_root,node_modal,node_user toneBlue
class node_service,node_weather,node_cache,node_moon_types toneAmber
class node_parallax,node_collapsible,node_external_link,node_haptic_tab,node_themed_text,node_themed_view,node_icon,node_hello_wave toneMint
class node_theme_hook,node_color_scheme,node_theme_constants toneRose
```

## Components

### App experience

- [Tab navigation](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/_layout.tsx): `app/(tabs)/_layout.tsx`
- [Moon tracker](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Explore screen](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/(tabs)/explore.tsx): `app/(tabs)/explore.tsx`
- [Root layout](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/_layout.tsx): `app/_layout.tsx`
- [Modal screen](https://github.com/ninjvalenz/ninjpurnima/blob/main/app/modal.tsx): `app/modal.tsx`

### Moon data

- [Moon data service](https://github.com/ninjvalenz/ninjpurnima/blob/main/services/moonService.ts): `services/moonService.ts`
- **WeatherAPI**
- **AsyncStorage cache**
- [Moon data types](https://github.com/ninjvalenz/ninjpurnima/blob/main/types/moon.ts): `types/moon.ts`

### Shared UI

- [Parallax scroll view](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/parallax-scroll-view.tsx): `components/parallax-scroll-view.tsx`
- [Collapsible panel](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/ui/collapsible.tsx): `components/ui/collapsible.tsx`
- [External link](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/external-link.tsx): `components/external-link.tsx`
- [Haptic tab](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/haptic-tab.tsx): `components/haptic-tab.tsx`
- [Themed text](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/themed-text.tsx): `components/themed-text.tsx`
- [Themed view](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/themed-view.tsx): `components/themed-view.tsx`
- [Icon symbols](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/ui/icon-symbol.tsx): `components/ui/icon-symbol.tsx`
- [Hello wave](https://github.com/ninjvalenz/ninjpurnima/blob/main/components/hello-wave.tsx): `components/hello-wave.tsx`

### Theme system

- [Theme color hook](https://github.com/ninjvalenz/ninjpurnima/blob/main/hooks/use-theme-color.ts): `hooks/use-theme-color.ts`
- [Color scheme hook](https://github.com/ninjvalenz/ninjpurnima/blob/main/hooks/use-color-scheme.ts): `hooks/use-color-scheme.ts`
- [Theme constants](https://github.com/ninjvalenz/ninjpurnima/blob/main/constants/theme.ts): `constants/theme.ts`

### Other components

- **App user**

## Connections

- App user → Moon tracker: opens (evidence: `app/(tabs)/index.tsx`)
- Moon tracker → Moon data service: loads or refreshes (evidence: `app/(tabs)/index.tsx`)
- Moon data service → WeatherAPI: fetches astronomy (evidence: `services/moonService.ts`)
- Moon data service → AsyncStorage cache: reads and writes (evidence: `services/moonService.ts`)
- Moon data service → Moon data types: uses data types (evidence: `services/moonService.ts`)
- Moon tracker → Moon data types: renders typed data (evidence: `app/(tabs)/index.tsx`)
- App user → Tab navigation: selects tab (evidence: `app/(tabs)/_layout.tsx`)
- Tab navigation → Moon tracker: routes to (evidence: `app/(tabs)/_layout.tsx`)
- Tab navigation → Explore screen: routes to (evidence: `app/(tabs)/_layout.tsx`)
- Explore screen → Parallax scroll view: renders (evidence: `app/(tabs)/explore.tsx`)
- Explore screen → Collapsible panel: renders (evidence: `app/(tabs)/explore.tsx`)
- Explore screen → External link: renders (evidence: `app/(tabs)/explore.tsx`)
- Explore screen → Themed text: renders (evidence: `app/(tabs)/explore.tsx`)
- Explore screen → Themed view: renders (evidence: `app/(tabs)/explore.tsx`)
- Explore screen → Icon symbols: renders (evidence: `app/(tabs)/explore.tsx`)
- Parallax scroll view → Themed view: renders (evidence: `components/parallax-scroll-view.tsx`)
- Parallax scroll view → Theme color hook: reads theme color (evidence: `components/parallax-scroll-view.tsx`)
- Parallax scroll view → Color scheme hook: reads scheme (evidence: `components/parallax-scroll-view.tsx`)
- Collapsible panel → Themed text: renders (evidence: `components/ui/collapsible.tsx`)
- Collapsible panel → Themed view: renders (evidence: `components/ui/collapsible.tsx`)
- Collapsible panel → Icon symbols: renders (evidence: `components/ui/collapsible.tsx`)
- Collapsible panel → Theme constants: reads colors (evidence: `components/ui/collapsible.tsx`)
- Collapsible panel → Color scheme hook: reads scheme (evidence: `components/ui/collapsible.tsx`)
- Themed text → Theme color hook: reads text color (evidence: `components/themed-text.tsx`)
- Themed view → Theme color hook: reads background color (evidence: `components/themed-view.tsx`)
- Theme color hook → Color scheme hook: reads scheme (evidence: `hooks/use-theme-color.ts`)
- Theme color hook → Theme constants: selects palette (evidence: `hooks/use-theme-color.ts`)
- Tab navigation → Haptic tab: uses tab button (evidence: `app/(tabs)/_layout.tsx`)
- Tab navigation → Icon symbols: uses tab icons (evidence: `app/(tabs)/_layout.tsx`)
- Root layout → Color scheme hook: reads scheme (evidence: `app/_layout.tsx`)
- Modal screen → Themed text: renders (evidence: `app/modal.tsx`)
- Modal screen → Themed view: renders (evidence: `app/modal.tsx`)
