# jensenjr/min-tid architecture

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

- Interactive diagram: https://gitdiagram.com/jensenjr/min-tid
- Repository: https://github.com/jensenjr/min-tid

## Overview

min-tid is an offline-first Swedish employee time-reporting app. The main workflow is to record work or deviations, calculate daily hours and flex against the effective schedule, review and confirm days or months, then produce a period report. The shell also manages local persistence and optional encrypted device sync. README statements support several unsampled product branches; those relationships are cited to the README rather than presented as inspected implementation details.

Main entry points: [`src/components/PunchClock.tsx`](https://github.com/jensenjr/min-tid/blob/main/src/components/PunchClock.tsx) (App shell), [`src/lib/report.ts`](https://github.com/jensenjr/min-tid/blob/main/src/lib/report.ts) (Period report), [`src/lib/days.ts`](https://github.com/jensenjr/min-tid/blob/main/src/lib/days.ts) (Day evaluation), [`src/views/Today.tsx`](https://github.com/jensenjr/min-tid/blob/main/src/views/Today.tsx) (Today view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_shell["App shell<br/>[PunchClock.tsx]"]
  node_today["Today view<br/>[Today.tsx]"]
  node_calendar["Calendar view<br/>[Calendar.tsx]"]
  node_more["More view<br/>[More.tsx]"]
end

subgraph group_time["Time and rules"]
  node_schedule["Schedule rules<br/>[schedule.ts]"]
  node_sessions["Work sessions<br/>[SessionModal.tsx]"]
  node_daycalc["Day evaluation<br/>[days.ts]"]
  node_attendance["Punch tracking<br/>[attend.ts]"]
end

subgraph group_reporting["Reporting and records"]
  node_absences["Absence records<br/>[AbsenceModal.tsx]"]
  node_expenses["Expenses<br/>[ExpenseModal.tsx]"]
  node_travel["Travel time<br/>[travel.ts]"]
  node_vacation["Vacation balance<br/>[vacation.ts]"]
  node_confirm["Month confirmation<br/>[confirm.ts]"]
  node_report["Period report<br/>[report.ts]"]
  node_excel["Excel import/export"]
  node_localdata[("Device data<br/>[PunchClock.tsx]")]
end

subgraph group_sync["Encrypted sync"]
  node_syncclient["Sync client<br/>[sync.ts]"]
  node_crypto["Encryption keys<br/>[crypto.ts]"]
end

subgraph group_backend["Sync backend"]
  node_syncapi["Sync API<br/>[index.js]"]
  node_serverdata[("JSON account store<br/>[core.js]")]
end

node_employee(("Employee"))

node_employee -->|"uses"| node_shell
node_shell -->|"shows"| node_today
node_shell -->|"shows"| node_calendar
node_shell -->|"shows"| node_more
node_today -->|"tracks punches"| node_attendance
node_sessions -->|"reads rules"| node_schedule
node_schedule -->|"sets day norm"| node_daycalc
node_today -->|"shows evaluation"| node_daycalc
node_calendar -->|"shows day status"| node_daycalc
node_calendar -->|"reviews months"| node_confirm
node_shell -->|"opens entry"| node_sessions
node_shell -->|"opens entry"| node_absences
node_shell -->|"opens entry"| node_expenses
node_more -->|"offers import"| node_excel
node_shell -->|"loads and saves"| node_localdata
node_employee -->|"requests totals"| node_report
node_report -->|"exports workbook"| node_excel
node_shell -.->|"syncs optionally"| node_syncclient
node_syncclient -->|"encrypts state"| node_crypto
node_syncclient -.->|"sends ciphertext"| node_syncapi
node_syncapi -->|"stores accounts"| node_serverdata
node_report -.->|"includes balance"| node_vacation
node_report -.->|"includes travel"| node_travel
node_daycalc -->|"accounts for"| node_absences

click node_shell "https://github.com/jensenjr/min-tid/blob/main/src/components/PunchClock.tsx"
click node_today "https://github.com/jensenjr/min-tid/blob/main/src/views/Today.tsx"
click node_calendar "https://github.com/jensenjr/min-tid/blob/main/src/views/Calendar.tsx"
click node_more "https://github.com/jensenjr/min-tid/blob/main/src/views/More.tsx"
click node_schedule "https://github.com/jensenjr/min-tid/blob/main/src/lib/schedule.ts"
click node_sessions "https://github.com/jensenjr/min-tid/blob/main/src/components/SessionModal.tsx"
click node_daycalc "https://github.com/jensenjr/min-tid/blob/main/src/lib/days.ts"
click node_attendance "https://github.com/jensenjr/min-tid/blob/main/src/lib/attend.ts"
click node_absences "https://github.com/jensenjr/min-tid/blob/main/src/components/AbsenceModal.tsx"
click node_expenses "https://github.com/jensenjr/min-tid/blob/main/src/components/ExpenseModal.tsx"
click node_travel "https://github.com/jensenjr/min-tid/blob/main/src/lib/travel.ts"
click node_vacation "https://github.com/jensenjr/min-tid/blob/main/src/lib/vacation.ts"
click node_confirm "https://github.com/jensenjr/min-tid/blob/main/src/lib/confirm.ts"
click node_report "https://github.com/jensenjr/min-tid/blob/main/src/lib/report.ts"
click node_excel "https://github.com/jensenjr/min-tid/tree/main/src/lib/excel"
click node_localdata "https://github.com/jensenjr/min-tid/blob/main/src/components/PunchClock.tsx"
click node_syncclient "https://github.com/jensenjr/min-tid/blob/main/src/lib/sync.ts"
click node_crypto "https://github.com/jensenjr/min-tid/blob/main/src/lib/crypto.ts"
click node_syncapi "https://github.com/jensenjr/min-tid/blob/main/server/index.js"
click node_serverdata "https://github.com/jensenjr/min-tid/blob/main/server/core.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_shell,node_today,node_calendar,node_more toneBlue
class node_schedule,node_sessions,node_daycalc,node_attendance toneAmber
class node_absences,node_expenses,node_travel,node_vacation,node_confirm,node_report,node_excel,node_localdata toneMint
class node_syncclient,node_crypto toneRose
class node_syncapi,node_serverdata,node_employee toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/jensenjr/min-tid/blob/main/src/components/PunchClock.tsx): `src/components/PunchClock.tsx`
- [Today view](https://github.com/jensenjr/min-tid/blob/main/src/views/Today.tsx): `src/views/Today.tsx`
- [Calendar view](https://github.com/jensenjr/min-tid/blob/main/src/views/Calendar.tsx): `src/views/Calendar.tsx`
- [More view](https://github.com/jensenjr/min-tid/blob/main/src/views/More.tsx): `src/views/More.tsx`

### Time and rules

- [Schedule rules](https://github.com/jensenjr/min-tid/blob/main/src/lib/schedule.ts): `src/lib/schedule.ts`
- [Work sessions](https://github.com/jensenjr/min-tid/blob/main/src/components/SessionModal.tsx): `src/components/SessionModal.tsx`
- [Day evaluation](https://github.com/jensenjr/min-tid/blob/main/src/lib/days.ts): `src/lib/days.ts`
- [Punch tracking](https://github.com/jensenjr/min-tid/blob/main/src/lib/attend.ts): `src/lib/attend.ts`

### Reporting and records

- [Absence records](https://github.com/jensenjr/min-tid/blob/main/src/components/AbsenceModal.tsx): `src/components/AbsenceModal.tsx`
- [Expenses](https://github.com/jensenjr/min-tid/blob/main/src/components/ExpenseModal.tsx): `src/components/ExpenseModal.tsx`
- [Travel time](https://github.com/jensenjr/min-tid/blob/main/src/lib/travel.ts): `src/lib/travel.ts`
- [Vacation balance](https://github.com/jensenjr/min-tid/blob/main/src/lib/vacation.ts): `src/lib/vacation.ts`
- [Month confirmation](https://github.com/jensenjr/min-tid/blob/main/src/lib/confirm.ts): `src/lib/confirm.ts`
- [Period report](https://github.com/jensenjr/min-tid/blob/main/src/lib/report.ts): `src/lib/report.ts`
- [Excel import/export](https://github.com/jensenjr/min-tid/tree/main/src/lib/excel): `src/lib/excel`
- [Device data](https://github.com/jensenjr/min-tid/blob/main/src/components/PunchClock.tsx): `src/components/PunchClock.tsx`

### Encrypted sync

- [Sync client](https://github.com/jensenjr/min-tid/blob/main/src/lib/sync.ts): `src/lib/sync.ts`
- [Encryption keys](https://github.com/jensenjr/min-tid/blob/main/src/lib/crypto.ts): `src/lib/crypto.ts`

### Sync backend

- [Sync API](https://github.com/jensenjr/min-tid/blob/main/server/index.js): `server/index.js`
- [JSON account store](https://github.com/jensenjr/min-tid/blob/main/server/core.js): `server/core.js`

### Other components

- **Employee**

## Connections

- Employee → App shell: uses (evidence: `README.md`)
- App shell → Today view: shows (evidence: `src/components/PunchClock.tsx`)
- App shell → Calendar view: shows (evidence: `src/components/PunchClock.tsx`)
- App shell → More view: shows (evidence: `src/components/PunchClock.tsx`)
- Today view → Punch tracking: tracks punches (evidence: `src/views/Today.tsx`)
- Work sessions → Schedule rules: reads rules (evidence: `src/components/SessionModal.tsx`)
- Schedule rules → Day evaluation: sets day norm (evidence: `src/lib/days.ts`)
- Today view → Day evaluation: shows evaluation (evidence: `src/views/Today.tsx`)
- Calendar view → Day evaluation: shows day status (evidence: `src/views/Calendar.tsx`)
- Calendar view → Month confirmation: reviews months (evidence: `src/views/Calendar.tsx`)
- App shell → Work sessions: opens entry (evidence: `src/components/PunchClock.tsx`)
- App shell → Absence records: opens entry (evidence: `src/components/PunchClock.tsx`)
- App shell → Expenses: opens entry (evidence: `src/components/PunchClock.tsx`)
- More view → Excel import/export: offers import (evidence: `README.md`)
- App shell → Device data: loads and saves (evidence: `README.md`)
- Employee → Period report: requests totals (evidence: `README.md`)
- Period report → Excel import/export: exports workbook (evidence: `README.md`)
- App shell → Sync client: syncs optionally (evidence: `src/components/PunchClock.tsx`)
- Sync client → Encryption keys: encrypts state (evidence: `src/lib/sync.ts`)
- Sync client → Sync API: sends ciphertext (evidence: `README.md`)
- Sync API → JSON account store: stores accounts (evidence: `README.md`)
- Period report → Vacation balance: includes balance (evidence: `README.md`)
- Period report → Travel time: includes travel (evidence: `README.md`)
- Day evaluation → Absence records: accounts for (evidence: `src/lib/days.ts`)
