# teto550/stmina architecture

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

- Interactive diagram: https://gitdiagram.com/teto550/stmina
- Repository: https://github.com/teto550/stmina

## Overview

St. Mina is a Firebase-backed attendance PWA for a primary-school service. Staff sign in, enter the app shell, select a class or servants area, and manage student records and attendance; administrators also handle access, imports, and service operations. The map includes documented feature areas such as the assistant, dashboard, and import/export. Some feature implementations and screen wiring were not sampled, so their connections are omitted rather than inferred from names.

Main entry points: [`src/main.ts`](https://github.com/teto550/stmina/blob/main/src/main.ts) (App entry), [`src/features/students/students.ts`](https://github.com/teto550/stmina/blob/main/src/features/students/students.ts) (Student records), [`src/features/assistant/assistant.ts`](https://github.com/teto550/stmina/blob/main/src/features/assistant/assistant.ts) (Service assistant), [`src/features/attendance/attendance.ts`](https://github.com/teto550/stmina/blob/main/src/features/attendance/attendance.ts) (Attendance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and access"]
  node_main["App entry<br/>[main.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_auth_api["Firebase auth API<br/>[auth.ts]"]
  node_session["Session and permissions<br/>[session.ts]"]
  node_access_rules["Access rules<br/>[access-config.ts]"]
  node_shell["App shell<br/>[app-shell.ts]"]
end

subgraph group_students["Students and attendance"]
  node_students_feature["Student records<br/>[students.ts]"]
  node_attendance["Attendance<br/>[attendance.ts]"]
  node_attendance_import["Attendance import"]
  node_student_import_export["Student and data transfers"]
end

subgraph group_service["Service operations"]
  node_servants["Servants management"]
  node_deacon_attendance["Servants attendance"]
  node_dashboard["Dashboard and statistics"]
  node_assistant["Service assistant<br/>[assistant.ts]"]
  node_spiritual_notes["Spiritual notes and ranking"]
  node_parts["Parts and occasions"]
  node_push["Push notifications<br/>[push.ts]"]
end

subgraph group_data["Shared data services"]
  node_firebase[("Firebase clients<br/>[firebase.ts]")]
  node_shared_state["Shared app state<br/>[state.ts]"]
  node_firestore_helpers["Firestore read helpers"]
  node_presence["Activity and presence<br/>[presence.ts]"]
end

node_staff(("Staff member"))

node_staff -->|"opens app"| node_main
node_main -->|"mounts sign-in"| node_auth
node_main -->|"loads shell"| node_shell
node_main -->|"loads feature"| node_attendance
node_main -->|"loads feature"| node_students_feature
node_main -->|"loads feature"| node_assistant
node_main -->|"loads feature"| node_push
node_auth -->|"uses auth API"| node_auth_api
node_auth_api -->|"uses Firebase"| node_firebase
node_auth_api -->|"notifies managers"| node_push
node_shell -->|"reads session"| node_session
node_shell -->|"registers push"| node_push
node_session -->|"reads access state"| node_shared_state
node_session -->|"derives permissions"| node_access_rules
node_attendance_import -->|"reloads attendance"| node_attendance
node_attendance_import -->|"reloads students"| node_students_feature
node_students_feature -->|"refreshes attendance views"| node_attendance
node_students_feature -->|"loads cached queries"| node_firestore_helpers
node_attendance_import -->|"writes attendance"| node_firebase
node_students_feature -->|"reads and writes records"| node_firebase
node_students_feature -->|"logs activity"| node_presence
node_assistant -->|"uses attendance"| node_attendance
node_assistant -->|"uses student records"| node_students_feature
node_assistant -->|"uses servant attendance"| node_deacon_attendance
node_assistant -->|"uses servant records"| node_servants

click node_main "https://github.com/teto550/stmina/blob/main/src/main.ts"
click node_auth "https://github.com/teto550/stmina/blob/main/src/features/auth/auth.ts"
click node_auth_api "https://github.com/teto550/stmina/blob/main/src/api/auth.ts"
click node_session "https://github.com/teto550/stmina/blob/main/src/core/session.ts"
click node_access_rules "https://github.com/teto550/stmina/blob/main/src/core/access-config.ts"
click node_shell "https://github.com/teto550/stmina/blob/main/src/features/shell/app-shell.ts"
click node_firebase "https://github.com/teto550/stmina/blob/main/src/core/firebase.ts"
click node_shared_state "https://github.com/teto550/stmina/blob/main/src/core/state.ts"
click node_firestore_helpers "https://github.com/teto550/stmina/blob/main/src/core/firestore-helpers.ts"
click node_presence "https://github.com/teto550/stmina/blob/main/src/core/presence.ts"
click node_students_feature "https://github.com/teto550/stmina/blob/main/src/features/students/students.ts"
click node_attendance "https://github.com/teto550/stmina/blob/main/src/features/attendance/attendance.ts"
click node_attendance_import "https://github.com/teto550/stmina/blob/main/src/features/import-export/import-attendance.ts"
click node_student_import_export "https://github.com/teto550/stmina/tree/main/src/features/import-export"
click node_servants "https://github.com/teto550/stmina/tree/main/src/features/servants"
click node_deacon_attendance "https://github.com/teto550/stmina/blob/main/src/features/servants/deacon-attendance.ts"
click node_dashboard "https://github.com/teto550/stmina/tree/main/src/features/dashboard"
click node_assistant "https://github.com/teto550/stmina/blob/main/src/features/assistant/assistant.ts"
click node_spiritual_notes "https://github.com/teto550/stmina/tree/main/src/react/screens/spiritual-notes"
click node_parts "https://github.com/teto550/stmina/tree/main/src/react/screens/parts"
click node_push "https://github.com/teto550/stmina/blob/main/src/features/shell/push.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_main,node_auth,node_auth_api,node_session,node_access_rules,node_shell toneBlue
class node_students_feature,node_attendance,node_attendance_import,node_student_import_export toneAmber
class node_servants,node_deacon_attendance,node_dashboard,node_assistant,node_spiritual_notes,node_parts,node_push toneMint
class node_firebase,node_shared_state,node_firestore_helpers,node_presence toneRose
class node_staff toneIndigo
```

## Components

### App and access

- [App entry](https://github.com/teto550/stmina/blob/main/src/main.ts): `src/main.ts`
- [Authentication](https://github.com/teto550/stmina/blob/main/src/features/auth/auth.ts): `src/features/auth/auth.ts`
- [Firebase auth API](https://github.com/teto550/stmina/blob/main/src/api/auth.ts): `src/api/auth.ts`
- [Session and permissions](https://github.com/teto550/stmina/blob/main/src/core/session.ts): `src/core/session.ts`
- [Access rules](https://github.com/teto550/stmina/blob/main/src/core/access-config.ts): `src/core/access-config.ts`
- [App shell](https://github.com/teto550/stmina/blob/main/src/features/shell/app-shell.ts): `src/features/shell/app-shell.ts`

### Students and attendance

- [Student records](https://github.com/teto550/stmina/blob/main/src/features/students/students.ts): `src/features/students/students.ts`
- [Attendance](https://github.com/teto550/stmina/blob/main/src/features/attendance/attendance.ts): `src/features/attendance/attendance.ts`
- [Attendance import](https://github.com/teto550/stmina/blob/main/src/features/import-export/import-attendance.ts): `src/features/import-export/import-attendance.ts`
- [Student and data transfers](https://github.com/teto550/stmina/tree/main/src/features/import-export): `src/features/import-export`

### Service operations

- [Servants management](https://github.com/teto550/stmina/tree/main/src/features/servants): `src/features/servants`
- [Servants attendance](https://github.com/teto550/stmina/blob/main/src/features/servants/deacon-attendance.ts): `src/features/servants/deacon-attendance.ts`
- [Dashboard and statistics](https://github.com/teto550/stmina/tree/main/src/features/dashboard): `src/features/dashboard`
- [Service assistant](https://github.com/teto550/stmina/blob/main/src/features/assistant/assistant.ts): `src/features/assistant/assistant.ts`
- [Spiritual notes and ranking](https://github.com/teto550/stmina/tree/main/src/react/screens/spiritual-notes): `src/react/screens/spiritual-notes`
- [Parts and occasions](https://github.com/teto550/stmina/tree/main/src/react/screens/parts): `src/react/screens/parts`
- [Push notifications](https://github.com/teto550/stmina/blob/main/src/features/shell/push.ts): `src/features/shell/push.ts`

### Shared data services

- [Firebase clients](https://github.com/teto550/stmina/blob/main/src/core/firebase.ts): `src/core/firebase.ts`
- [Shared app state](https://github.com/teto550/stmina/blob/main/src/core/state.ts): `src/core/state.ts`
- [Firestore read helpers](https://github.com/teto550/stmina/blob/main/src/core/firestore-helpers.ts): `src/core/firestore-helpers.ts`
- [Activity and presence](https://github.com/teto550/stmina/blob/main/src/core/presence.ts): `src/core/presence.ts`

### Other components

- **Staff member**

## Connections

- Staff member → App entry: opens app (evidence: `src/main.ts`)
- App entry → Authentication: mounts sign-in (evidence: `src/main.ts`)
- App entry → App shell: loads shell (evidence: `src/main.ts`)
- App entry → Attendance: loads feature (evidence: `src/main.ts`)
- App entry → Student records: loads feature (evidence: `src/main.ts`)
- App entry → Service assistant: loads feature (evidence: `src/main.ts`)
- App entry → Push notifications: loads feature (evidence: `src/main.ts`)
- Authentication → Firebase auth API: uses auth API
- Firebase auth API → Firebase clients: uses Firebase (evidence: `src/api/auth.ts`)
- Firebase auth API → Push notifications: notifies managers (evidence: `src/api/auth.ts`)
- App shell → Session and permissions: reads session (evidence: `src/features/shell/app-shell.ts`)
- App shell → Push notifications: registers push (evidence: `src/features/shell/app-shell.ts`)
- Session and permissions → Shared app state: reads access state (evidence: `src/core/session.ts`)
- Session and permissions → Access rules: derives permissions (evidence: `src/core/session.ts`)
- Attendance import → Attendance: reloads attendance (evidence: `src/features/import-export/import-attendance.ts`)
- Attendance import → Student records: reloads students (evidence: `src/features/import-export/import-attendance.ts`)
- Student records → Attendance: refreshes attendance views (evidence: `src/features/students/students.ts`)
- Student records → Firestore read helpers: loads cached queries (evidence: `src/features/students/students.ts`)
- Attendance import → Firebase clients: writes attendance (evidence: `src/features/import-export/import-attendance.ts`)
- Student records → Firebase clients: reads and writes records (evidence: `src/features/students/students.ts`)
- Student records → Activity and presence: logs activity (evidence: `src/features/students/students.ts`)
- Service assistant → Attendance: uses attendance (evidence: `src/features/assistant/assistant.ts`)
- Service assistant → Student records: uses student records (evidence: `src/features/assistant/assistant.ts`)
- Service assistant → Servants attendance: uses servant attendance (evidence: `src/features/assistant/assistant.ts`)
- Service assistant → Servants management: uses servant records (evidence: `src/features/assistant/assistant.ts`)
