# dmaman86/shiftly architecture

> Architecture diagram of the GitHub repository dmaman86/shiftly, 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/dmaman86/shiftly
- Repository: https://github.com/dmaman86/shiftly

## Overview

Shiftly is a shift-entry and payroll-estimation web app backed by an independent TypeScript payroll domain. Workers enter and edit shifts; the app computes inspectable daily breakdowns and monthly gross estimates, with authenticated persistence and guest drafts. The graph preserves the documented profile and public calculation-rules capabilities. Source evidence shows routing, day orchestration, month-session behavior, and domain layer construction; other documented branches are included, but their internal links are omitted where implementation was not sampled.

Main entry points: [`apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts) (Month session), [`apps/web/src/app/routes/AppRoutes.tsx`](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/app/routes/AppRoutes.tsx) (Language routes), [`packages/domain/src/builder/daypaymap.builder.ts`](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/daypaymap.builder.ts) (Daily pay mapping), [`apps/web/src/features/work-table/hooks/day/useDayController.ts`](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/day/useDayController.ts) (Day controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes["Language routes<br/>[AppRoutes.tsx]"]
  node_daily["Daily page<br/>[DailyPage.tsx]"]
  node_monthly["Monthly summary"]
  node_rules["Calculation rules"]
  node_analytics["Usage analytics"]
end

subgraph group_editing["Shift editing"]
  node_session["Month session"]
  node_daycontroller["Day controller"]
  node_daystate["Day editing state"]
  node_statechanges["State change detection"]
  node_shiftservice["Shift persistence<br/>[shift.service.ts]"]
  node_workdayservice["Workday persistence<br/>[workDay.service.ts]"]
  node_guestdraft["Guest drafts"]
end

subgraph group_domain["Payroll domain"]
  node_shiftbuilder["Shift pay mapping"]
  node_daybuilder["Daily pay mapping"]
  node_calendarbuilder["Month workdays"]
  node_daycalc["Day calculation"]
  node_addition["Addition classification"]
  node_fixedcalc["Fixed segments"]
  node_mealcalc["Meal allowance"]
  node_diemcalc["Per diem"]
  node_monthreducer["Monthly pay reducer"]
  node_dates["Date and timezone<br/>[date.service.ts]"]
end

subgraph group_account["Accounts and history"]
  node_profile["Profile charts<br/>[ProfilePage.tsx]"]
  node_profilehistory["Profile history"]
end

node_worker(("Worker"))
node_supabase[("Supabase")]

node_worker -->|"opens"| node_routes
node_routes -->|"routes daily"| node_daily
node_routes -->|"routes monthly"| node_monthly
node_routes -->|"routes rules"| node_rules
node_routes -->|"routes profile"| node_profile
node_worker -->|"enters shifts"| node_daily
node_daycontroller -->|"edits state"| node_daystate
node_daycontroller -->|"tracks additions"| node_analytics
node_session -->|"hydrates state"| node_daystate
node_session -->|"detects changes"| node_statechanges
node_session -->|"reads and writes"| node_shiftservice
node_session -->|"reads and writes"| node_workdayservice
node_session -->|"captures drafts"| node_guestdraft
node_session -->|"projects pay maps"| node_daybuilder
node_shiftservice -.->|"persists records"| node_supabase
node_workdayservice -.->|"persists records"| node_supabase
node_daycontroller -->|"uses domain"| node_daycalc
node_daycalc -.->|"builds shift maps"| node_shiftbuilder
node_shiftbuilder -.->|"classifies additions"| node_addition
node_daybuilder -->|"uses fixed segments"| node_fixedcalc
node_daybuilder -->|"uses allowance"| node_mealcalc
node_daybuilder -->|"uses per diem"| node_diemcalc
node_calendarbuilder -->|"uses dates"| node_dates
node_monthly -.->|"estimates pay"| node_monthreducer
node_profile -.->|"loads history"| node_profilehistory
node_profilehistory -.->|"reads saved data"| node_supabase

click node_routes "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/app/routes/AppRoutes.tsx"
click node_daily "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/DailyPage.tsx"
click node_monthly "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/MonthlySummaryPage.tsx"
click node_rules "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/CalculationRulesPage.tsx"
click node_profile "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/ProfilePage.tsx"
click node_session "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts"
click node_daycontroller "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/day/useDayController.ts"
click node_daystate "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/context/workTableDayState/workTableDayStateContext.ts"
click node_statechanges "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/helpers/workTableStateChanges.ts"
click node_shiftservice "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/shift/shift.service.ts"
click node_workdayservice "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/workDay/workDay.service.ts"
click node_guestdraft "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/guestDraft/guestDraft.service.ts"
click node_shiftbuilder "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/shiftmap.builder.ts"
click node_daybuilder "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/daypaymap.builder.ts"
click node_calendarbuilder "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/workdaysformonth.builder.ts"
click node_daycalc "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/day-from-shifts.calculator.ts"
click node_addition "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/additions/addition.classifier.ts"
click node_fixedcalc "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/fixed-segment.calculator.ts"
click node_mealcalc "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/mealallowance/timeline-meal-allowance.calculator.ts"
click node_diemcalc "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/perdiem/timeline-per-diem.calculator.ts"
click node_monthreducer "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/reducer/month-pay-map.reducer.ts"
click node_dates "https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/services/date.service.ts"
click node_profilehistory "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/profile/services/profileHistory.service.ts"
click node_analytics "https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/analytics/analytics.service.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_routes,node_daily,node_monthly,node_rules,node_analytics toneBlue
class node_session,node_daycontroller,node_daystate,node_statechanges,node_shiftservice,node_workdayservice,node_guestdraft,node_supabase toneAmber
class node_shiftbuilder,node_daybuilder,node_calendarbuilder,node_daycalc,node_addition,node_fixedcalc,node_mealcalc,node_diemcalc,node_monthreducer,node_dates toneMint
class node_profile,node_profilehistory,node_worker toneRose
```

## Components

### Web experience

- [Language routes](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/app/routes/AppRoutes.tsx): `apps/web/src/app/routes/AppRoutes.tsx`
- [Daily page](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/DailyPage.tsx): `apps/web/src/pages/DailyPage.tsx`
- [Monthly summary](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/MonthlySummaryPage.tsx): `apps/web/src/pages/MonthlySummaryPage.tsx`
- [Calculation rules](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/CalculationRulesPage.tsx): `apps/web/src/pages/CalculationRulesPage.tsx`
- [Usage analytics](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/analytics/analytics.service.ts): `apps/web/src/services/analytics/analytics.service.ts`

### Shift editing

- [Month session](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts): `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`
- [Day controller](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/hooks/day/useDayController.ts): `apps/web/src/features/work-table/hooks/day/useDayController.ts`
- [Day editing state](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/context/workTableDayState/workTableDayStateContext.ts): `apps/web/src/features/work-table/context/workTableDayState/workTableDayStateContext.ts`
- [State change detection](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/work-table/helpers/workTableStateChanges.ts): `apps/web/src/features/work-table/helpers/workTableStateChanges.ts`
- [Shift persistence](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/shift/shift.service.ts): `apps/web/src/services/shift/shift.service.ts`
- [Workday persistence](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/workDay/workDay.service.ts): `apps/web/src/services/workDay/workDay.service.ts`
- [Guest drafts](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/services/guestDraft/guestDraft.service.ts): `apps/web/src/services/guestDraft/guestDraft.service.ts`

### Payroll domain

- [Shift pay mapping](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/shiftmap.builder.ts): `packages/domain/src/builder/shiftmap.builder.ts`
- [Daily pay mapping](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/daypaymap.builder.ts): `packages/domain/src/builder/daypaymap.builder.ts`
- [Month workdays](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/builder/workdaysformonth.builder.ts): `packages/domain/src/builder/workdaysformonth.builder.ts`
- [Day calculation](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/day-from-shifts.calculator.ts): `packages/domain/src/calculator/day-from-shifts.calculator.ts`
- [Addition classification](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/additions/addition.classifier.ts): `packages/domain/src/calculator/additions/addition.classifier.ts`
- [Fixed segments](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/fixed-segment.calculator.ts): `packages/domain/src/calculator/fixed-segment.calculator.ts`
- [Meal allowance](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/mealallowance/timeline-meal-allowance.calculator.ts): `packages/domain/src/calculator/mealallowance/timeline-meal-allowance.calculator.ts`
- [Per diem](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/calculator/perdiem/timeline-per-diem.calculator.ts): `packages/domain/src/calculator/perdiem/timeline-per-diem.calculator.ts`
- [Monthly pay reducer](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/reducer/month-pay-map.reducer.ts): `packages/domain/src/reducer/month-pay-map.reducer.ts`
- [Date and timezone](https://github.com/dmaman86/shiftly/blob/main/packages/domain/src/services/date.service.ts): `packages/domain/src/services/date.service.ts`

### Accounts and history

- [Profile charts](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/pages/ProfilePage.tsx): `apps/web/src/pages/ProfilePage.tsx`
- [Profile history](https://github.com/dmaman86/shiftly/blob/main/apps/web/src/features/profile/services/profileHistory.service.ts): `apps/web/src/features/profile/services/profileHistory.service.ts`

### Other components

- **Worker**
- **Supabase**

## Connections

- Worker → Language routes: opens (evidence: `README.md`)
- Language routes → Daily page: routes daily (evidence: `apps/web/src/app/routes/AppRoutes.tsx`)
- Language routes → Monthly summary: routes monthly (evidence: `apps/web/src/app/routes/AppRoutes.tsx`)
- Language routes → Calculation rules: routes rules (evidence: `apps/web/src/app/routes/AppRoutes.tsx`)
- Language routes → Profile charts: routes profile (evidence: `apps/web/src/app/routes/AppRoutes.tsx`)
- Worker → Daily page: enters shifts (evidence: `README.md`)
- Day controller → Day editing state: edits state (evidence: `apps/web/src/features/work-table/hooks/day/useDayController.ts`)
- Day controller → Usage analytics: tracks additions (evidence: `apps/web/src/features/work-table/hooks/day/useDayController.ts`)
- Month session → Day editing state: hydrates state (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Month session → State change detection: detects changes (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Month session → Shift persistence: reads and writes (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Month session → Workday persistence: reads and writes (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Month session → Guest drafts: captures drafts (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Month session → Daily pay mapping: projects pay maps (evidence: `apps/web/src/features/work-table/hooks/month/useWorkTableMonthSession.ts`)
- Shift persistence → Supabase: persists records
- Workday persistence → Supabase: persists records
- Day controller → Day calculation: uses domain (evidence: `apps/web/src/features/work-table/hooks/day/useDayController.ts`)
- Day calculation → Shift pay mapping: builds shift maps
- Shift pay mapping → Addition classification: classifies additions
- Daily pay mapping → Fixed segments: uses fixed segments
- Daily pay mapping → Meal allowance: uses allowance
- Daily pay mapping → Per diem: uses per diem
- Month workdays → Date and timezone: uses dates
- Monthly summary → Monthly pay reducer: estimates pay
- Profile charts → Profile history: loads history
- Profile history → Supabase: reads saved data
