# xoaicatchu/todolist-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/xoaicatchu/todolist-frontend
- Repository: https://github.com/xoaicatchu/todolist-frontend

## Overview

This is an offline-first Todo frontend with calendar-based task management, local event sourcing, NgRx UI state, and background synchronization across devices and browser tabs. The main workflow is user action → NgRx effect → local event and projection → refreshed UI, with sync and realtime notifications running alongside it. The README documents PWA caching and backend sync capabilities; source excerpts do not show the full HTTP or SignalR implementations, so those links rely on the README.

Main entry points: [`src/app/state/todo.effects.ts`](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.effects.ts) (Todo effects), [`src/app/core/services/sync.service.ts`](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/sync.service.ts) (Sync coordinator), [`src/app/app.ts`](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/app.ts) (Todo calendar UI), [`src/app/state/todo.actions.ts`](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.actions.ts) (Todo actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Todo experience"]
  node_todo_ui["Todo calendar UI<br/>[app.ts]"]
  node_todo_domain["Todo model<br/>[todo.model.ts]"]
end

subgraph group_state["UI state"]
  node_actions["Todo actions<br/>[todo.actions.ts]"]
  node_effects["Todo effects<br/>[todo.effects.ts]"]
  node_reducer["Todo reducer<br/>[todo.reducer.ts]"]
  node_selectors["Todo selectors<br/>[todo.selectors.ts]"]
end

subgraph group_local["Local persistence"]
  node_event_sourcing["Event sourcing"]
  node_local_db[("IndexedDB<br/>[app-db.service.ts]")]
end

subgraph group_sync["Synchronization"]
  node_sync_service["Sync coordinator<br/>[sync.service.ts]"]
  node_sync_api["Sync API client"]
  node_network["Network status<br/>[network.service.ts]"]
  node_tab_sync["Tab sync"]
  node_device_sync["Device realtime"]
end

node_user(("User"))
node_backend["Sync backend"]
node_signalr_hub["SignalR hub"]
node_pwa_worker["PWA service worker"]
node_app_config["App configuration<br/>[app.config.ts]"]

node_user -->|"uses"| node_todo_ui
node_todo_ui -->|"dispatches"| node_actions
node_todo_ui -->|"selects"| node_selectors
node_actions -->|"triggers"| node_effects
node_effects -->|"appends events"| node_event_sourcing
node_effects -->|"starts sync"| node_sync_service
node_effects -->|"notifies tabs"| node_tab_sync
node_effects -->|"loads projection"| node_event_sourcing
node_event_sourcing -->|"reads and writes"| node_local_db
node_sync_service -->|"gets and applies events"| node_event_sourcing
node_sync_service -->|"pushes and pulls"| node_sync_api
node_sync_service -->|"stores watermark"| node_local_db
node_sync_service -->|"checks status"| node_network
node_sync_api -->|"calls sync endpoints"| node_backend
node_backend -.->|"publishes changes"| node_signalr_hub
node_signalr_hub -->|"signals changes"| node_device_sync
node_device_sync -->|"triggers sync"| node_sync_service
node_tab_sync -->|"dispatches load"| node_actions
node_actions -->|"updates state"| node_reducer
node_reducer -->|"provides state"| node_selectors
node_todo_ui -->|"uses task types"| node_todo_domain
node_app_config -->|"registers"| node_reducer
node_app_config -->|"registers"| node_effects
node_app_config -->|"configures"| node_pwa_worker

click node_todo_ui "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/app.ts"
click node_todo_domain "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/models/todo.model.ts"
click node_actions "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.actions.ts"
click node_effects "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.effects.ts"
click node_reducer "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.reducer.ts"
click node_selectors "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.selectors.ts"
click node_event_sourcing "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/event-sourcing.service.ts"
click node_local_db "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/infrastructure/db/app-db.service.ts"
click node_sync_service "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/sync.service.ts"
click node_sync_api "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/sync-api.service.ts"
click node_network "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/network.service.ts"
click node_tab_sync "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/tab-realtime.service.ts"
click node_device_sync "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/realtime-sync.service.ts"
click node_app_config "https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/app.config.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_todo_ui,node_todo_domain,node_user toneBlue
class node_actions,node_effects,node_reducer,node_selectors toneAmber
class node_event_sourcing,node_local_db toneMint
class node_sync_service,node_sync_api,node_network,node_tab_sync,node_device_sync,node_pwa_worker toneRose
class node_backend,node_signalr_hub toneIndigo
class node_app_config toneTeal
```

## Components

### Todo experience

- [Todo calendar UI](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/app.ts): `src/app/app.ts`
- [Todo model](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/models/todo.model.ts): `src/app/core/models/todo.model.ts`

### UI state

- [Todo actions](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.actions.ts): `src/app/state/todo.actions.ts`
- [Todo effects](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.effects.ts): `src/app/state/todo.effects.ts`
- [Todo reducer](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.reducer.ts): `src/app/state/todo.reducer.ts`
- [Todo selectors](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/state/todo.selectors.ts): `src/app/state/todo.selectors.ts`

### Local persistence

- [Event sourcing](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/event-sourcing.service.ts): `src/app/core/services/event-sourcing.service.ts`
- [IndexedDB](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/infrastructure/db/app-db.service.ts): `src/app/infrastructure/db/app-db.service.ts`

### Synchronization

- [Sync coordinator](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/sync.service.ts): `src/app/core/services/sync.service.ts`
- [Sync API client](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/sync-api.service.ts): `src/app/core/services/sync-api.service.ts`
- [Network status](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/network.service.ts): `src/app/core/services/network.service.ts`
- [Tab sync](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/tab-realtime.service.ts): `src/app/core/services/tab-realtime.service.ts`
- [Device realtime](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/core/services/realtime-sync.service.ts): `src/app/core/services/realtime-sync.service.ts`

### Other components

- **User**
- **Sync backend**
- **SignalR hub**
- **PWA service worker**
- [App configuration](https://github.com/xoaicatchu/todolist-frontend/blob/main/src/app/app.config.ts): `src/app/app.config.ts`

## Connections

- User → Todo calendar UI: uses (evidence: `src/app/app.ts`)
- Todo calendar UI → Todo actions: dispatches (evidence: `src/app/app.ts`)
- Todo calendar UI → Todo selectors: selects (evidence: `src/app/app.ts`)
- Todo actions → Todo effects: triggers (evidence: `src/app/state/todo.effects.ts`)
- Todo effects → Event sourcing: appends events (evidence: `src/app/state/todo.effects.ts`)
- Todo effects → Sync coordinator: starts sync (evidence: `src/app/state/todo.effects.ts`)
- Todo effects → Tab sync: notifies tabs (evidence: `src/app/state/todo.effects.ts`)
- Todo effects → Event sourcing: loads projection (evidence: `src/app/state/todo.effects.ts`)
- Event sourcing → IndexedDB: reads and writes (evidence: `src/app/core/services/event-sourcing.service.ts`)
- Sync coordinator → Event sourcing: gets and applies events (evidence: `src/app/core/services/sync.service.ts`)
- Sync coordinator → Sync API client: pushes and pulls (evidence: `src/app/core/services/sync.service.ts`)
- Sync coordinator → IndexedDB: stores watermark (evidence: `src/app/core/services/sync.service.ts`)
- Sync coordinator → Network status: checks status (evidence: `src/app/core/services/sync.service.ts`)
- Sync API client → Sync backend: calls sync endpoints (evidence: `README.md`)
- Sync backend → SignalR hub: publishes changes (evidence: `README.md`)
- SignalR hub → Device realtime: signals changes (evidence: `README.md`)
- Device realtime → Sync coordinator: triggers sync (evidence: `src/app/core/services/realtime-sync.service.ts`)
- Tab sync → Todo actions: dispatches load (evidence: `src/app/core/services/tab-realtime.service.ts`)
- Todo actions → Todo reducer: updates state (evidence: `src/app/state/todo.reducer.ts`)
- Todo reducer → Todo selectors: provides state (evidence: `src/app/state/todo.selectors.ts`)
- Todo calendar UI → Todo model: uses task types (evidence: `src/app/app.ts`)
- App configuration → Todo reducer: registers (evidence: `src/app/app.config.ts`)
- App configuration → Todo effects: registers (evidence: `src/app/app.config.ts`)
- App configuration → PWA service worker: configures (evidence: `src/app/app.config.ts`)
