# inkithai/digibeat architecture

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

- Interactive diagram: https://gitdiagram.com/inkithai/digibeat
- Repository: https://github.com/inkithai/digibeat

## Overview

#### Purpose and runtime
DigiBeat is a client-only React 18/TypeScript PWA for fullscreen clock displays and time utilities: alarms, countdowns, stopwatch, Pomodoro, and world clocks. Vite provides development and production bundling; browser APIs provide persistence, fullscreen, wake lock, and offline behavior. Entry points are `src/main.tsx`, which mounts the application, and `src/App.tsx`, which coordinates routing and application-level UI.

#### Application shell and navigation
`src/App.tsx` is the top-level composition boundary for pages, shared settings/state, and navigation. `src/components/Navigation.tsx` exposes movement between the primary clock and time-tool views. Route-level features are separated into `src/pages/Home.tsx`, `src/pages/Timer.tsx`, `src/pages/Stopwatch.tsx`, `src/pages/Pomodoro.tsx`, `src/pages/Alarm.tsx`, and `src/pages/WorldClockPage.tsx`; this keeps each tool’s state and interactions distinct from the shell.

#### Shared clock configuration
`src/ClockContext.tsx` is the central cross-component state boundary for clock preferences such as style, color, format, visible date/seconds, background, accessibility, and display behavior. `src/types.ts` defines the shared domain contracts used by this state and consumers. Settings controls in `src/components/Controls.tsx` and `src/components/SettingsPanel.tsx` update this context; preferences are persisted locally and can be initialized from shareable URL parameters.

#### Live-time pipeline and renderers
`src/hooks/useTime.ts` is the live-time source, updating current time for consumers. `src/components/Clocks.tsx` selects or composes the configured clock presentation, while individual visual renderers isolate style-specific display logic: `src/components/FlipClock.tsx`, `src/components/PixelClock.tsx`, `src/components/NeonClock.tsx`, and `src/components/BinaryClock.tsx`. `src/components/DateDisplay.tsx` independently renders date output. This separates timing/state concerns from presentation-specific animation and markup.

#### Time-tool feature boundaries
Each route provides an independent stateful tool rather than extending the main live-clock renderer. `src/pages/Timer.tsx` owns countdown and preset behavior; `src/pages/Stopwatch.tsx` owns elapsed-time and lap tracking; `src/pages/Pomodoro.tsx` manages focus/break cycles. Alarm functionality is represented by `src/pages/Alarm.tsx` and reusable clock-facing UI in `src/components/AlarmClock.tsx`. World-time comparison is encapsulated in `src/pages/WorldClockPage.tsx` and `src/components/WorldClock.tsx`.

#### Display, accessibility, and browser integration
Global visual theming and responsive behavior are centralized in `src/styles.css`, likely driven by CSS variables set from shared preferences. Fullscreen, keyboard actions, wake-lock behavior, reduced-motion/high-contrast modes, and local storage operate at the browser boundary, primarily coordinated by application/context and control components rather than a backend. There are no server APIs, authentication systems, or external data services evident in the repository.

#### PWA delivery
`public/manifest.json` defines installable-app metadata. Offline caching has two relevant artifacts: `public/sw.js` for the served service worker and `src/sw.ts` for source-side service-worker logic/build integration. The runtime is static hosting after Vite build, with service worker registration enabling cached operation after an initial online load.

Main entry points: [`src/components/Navigation.tsx`](https://github.com/inkithai/digibeat/blob/main/src/components/Navigation.tsx) (Navigation), [`src/ClockContext.tsx`](https://github.com/inkithai/digibeat/blob/main/src/ClockContext.tsx) (Clock preferences), [`src/App.tsx`](https://github.com/inkithai/digibeat/blob/main/src/App.tsx) (Application shell), [`src/components/Clocks.tsx`](https://github.com/inkithai/digibeat/blob/main/src/components/Clocks.tsx) (Clock composer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App shell"]
  node_main["React entry<br/>bootstrap<br/>[main.tsx]"]
  node_app["Application shell<br/>React composition<br/>[App.tsx]"]
  node_navigation["Navigation<br/>shared component<br/>[Navigation.tsx]"]
  node_clock_context["Clock preferences<br/>React context<br/>[ClockContext.tsx]"]
  node_types["Domain contracts<br/>TypeScript types<br/>[types.ts]"]
  node_controls["Settings controls<br/>shared components<br/>[Controls.tsx]"]
  node_browser{{"Browser APIs<br/>platform boundary"}}
  node_styles["Global styles<br/>CSS theme<br/>[styles.css]"]
end

subgraph group_clock["Clock display"]
  node_home["Clock home<br/>route page<br/>[Home.tsx]"]
  node_time_hook["Live time source<br/>React hook<br/>[useTime.ts]"]
  node_clocks["Clock composer<br/>display component<br/>[Clocks.tsx]"]
  node_clock_renderers["Clock renderers<br/>visual components<br/>[FlipClock.tsx]"]
  node_date_display["Date display<br/>display component<br/>[DateDisplay.tsx]"]
end

subgraph group_tools["Time tools"]
  node_timer["Countdown timer<br/>route page<br/>[Timer.tsx]"]
  node_stopwatch["Stopwatch<br/>route page<br/>[Stopwatch.tsx]"]
  node_pomodoro["Pomodoro<br/>route page<br/>[Pomodoro.tsx]"]
  node_alarm["Alarm<br/>route page<br/>[Alarm.tsx]"]
  node_world_clock["World clocks<br/>route page<br/>[WorldClockPage.tsx]"]
end

subgraph group_delivery["PWA delivery"]
  node_pwa_assets["PWA manifest &amp; worker<br/>offline delivery<br/>[manifest.json]"]
  node_sw_source["Service worker source<br/>build integration<br/>[sw.ts]"]
end

node_main -->|"mounts"| node_app
node_app -->|"renders"| node_navigation
node_navigation -->|"navigates"| node_home
node_navigation -->|"navigates"| node_timer
node_navigation -->|"navigates"| node_stopwatch
node_navigation -->|"navigates"| node_pomodoro
node_navigation -->|"navigates"| node_alarm
node_navigation -->|"navigates"| node_world_clock
node_app -->|"provides"| node_clock_context
node_clock_context -->|"uses"| node_types
node_controls -->|"updates"| node_clock_context
node_home -->|"renders"| node_clocks
node_home -->|"renders"| node_date_display
node_clocks -->|"reads time"| node_time_hook
node_clocks -->|"reads preferences"| node_clock_context
node_clocks -->|"selects"| node_clock_renderers
node_clock_context -->|"persists and initializes"| node_browser
node_app -->|"coordinates display APIs"| node_browser
node_clock_context -->|"drives theme"| node_styles
node_sw_source -->|"builds/registers worker"| node_pwa_assets
node_pwa_assets -->|"offline caching"| node_browser

click node_main "https://github.com/inkithai/digibeat/blob/main/src/main.tsx"
click node_app "https://github.com/inkithai/digibeat/blob/main/src/App.tsx"
click node_navigation "https://github.com/inkithai/digibeat/blob/main/src/components/Navigation.tsx"
click node_clock_context "https://github.com/inkithai/digibeat/blob/main/src/ClockContext.tsx"
click node_types "https://github.com/inkithai/digibeat/blob/main/src/types.ts"
click node_controls "https://github.com/inkithai/digibeat/blob/main/src/components/Controls.tsx"
click node_home "https://github.com/inkithai/digibeat/blob/main/src/pages/Home.tsx"
click node_time_hook "https://github.com/inkithai/digibeat/blob/main/src/hooks/useTime.ts"
click node_clocks "https://github.com/inkithai/digibeat/blob/main/src/components/Clocks.tsx"
click node_clock_renderers "https://github.com/inkithai/digibeat/blob/main/src/components/FlipClock.tsx"
click node_date_display "https://github.com/inkithai/digibeat/blob/main/src/components/DateDisplay.tsx"
click node_timer "https://github.com/inkithai/digibeat/blob/main/src/pages/Timer.tsx"
click node_stopwatch "https://github.com/inkithai/digibeat/blob/main/src/pages/Stopwatch.tsx"
click node_pomodoro "https://github.com/inkithai/digibeat/blob/main/src/pages/Pomodoro.tsx"
click node_alarm "https://github.com/inkithai/digibeat/blob/main/src/pages/Alarm.tsx"
click node_world_clock "https://github.com/inkithai/digibeat/blob/main/src/pages/WorldClockPage.tsx"
click node_pwa_assets "https://github.com/inkithai/digibeat/blob/main/public/manifest.json"
click node_sw_source "https://github.com/inkithai/digibeat/blob/main/src/sw.ts"
click node_styles "https://github.com/inkithai/digibeat/blob/main/src/styles.css"

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_navigation,node_clock_context,node_types,node_controls,node_browser,node_styles toneBlue
class node_home,node_time_hook,node_clocks,node_clock_renderers,node_date_display toneAmber
class node_timer,node_stopwatch,node_pomodoro,node_alarm,node_world_clock toneMint
class node_pwa_assets,node_sw_source toneRose
```

## Components

### App shell

- [React entry](https://github.com/inkithai/digibeat/blob/main/src/main.tsx): bootstrap · `src/main.tsx`
- [Application shell](https://github.com/inkithai/digibeat/blob/main/src/App.tsx): React composition · Coordinates routes, shared UI, and browser behavior. · `src/App.tsx`
- [Navigation](https://github.com/inkithai/digibeat/blob/main/src/components/Navigation.tsx): shared component · `src/components/Navigation.tsx`
- [Clock preferences](https://github.com/inkithai/digibeat/blob/main/src/ClockContext.tsx): React context · Shared display, accessibility, and behavior settings. · `src/ClockContext.tsx`
- [Domain contracts](https://github.com/inkithai/digibeat/blob/main/src/types.ts): TypeScript types · `src/types.ts`
- [Settings controls](https://github.com/inkithai/digibeat/blob/main/src/components/Controls.tsx): shared components · Updates preferences from controls and settings panel. · `src/components/Controls.tsx`
- **Browser APIs**: platform boundary · Local storage, URL parameters, fullscreen, wake lock, and accessibility media features.
- [Global styles](https://github.com/inkithai/digibeat/blob/main/src/styles.css): CSS theme · Responsive styling and preference-driven CSS variables. · `src/styles.css`

### Clock display

- [Clock home](https://github.com/inkithai/digibeat/blob/main/src/pages/Home.tsx): route page · `src/pages/Home.tsx`
- [Live time source](https://github.com/inkithai/digibeat/blob/main/src/hooks/useTime.ts): React hook · `src/hooks/useTime.ts`
- [Clock composer](https://github.com/inkithai/digibeat/blob/main/src/components/Clocks.tsx): display component · Selects the configured clock presentation. · `src/components/Clocks.tsx`
- [Clock renderers](https://github.com/inkithai/digibeat/blob/main/src/components/FlipClock.tsx): visual components · Flip, pixel, neon, and binary clock styles. · `src/components/FlipClock.tsx`
- [Date display](https://github.com/inkithai/digibeat/blob/main/src/components/DateDisplay.tsx): display component · `src/components/DateDisplay.tsx`

### Time tools

- [Countdown timer](https://github.com/inkithai/digibeat/blob/main/src/pages/Timer.tsx): route page · Owns countdown and preset state. · `src/pages/Timer.tsx`
- [Stopwatch](https://github.com/inkithai/digibeat/blob/main/src/pages/Stopwatch.tsx): route page · Owns elapsed-time and lap state. · `src/pages/Stopwatch.tsx`
- [Pomodoro](https://github.com/inkithai/digibeat/blob/main/src/pages/Pomodoro.tsx): route page · Manages focus and break cycles. · `src/pages/Pomodoro.tsx`
- [Alarm](https://github.com/inkithai/digibeat/blob/main/src/pages/Alarm.tsx): route page · `src/pages/Alarm.tsx`
- [World clocks](https://github.com/inkithai/digibeat/blob/main/src/pages/WorldClockPage.tsx): route page · `src/pages/WorldClockPage.tsx`

### PWA delivery

- [PWA manifest & worker](https://github.com/inkithai/digibeat/blob/main/public/manifest.json): offline delivery · Install metadata and served service worker enable offline caching. · `public/manifest.json`
- [Service worker source](https://github.com/inkithai/digibeat/blob/main/src/sw.ts): build integration · `src/sw.ts`

## Connections

- React entry → Application shell: mounts
- Application shell → Navigation: renders
- Navigation → Clock home: navigates
- Navigation → Countdown timer: navigates
- Navigation → Stopwatch: navigates
- Navigation → Pomodoro: navigates
- Navigation → Alarm: navigates
- Navigation → World clocks: navigates
- Application shell → Clock preferences: provides
- Clock preferences → Domain contracts: uses
- Settings controls → Clock preferences: updates
- Clock home → Clock composer: renders
- Clock home → Date display: renders
- Clock composer → Live time source: reads time
- Clock composer → Clock preferences: reads preferences
- Clock composer → Clock renderers: selects
- Clock preferences → Browser APIs: persists and initializes
- Application shell → Browser APIs: coordinates display APIs
- Clock preferences → Global styles: drives theme
- Service worker source → PWA manifest & worker: builds/registers worker
- PWA manifest & worker → Browser APIs: offline caching
