# jushazen/compleit-app architecture

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

- Interactive diagram: https://gitdiagram.com/jushazen/compleit-app
- Repository: https://github.com/jushazen/compleit-app

## Overview

Compleit is a local-first habit tracker: users review today’s scheduled habits, record completions, create or edit habits, and inspect completion history in a heatmap; they can also change the app theme. The app shell routes between screens and opens the form and theme menu. Context providers hydrate and serialize mutations before persisting habits, completions, and settings. Schedule, date, time, streak, and heatmap logic support the user-facing stages. The README describes only the React Native starter setup, so product capabilities are inferred from the source index and excerpts; unsampled implementation details are not expanded.

Main entry points: [`src/screens/Home.tsx`](https://github.com/jushazen/compleit-app/blob/main/src/screens/Home.tsx) (Today screen), [`src/context/HabitContext.tsx`](https://github.com/jushazen/compleit-app/blob/main/src/context/HabitContext.tsx) (Habit state), [`src/app/AppShell.tsx`](https://github.com/jushazen/compleit-app/blob/main/src/app/AppShell.tsx) (App shell), [`src/logic/schedule.ts`](https://github.com/jushazen/compleit-app/blob/main/src/logic/schedule.ts) (Schedule rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_home["Today screen<br/>[Home.tsx]"]
  node_heatmap_screen["Heatmap screen<br/>[Heatmap.tsx]"]
end

subgraph group_habit["Habit management"]
  node_form["Habit form<br/>[HabitForm.tsx]"]
  node_validation["Form validation<br/>[validation.ts]"]
end

subgraph group_logic["Habit logic"]
  node_transition["Habit transitions<br/>[habitState.ts]"]
  node_queue["Serial queue<br/>[serialQueue.ts]"]
  node_schedule["Schedule rules<br/>[schedule.ts]"]
  node_date["Date utilities<br/>[dateUtils.ts]"]
  node_time["Time utilities<br/>[time.ts]"]
  node_buckets["Today grouping<br/>[buckets.ts]"]
  node_streak["Streak calculation<br/>[streak.ts]"]
  node_heatmap_logic["Heatmap calculation<br/>[heatmap.ts]"]
end

subgraph group_state["State and persistence"]
  node_habit_state["Habit state<br/>[HabitContext.tsx]"]
  node_settings_state["Settings state"]
  node_provider_tree["Provider tree<br/>[ProviderTree.tsx]"]
  node_storage[("Local storage<br/>[storage.ts]")]
  node_types["Habit data types<br/>[types.ts]"]
end

subgraph group_appearance["Appearance"]
  node_theme_menu["Theme menu<br/>[ThemeMenu.tsx]"]
  node_theme_hook["Theme hooks<br/>[useTheme.ts]"]
  node_tokens["Theme tokens<br/>[tokens.ts]"]
end

node_user(("App user"))
node_async_storage[("AsyncStorage")]

node_user -->|"uses"| node_shell
node_shell -->|"routes"| node_home
node_shell -->|"routes"| node_heatmap_screen
node_shell -->|"opens"| node_form
node_shell -->|"opens"| node_theme_menu
node_home -->|"reads and mutates"| node_habit_state
node_home -->|"groups habits"| node_buckets
node_home -->|"dates completion"| node_date
node_home -->|"formats times"| node_time
node_home -->|"uses schedule rules"| node_schedule
node_home -->|"shows streaks"| node_streak
node_heatmap_screen -->|"reads history"| node_habit_state
node_heatmap_screen -->|"builds heatmap"| node_heatmap_logic
node_form -->|"saves habit"| node_habit_state
node_form -->|"validates input"| node_validation
node_form -->|"handles times"| node_time
node_provider_tree -->|"provides"| node_habit_state
node_provider_tree -->|"provides"| node_settings_state
node_habit_state -->|"serializes mutations"| node_queue
node_habit_state -->|"applies transitions"| node_transition
node_habit_state -->|"loads and saves"| node_storage
node_settings_state -->|"serializes writes"| node_queue
node_settings_state -->|"loads and saves"| node_storage
node_storage -->|"reads and writes"| node_async_storage
node_storage -->|"uses data types"| node_types
node_transition -->|"transforms data"| node_types
node_schedule -->|"uses calendar dates"| node_date
node_schedule -->|"sorts by time"| node_time
node_buckets -->|"groups by schedule"| node_schedule
node_buckets -->|"uses dates"| node_date
node_streak -->|"checks due days"| node_schedule
node_streak -->|"uses dates"| node_date
node_heatmap_logic -->|"checks schedule"| node_schedule
node_heatmap_logic -->|"calculates dates"| node_date
node_theme_menu -->|"changes theme"| node_settings_state
node_shell -->|"reads theme"| node_settings_state
node_theme_hook -->|"reads theme"| node_settings_state
node_theme_hook -->|"gets palette"| node_tokens

click node_shell "https://github.com/jushazen/compleit-app/blob/main/src/app/AppShell.tsx"
click node_home "https://github.com/jushazen/compleit-app/blob/main/src/screens/Home.tsx"
click node_heatmap_screen "https://github.com/jushazen/compleit-app/blob/main/src/screens/Heatmap.tsx"
click node_form "https://github.com/jushazen/compleit-app/blob/main/src/screens/HabitForm.tsx"
click node_habit_state "https://github.com/jushazen/compleit-app/blob/main/src/context/HabitContext.tsx"
click node_settings_state "https://github.com/jushazen/compleit-app/blob/main/src/context/SettingsContext.tsx"
click node_provider_tree "https://github.com/jushazen/compleit-app/blob/main/src/context/ProviderTree.tsx"
click node_storage "https://github.com/jushazen/compleit-app/blob/main/src/storage/storage.ts"
click node_types "https://github.com/jushazen/compleit-app/blob/main/src/storage/types.ts"
click node_transition "https://github.com/jushazen/compleit-app/blob/main/src/logic/habitState.ts"
click node_queue "https://github.com/jushazen/compleit-app/blob/main/src/logic/serialQueue.ts"
click node_schedule "https://github.com/jushazen/compleit-app/blob/main/src/logic/schedule.ts"
click node_date "https://github.com/jushazen/compleit-app/blob/main/src/logic/dateUtils.ts"
click node_time "https://github.com/jushazen/compleit-app/blob/main/src/logic/time.ts"
click node_buckets "https://github.com/jushazen/compleit-app/blob/main/src/logic/buckets.ts"
click node_streak "https://github.com/jushazen/compleit-app/blob/main/src/logic/streak.ts"
click node_heatmap_logic "https://github.com/jushazen/compleit-app/blob/main/src/logic/heatmap.ts"
click node_validation "https://github.com/jushazen/compleit-app/blob/main/src/logic/validation.ts"
click node_theme_menu "https://github.com/jushazen/compleit-app/blob/main/src/app/ThemeMenu.tsx"
click node_theme_hook "https://github.com/jushazen/compleit-app/blob/main/src/hooks/useTheme.ts"
click node_tokens "https://github.com/jushazen/compleit-app/blob/main/src/theme/tokens.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_shell,node_home,node_heatmap_screen,node_user toneBlue
class node_form,node_validation,node_async_storage toneAmber
class node_transition,node_queue,node_schedule,node_date,node_time,node_buckets,node_streak,node_heatmap_logic toneMint
class node_habit_state,node_settings_state,node_provider_tree,node_storage,node_types toneRose
class node_theme_menu,node_theme_hook,node_tokens toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/jushazen/compleit-app/blob/main/src/app/AppShell.tsx): `src/app/AppShell.tsx`
- [Today screen](https://github.com/jushazen/compleit-app/blob/main/src/screens/Home.tsx): `src/screens/Home.tsx`
- [Heatmap screen](https://github.com/jushazen/compleit-app/blob/main/src/screens/Heatmap.tsx): `src/screens/Heatmap.tsx`

### Habit management

- [Habit form](https://github.com/jushazen/compleit-app/blob/main/src/screens/HabitForm.tsx): `src/screens/HabitForm.tsx`
- [Form validation](https://github.com/jushazen/compleit-app/blob/main/src/logic/validation.ts): `src/logic/validation.ts`

### Habit logic

- [Habit transitions](https://github.com/jushazen/compleit-app/blob/main/src/logic/habitState.ts): `src/logic/habitState.ts`
- [Serial queue](https://github.com/jushazen/compleit-app/blob/main/src/logic/serialQueue.ts): `src/logic/serialQueue.ts`
- [Schedule rules](https://github.com/jushazen/compleit-app/blob/main/src/logic/schedule.ts): `src/logic/schedule.ts`
- [Date utilities](https://github.com/jushazen/compleit-app/blob/main/src/logic/dateUtils.ts): `src/logic/dateUtils.ts`
- [Time utilities](https://github.com/jushazen/compleit-app/blob/main/src/logic/time.ts): `src/logic/time.ts`
- [Today grouping](https://github.com/jushazen/compleit-app/blob/main/src/logic/buckets.ts): `src/logic/buckets.ts`
- [Streak calculation](https://github.com/jushazen/compleit-app/blob/main/src/logic/streak.ts): `src/logic/streak.ts`
- [Heatmap calculation](https://github.com/jushazen/compleit-app/blob/main/src/logic/heatmap.ts): `src/logic/heatmap.ts`

### State and persistence

- [Habit state](https://github.com/jushazen/compleit-app/blob/main/src/context/HabitContext.tsx): `src/context/HabitContext.tsx`
- [Settings state](https://github.com/jushazen/compleit-app/blob/main/src/context/SettingsContext.tsx): `src/context/SettingsContext.tsx`
- [Provider tree](https://github.com/jushazen/compleit-app/blob/main/src/context/ProviderTree.tsx): `src/context/ProviderTree.tsx`
- [Local storage](https://github.com/jushazen/compleit-app/blob/main/src/storage/storage.ts): `src/storage/storage.ts`
- [Habit data types](https://github.com/jushazen/compleit-app/blob/main/src/storage/types.ts): `src/storage/types.ts`

### Appearance

- [Theme menu](https://github.com/jushazen/compleit-app/blob/main/src/app/ThemeMenu.tsx): `src/app/ThemeMenu.tsx`
- [Theme hooks](https://github.com/jushazen/compleit-app/blob/main/src/hooks/useTheme.ts): `src/hooks/useTheme.ts`
- [Theme tokens](https://github.com/jushazen/compleit-app/blob/main/src/theme/tokens.ts): `src/theme/tokens.ts`

### Other components

- **App user**
- **AsyncStorage**

## Connections

- App user → App shell: uses (evidence: `src/app/AppShell.tsx`)
- App shell → Today screen: routes (evidence: `src/app/AppShell.tsx`)
- App shell → Heatmap screen: routes (evidence: `src/app/AppShell.tsx`)
- App shell → Habit form: opens (evidence: `src/app/AppShell.tsx`)
- App shell → Theme menu: opens (evidence: `src/app/AppShell.tsx`)
- Today screen → Habit state: reads and mutates (evidence: `src/screens/Home.tsx`)
- Today screen → Today grouping: groups habits (evidence: `src/screens/Home.tsx`)
- Today screen → Date utilities: dates completion (evidence: `src/screens/Home.tsx`)
- Today screen → Time utilities: formats times (evidence: `src/screens/Home.tsx`)
- Today screen → Schedule rules: uses schedule rules (evidence: `src/screens/Home.tsx`)
- Today screen → Streak calculation: shows streaks (evidence: `src/screens/Home.tsx`)
- Heatmap screen → Habit state: reads history (evidence: `src/screens/Heatmap.tsx`)
- Heatmap screen → Heatmap calculation: builds heatmap (evidence: `src/screens/Heatmap.tsx`)
- Habit form → Habit state: saves habit (evidence: `src/screens/HabitForm.tsx`)
- Habit form → Form validation: validates input (evidence: `src/screens/HabitForm.tsx`)
- Habit form → Time utilities: handles times (evidence: `src/screens/HabitForm.tsx`)
- Provider tree → Habit state: provides (evidence: `src/context/ProviderTree.tsx`)
- Provider tree → Settings state: provides (evidence: `src/context/ProviderTree.tsx`)
- Habit state → Serial queue: serializes mutations (evidence: `src/context/HabitContext.tsx`)
- Habit state → Habit transitions: applies transitions (evidence: `src/context/HabitContext.tsx`)
- Habit state → Local storage: loads and saves (evidence: `src/context/HabitContext.tsx`)
- Settings state → Serial queue: serializes writes (evidence: `src/context/SettingsContext.tsx`)
- Settings state → Local storage: loads and saves (evidence: `src/context/SettingsContext.tsx`)
- Local storage → AsyncStorage: reads and writes (evidence: `src/storage/storage.ts`)
- Local storage → Habit data types: uses data types (evidence: `src/storage/storage.ts`)
- Habit transitions → Habit data types: transforms data (evidence: `src/context/HabitContext.tsx`)
- Schedule rules → Date utilities: uses calendar dates (evidence: `src/logic/schedule.ts`)
- Schedule rules → Time utilities: sorts by time (evidence: `src/logic/schedule.ts`)
- Today grouping → Schedule rules: groups by schedule (evidence: `src/logic/buckets.ts`)
- Today grouping → Date utilities: uses dates (evidence: `src/logic/buckets.ts`)
- Streak calculation → Schedule rules: checks due days (evidence: `src/logic/streak.ts`)
- Streak calculation → Date utilities: uses dates (evidence: `src/logic/streak.ts`)
- Heatmap calculation → Schedule rules: checks schedule (evidence: `src/logic/heatmap.ts`)
- Heatmap calculation → Date utilities: calculates dates (evidence: `src/logic/heatmap.ts`)
- Theme menu → Settings state: changes theme (evidence: `src/app/ThemeMenu.tsx`)
- App shell → Settings state: reads theme (evidence: `src/app/AppShell.tsx`)
- Theme hooks → Settings state: reads theme (evidence: `src/hooks/useTheme.ts`)
- Theme hooks → Theme tokens: gets palette (evidence: `src/hooks/useTheme.ts`)
