# destinym01/shiftmanager architecture

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

- Interactive diagram: https://gitdiagram.com/destinym01/shiftmanager
- Repository: https://github.com/destinym01/shiftmanager

## Overview

ShiftManager is a restaurant shift-management web app. Users authenticate or register, then reach a role-aware dashboard: employees view their own shifts, while admins manage employees and create, edit, and delete shifts in a Spanish-localized calendar. The dashboard also presents employee and shift statistics. Firebase Auth handles identity, and Firestore stores employee profiles and shifts. The graph includes documented dashboard capabilities, but Dashboard and several page implementations were not sampled, so their internal wiring is shown only at the documented feature level.

Main entry points: [`src/App.tsx`](https://github.com/destinym01/shiftmanager/blob/main/src/App.tsx) (Routes and shell), [`src/pages/Dashboard.tsx`](https://github.com/destinym01/shiftmanager/blob/main/src/pages/Dashboard.tsx) (Dashboard), [`src/components/EmployeeManager.tsx`](https://github.com/destinym01/shiftmanager/blob/main/src/components/EmployeeManager.tsx) (Employee manager), [`src/components/ShiftCalendar.tsx`](https://github.com/destinym01/shiftmanager/blob/main/src/components/ShiftCalendar.tsx) (Shift calendar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_entry["App entry<br/>[main.tsx]"]
  node_router["Routes and shell<br/>[App.tsx]"]
  node_guards["Route guards<br/>[RouteGuards.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_stats["Stats panel<br/>[StatsBar.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_login["Login<br/>[Login.tsx]"]
  node_register["Registration<br/>[Register.tsx]"]
  node_reset["Password reset<br/>[ResetPassword.tsx]"]
  node_authstate["Auth state<br/>[AuthContext.tsx]"]
  node_auth["Firebase Auth"]
end

subgraph group_scheduling["Scheduling and staff"]
  node_employees["Employee manager"]
  node_shifts["Shift calendar<br/>[ShiftCalendar.tsx]"]
  node_employee_service["Employee service<br/>[employeeService.ts]"]
  node_shift_service["Shift service<br/>[shiftService.ts]"]
  node_firestore[("Firestore")]
end

subgraph group_shared["Shared services"]
  node_schemas["Input schemas<br/>[schemas.ts]"]
  node_toast["Toast feedback<br/>[ToastContext.tsx]"]
  node_errors["Firestore error mapping<br/>[firestoreErrors.ts]"]
  node_boundary["Error boundary<br/>[ErrorBoundary.tsx]"]
end

node_user(("User"))

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_router
node_router -->|"routes"| node_login
node_router -->|"routes"| node_register
node_router -->|"routes"| node_reset
node_router -->|"checks access"| node_guards
node_guards -->|"checks session"| node_authstate
node_router -->|"routes"| node_dashboard
node_authstate -->|"observes session"| node_auth
node_authstate -->|"reads profile"| node_firestore
node_login -->|"authenticates"| node_auth
node_register -->|"validates"| node_schemas
node_register -->|"creates account"| node_auth
node_register -->|"writes profile"| node_firestore
node_reset -->|"resets password"| node_auth
node_dashboard -->|"loads staff"| node_employee_service
node_dashboard -->|"loads shifts"| node_shift_service
node_dashboard -->|"presents totals"| node_stats
node_dashboard -->|"presents staff tools"| node_employees
node_dashboard -->|"presents schedule"| node_shifts
node_employees -->|"validates"| node_schemas
node_employees -->|"manages staff"| node_employee_service
node_shifts -->|"validates"| node_schemas
node_shifts -->|"manages shifts"| node_shift_service
node_employee_service -->|"reads and writes"| node_firestore
node_shift_service -->|"reads and writes"| node_firestore
node_employees -->|"maps failures"| node_errors
node_shifts -->|"maps failures"| node_errors
node_employees -->|"reports outcome"| node_toast
node_shifts -->|"reports outcome"| node_toast
node_router -->|"contains render errors"| node_boundary

click node_entry "https://github.com/destinym01/shiftmanager/blob/main/src/main.tsx"
click node_router "https://github.com/destinym01/shiftmanager/blob/main/src/App.tsx"
click node_guards "https://github.com/destinym01/shiftmanager/blob/main/src/components/RouteGuards.tsx"
click node_dashboard "https://github.com/destinym01/shiftmanager/blob/main/src/pages/Dashboard.tsx"
click node_stats "https://github.com/destinym01/shiftmanager/blob/main/src/components/StatsBar.tsx"
click node_login "https://github.com/destinym01/shiftmanager/blob/main/src/pages/Login.tsx"
click node_register "https://github.com/destinym01/shiftmanager/blob/main/src/pages/Register.tsx"
click node_reset "https://github.com/destinym01/shiftmanager/blob/main/src/pages/ResetPassword.tsx"
click node_authstate "https://github.com/destinym01/shiftmanager/blob/main/src/context/AuthContext.tsx"
click node_employees "https://github.com/destinym01/shiftmanager/blob/main/src/components/EmployeeManager.tsx"
click node_shifts "https://github.com/destinym01/shiftmanager/blob/main/src/components/ShiftCalendar.tsx"
click node_employee_service "https://github.com/destinym01/shiftmanager/blob/main/src/services/employeeService.ts"
click node_shift_service "https://github.com/destinym01/shiftmanager/blob/main/src/services/shiftService.ts"
click node_schemas "https://github.com/destinym01/shiftmanager/blob/main/src/validation/schemas.ts"
click node_toast "https://github.com/destinym01/shiftmanager/blob/main/src/context/ToastContext.tsx"
click node_errors "https://github.com/destinym01/shiftmanager/blob/main/src/services/firestoreErrors.ts"
click node_boundary "https://github.com/destinym01/shiftmanager/blob/main/src/components/ErrorBoundary.tsx"

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_router,node_guards,node_dashboard,node_stats,node_user toneBlue
class node_login,node_register,node_reset,node_authstate,node_auth toneAmber
class node_employees,node_shifts,node_employee_service,node_shift_service,node_firestore toneMint
class node_schemas,node_toast,node_errors,node_boundary toneRose
```

## Components

### Application shell

- [App entry](https://github.com/destinym01/shiftmanager/blob/main/src/main.tsx): `src/main.tsx`
- [Routes and shell](https://github.com/destinym01/shiftmanager/blob/main/src/App.tsx): `src/App.tsx`
- [Route guards](https://github.com/destinym01/shiftmanager/blob/main/src/components/RouteGuards.tsx): `src/components/RouteGuards.tsx`
- [Dashboard](https://github.com/destinym01/shiftmanager/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Stats panel](https://github.com/destinym01/shiftmanager/blob/main/src/components/StatsBar.tsx): `src/components/StatsBar.tsx`

### Identity and access

- [Login](https://github.com/destinym01/shiftmanager/blob/main/src/pages/Login.tsx): `src/pages/Login.tsx`
- [Registration](https://github.com/destinym01/shiftmanager/blob/main/src/pages/Register.tsx): `src/pages/Register.tsx`
- [Password reset](https://github.com/destinym01/shiftmanager/blob/main/src/pages/ResetPassword.tsx): `src/pages/ResetPassword.tsx`
- [Auth state](https://github.com/destinym01/shiftmanager/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- **Firebase Auth**

### Scheduling and staff

- [Employee manager](https://github.com/destinym01/shiftmanager/blob/main/src/components/EmployeeManager.tsx): `src/components/EmployeeManager.tsx`
- [Shift calendar](https://github.com/destinym01/shiftmanager/blob/main/src/components/ShiftCalendar.tsx): `src/components/ShiftCalendar.tsx`
- [Employee service](https://github.com/destinym01/shiftmanager/blob/main/src/services/employeeService.ts): `src/services/employeeService.ts`
- [Shift service](https://github.com/destinym01/shiftmanager/blob/main/src/services/shiftService.ts): `src/services/shiftService.ts`
- **Firestore**

### Shared services

- [Input schemas](https://github.com/destinym01/shiftmanager/blob/main/src/validation/schemas.ts): `src/validation/schemas.ts`
- [Toast feedback](https://github.com/destinym01/shiftmanager/blob/main/src/context/ToastContext.tsx): `src/context/ToastContext.tsx`
- [Firestore error mapping](https://github.com/destinym01/shiftmanager/blob/main/src/services/firestoreErrors.ts): `src/services/firestoreErrors.ts`
- [Error boundary](https://github.com/destinym01/shiftmanager/blob/main/src/components/ErrorBoundary.tsx): `src/components/ErrorBoundary.tsx`

### Other components

- **User**

## Connections

- User → App entry: opens app
- App entry → Routes and shell: renders
- Routes and shell → Login: routes
- Routes and shell → Registration: routes
- Routes and shell → Password reset: routes
- Routes and shell → Route guards: checks access
- Route guards → Auth state: checks session
- Routes and shell → Dashboard: routes
- Auth state → Firebase Auth: observes session
- Auth state → Firestore: reads profile
- Login → Firebase Auth: authenticates
- Registration → Input schemas: validates
- Registration → Firebase Auth: creates account
- Registration → Firestore: writes profile
- Password reset → Firebase Auth: resets password
- Dashboard → Employee service: loads staff
- Dashboard → Shift service: loads shifts
- Dashboard → Stats panel: presents totals
- Dashboard → Employee manager: presents staff tools
- Dashboard → Shift calendar: presents schedule
- Employee manager → Input schemas: validates
- Employee manager → Employee service: manages staff
- Shift calendar → Input schemas: validates
- Shift calendar → Shift service: manages shifts
- Employee service → Firestore: reads and writes
- Shift service → Firestore: reads and writes
- Employee manager → Firestore error mapping: maps failures
- Shift calendar → Firestore error mapping: maps failures
- Employee manager → Toast feedback: reports outcome
- Shift calendar → Toast feedback: reports outcome
- Routes and shell → Error boundary: contains render errors
