# tonniewalker/pawpal architecture

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

- Interactive diagram: https://gitdiagram.com/tonniewalker/pawpal
- Repository: https://github.com/tonniewalker/pawpal

## Overview

PawPal is a local-first PWA for caring for a virtual dog. The main workflow is adoption, timestamp-based status decay, daily care that earns experience, and viewing the resulting mood, growth, and care history. Settings support renaming, time simulation, and reset. The sampled code establishes the app’s state, routing, persistence, and core care logic; other subsystem links are included only where the README or source index documents them.

Main entry points: [`src/App.jsx`](https://github.com/tonniewalker/pawpal/blob/main/src/App.jsx) (App state and routes), [`src/dogLogic.js`](https://github.com/tonniewalker/pawpal/blob/main/src/dogLogic.js) (Dog rules and time), [`src/pages/Home.jsx`](https://github.com/tonniewalker/pawpal/blob/main/src/pages/Home.jsx) (Home and care), [`src/main.jsx`](https://github.com/tonniewalker/pawpal/blob/main/src/main.jsx) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_entry["App entry<br/>[main.jsx]"]
  node_app["App state and routes<br/>[App.jsx]"]
  node_navigation["Bottom navigation<br/>[BottomNav.jsx]"]
  node_sw["Service worker registration<br/>[sw-registration.js]"]
end

subgraph group_care["Care lifecycle"]
  node_adopt["Adoption screen<br/>[Adopt.jsx]"]
  node_home["Home and care<br/>[Home.jsx]"]
  node_diary["Care diary<br/>[Diary.jsx]"]
  node_settings["Settings<br/>[Settings.jsx]"]
  node_logic["Dog rules and time<br/>[dogLogic.js]"]
  node_config["Care configuration<br/>[config.js]"]
end

subgraph group_presentation["Dog and interface"]
  node_scene["Time-based scene<br/>[DogScene.jsx]"]
  node_dog["Mood dog artwork<br/>[Dog.jsx]"]
  node_stats["Status bars<br/>[StatBar.jsx]"]
end

subgraph group_persistence["Local persistence"]
  node_storage["Storage adapter<br/>[storage.js]"]
  node_localstorage[("Browser localStorage")]
end

node_user(("User"))

node_user -->|"opens"| node_entry
node_entry -->|"mounts"| node_app
node_entry -->|"registers"| node_sw
node_app -->|"loads and saves"| node_storage
node_storage -->|"reads and writes"| node_localstorage
node_app -->|"calculates care state"| node_logic
node_logic -->|"uses rules"| node_config
node_app -->|"shows before adoption"| node_adopt
node_app -->|"routes care view"| node_home
node_app -->|"routes diary view"| node_diary
node_app -->|"routes settings view"| node_settings
node_app -->|"renders navigation"| node_navigation
node_home -->|"derives mood and level"| node_logic
node_home -->|"renders scene"| node_scene
node_home -->|"renders status bars"| node_stats
node_scene -->|"renders dog"| node_dog
node_scene -->|"gets time of day"| node_logic
node_diary -->|"uses care actions"| node_config
node_diary -->|"uses day duration"| node_logic
node_settings -->|"invokes settings actions"| node_app
node_adopt -->|"submits adoption"| node_app

click node_entry "https://github.com/tonniewalker/pawpal/blob/main/src/main.jsx"
click node_app "https://github.com/tonniewalker/pawpal/blob/main/src/App.jsx"
click node_navigation "https://github.com/tonniewalker/pawpal/blob/main/src/components/BottomNav.jsx"
click node_adopt "https://github.com/tonniewalker/pawpal/blob/main/src/pages/Adopt.jsx"
click node_home "https://github.com/tonniewalker/pawpal/blob/main/src/pages/Home.jsx"
click node_diary "https://github.com/tonniewalker/pawpal/blob/main/src/pages/Diary.jsx"
click node_settings "https://github.com/tonniewalker/pawpal/blob/main/src/pages/Settings.jsx"
click node_logic "https://github.com/tonniewalker/pawpal/blob/main/src/dogLogic.js"
click node_config "https://github.com/tonniewalker/pawpal/blob/main/src/config.js"
click node_scene "https://github.com/tonniewalker/pawpal/blob/main/src/components/DogScene.jsx"
click node_dog "https://github.com/tonniewalker/pawpal/blob/main/src/components/Dog.jsx"
click node_stats "https://github.com/tonniewalker/pawpal/blob/main/src/components/StatBar.jsx"
click node_storage "https://github.com/tonniewalker/pawpal/blob/main/src/storage.js"
click node_sw "https://github.com/tonniewalker/pawpal/blob/main/src/sw-registration.js"

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_entry,node_app,node_navigation,node_sw,node_user toneBlue
class node_adopt,node_home,node_diary,node_settings,node_logic,node_config toneAmber
class node_scene,node_dog,node_stats toneMint
class node_storage,node_localstorage toneRose
```

## Components

### App and navigation

- [App entry](https://github.com/tonniewalker/pawpal/blob/main/src/main.jsx): `src/main.jsx`
- [App state and routes](https://github.com/tonniewalker/pawpal/blob/main/src/App.jsx): `src/App.jsx`
- [Bottom navigation](https://github.com/tonniewalker/pawpal/blob/main/src/components/BottomNav.jsx): `src/components/BottomNav.jsx`
- [Service worker registration](https://github.com/tonniewalker/pawpal/blob/main/src/sw-registration.js): `src/sw-registration.js`

### Care lifecycle

- [Adoption screen](https://github.com/tonniewalker/pawpal/blob/main/src/pages/Adopt.jsx): `src/pages/Adopt.jsx`
- [Home and care](https://github.com/tonniewalker/pawpal/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Care diary](https://github.com/tonniewalker/pawpal/blob/main/src/pages/Diary.jsx): `src/pages/Diary.jsx`
- [Settings](https://github.com/tonniewalker/pawpal/blob/main/src/pages/Settings.jsx): `src/pages/Settings.jsx`
- [Dog rules and time](https://github.com/tonniewalker/pawpal/blob/main/src/dogLogic.js): `src/dogLogic.js`
- [Care configuration](https://github.com/tonniewalker/pawpal/blob/main/src/config.js): `src/config.js`

### Dog and interface

- [Time-based scene](https://github.com/tonniewalker/pawpal/blob/main/src/components/DogScene.jsx): `src/components/DogScene.jsx`
- [Mood dog artwork](https://github.com/tonniewalker/pawpal/blob/main/src/components/Dog.jsx): `src/components/Dog.jsx`
- [Status bars](https://github.com/tonniewalker/pawpal/blob/main/src/components/StatBar.jsx): `src/components/StatBar.jsx`

### Local persistence

- [Storage adapter](https://github.com/tonniewalker/pawpal/blob/main/src/storage.js): `src/storage.js`
- **Browser localStorage**

### Other components

- **User**

## Connections

- User → App entry: opens (evidence: `README.md`)
- App entry → App state and routes: mounts (evidence: `src/main.jsx`)
- App entry → Service worker registration: registers (evidence: `src/main.jsx`)
- App state and routes → Storage adapter: loads and saves (evidence: `src/App.jsx`)
- Storage adapter → Browser localStorage: reads and writes (evidence: `src/storage.js`)
- App state and routes → Dog rules and time: calculates care state (evidence: `src/App.jsx`)
- Dog rules and time → Care configuration: uses rules (evidence: `src/dogLogic.js`)
- App state and routes → Adoption screen: shows before adoption (evidence: `src/App.jsx`)
- App state and routes → Home and care: routes care view (evidence: `src/App.jsx`)
- App state and routes → Care diary: routes diary view (evidence: `src/App.jsx`)
- App state and routes → Settings: routes settings view (evidence: `src/App.jsx`)
- App state and routes → Bottom navigation: renders navigation (evidence: `src/App.jsx`)
- Home and care → Dog rules and time: derives mood and level (evidence: `src/pages/Home.jsx`)
- Home and care → Time-based scene: renders scene (evidence: `src/pages/Home.jsx`)
- Home and care → Status bars: renders status bars (evidence: `src/pages/Home.jsx`)
- Time-based scene → Mood dog artwork: renders dog (evidence: `src/components/DogScene.jsx`)
- Time-based scene → Dog rules and time: gets time of day (evidence: `src/components/DogScene.jsx`)
- Care diary → Care configuration: uses care actions (evidence: `src/pages/Diary.jsx`)
- Care diary → Dog rules and time: uses day duration (evidence: `src/pages/Diary.jsx`)
- Settings → App state and routes: invokes settings actions (evidence: `src/App.jsx`)
- Adoption screen → App state and routes: submits adoption (evidence: `README.md`)
