# quick-institute/temple-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/quick-institute/temple-management-system
- Repository: https://github.com/quick-institute/temple-management-system

## Overview

Temple Management System is a role-based temple administration web app. Users sign in or register, then enter role-scoped portals for temple, family, and administrative tasks; family users can book Dana slots and manage bookings. The frontend is currently demo-backed: sign-in uses browser storage and demo accounts, while the backend exposes a health check backed by PostgreSQL. The README documents broader capabilities than the sampled backend source confirms, so those are represented as product areas without inferred API wiring.

Main entry points: [`frontend/src/routes/AppRoutes.tsx`](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/routes/AppRoutes.tsx) (Role-scoped routing), [`frontend/src/main.tsx`](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/main.tsx) (React application), [`frontend/src/App.tsx`](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/App.tsx) (Providers and routes), [`frontend/src/pages/auth/auth.login.tsx`](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/auth/auth.login.tsx) (Sign in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_frontend["React application<br/>[main.tsx]"]
  node_app["Providers and routes<br/>[App.tsx]"]
  node_router["Role-scoped routing<br/>[AppRoutes.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_login["Sign in<br/>[auth.login.tsx]"]
  node_auth["Session context<br/>[AuthContext.tsx]"]
  node_authservice["Demo authentication<br/>[authService.tsx]"]
  node_accounts[("Demo accounts<br/>[demoUsers.ts]")]
  node_permissions["Role permissions<br/>[permissions.ts]"]
  node_registration["User registration<br/>[auth.register.tsx]"]
end

subgraph group_temples["Temple administration"]
  node_templedata[("Temple registry<br/>[temples.ts]")]
  node_templeform["Temple registration<br/>[temple.add.tsx]"]
  node_templeinfo["Temple records<br/>[temple.details.tsx]"]
  node_templelist["Temple directory<br/>[temple.list.tsx]"]
  node_templestore[("Temple state<br/>[templeStore.tsx]")]
end

subgraph group_services["User services"]
  node_family["Family management<br/>[FamiliesPage.tsx]"]
  node_dana["Dana booking"]
  node_danaservice["Dana slot service<br/>[danaService.ts]"]
  node_bookings["Booking management<br/>[MyBookingsPage.tsx]"]
  node_donations["Donations<br/>[DonationPage.tsx]"]
  node_suggestions["Suggestions"]
  node_admin["Admin dashboards"]
end

subgraph group_backend["Backend health"]
  node_api["Express API<br/>[app.ts]"]
  node_health["Health endpoint<br/>[health.routes.ts]"]
  node_database[("PostgreSQL connection<br/>[database.ts]")]
end

node_user(("Portal user"))

node_user -->|"uses"| node_frontend
node_frontend -->|"mounts"| node_app
node_app -->|"renders"| node_router
node_router -->|"routes to"| node_login
node_login -->|"signs in through"| node_auth
node_auth -->|"calls"| node_authservice
node_authservice -->|"checks"| node_accounts
node_router -->|"routes to"| node_registration
node_registration -->|"looks up temples"| node_templedata
node_router -->|"routes to"| node_templeform
node_router -->|"routes to"| node_templeinfo
node_router -->|"routes to"| node_templelist
node_templeform -->|"uses"| node_templestore
node_router -->|"checks access"| node_permissions
node_router -.->|"routes to"| node_family
node_router -->|"routes to"| node_dana
node_dana -->|"uses"| node_danaservice
node_router -.->|"routes to"| node_bookings
node_user -.->|"uses"| node_donations
node_user -.->|"submits"| node_suggestions
node_user -.->|"uses"| node_admin
node_api -->|"mounts"| node_health
node_health -->|"checks connection"| node_database

click node_frontend "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/main.tsx"
click node_app "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/App.tsx"
click node_router "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/routes/AppRoutes.tsx"
click node_login "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/auth/auth.login.tsx"
click node_auth "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/context/AuthContext.tsx"
click node_authservice "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/services/authService.tsx"
click node_accounts "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/demoUsers.ts"
click node_permissions "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/permissions.ts"
click node_registration "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/auth/auth.register.tsx"
click node_templedata "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/temples.ts"
click node_templeform "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.add.tsx"
click node_templeinfo "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.details.tsx"
click node_templelist "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.list.tsx"
click node_templestore "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/templeStore.tsx"
click node_family "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/admin/families/FamiliesPage.tsx"
click node_dana "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/family/DanaBookingPage.tsx"
click node_danaservice "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/components/dana-schedule/danaService.ts"
click node_bookings "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/family/MyBookingsPage.tsx"
click node_donations "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/DonationPage.tsx"
click node_suggestions "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/SuggestionsPage.tsx"
click node_admin "https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/admin/SuperAdminDashboard.tsx"
click node_api "https://github.com/quick-institute/temple-management-system/blob/main/backend/src/app.ts"
click node_health "https://github.com/quick-institute/temple-management-system/blob/main/backend/src/routes/health.routes.ts"
click node_database "https://github.com/quick-institute/temple-management-system/blob/main/backend/src/config/database.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_frontend,node_app,node_router,node_user toneBlue
class node_login,node_auth,node_authservice,node_accounts,node_permissions,node_registration toneAmber
class node_templedata,node_templeform,node_templeinfo,node_templelist,node_templestore toneMint
class node_family,node_dana,node_danaservice,node_bookings,node_donations,node_suggestions,node_admin toneRose
class node_api,node_health,node_database toneIndigo
```

## Components

### Application entry

- [React application](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Providers and routes](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Role-scoped routing](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/routes/AppRoutes.tsx): `frontend/src/routes/AppRoutes.tsx`

### Identity and access

- [Sign in](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/auth/auth.login.tsx): `frontend/src/pages/auth/auth.login.tsx`
- [Session context](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Demo authentication](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/services/authService.tsx): `frontend/src/services/authService.tsx`
- [Demo accounts](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/demoUsers.ts): `frontend/src/data/demoUsers.ts`
- [Role permissions](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/permissions.ts): `frontend/src/data/permissions.ts`
- [User registration](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/auth/auth.register.tsx): `frontend/src/pages/auth/auth.register.tsx`

### Temple administration

- [Temple registry](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/temples.ts): `frontend/src/data/temples.ts`
- [Temple registration](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.add.tsx): `frontend/src/pages/temple/temple.add.tsx`
- [Temple records](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.details.tsx): `frontend/src/pages/temple/temple.details.tsx`
- [Temple directory](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/temple/temple.list.tsx): `frontend/src/pages/temple/temple.list.tsx`
- [Temple state](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/data/templeStore.tsx): `frontend/src/data/templeStore.tsx`

### User services

- [Family management](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/admin/families/FamiliesPage.tsx): `frontend/src/pages/admin/families/FamiliesPage.tsx`
- [Dana booking](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/family/DanaBookingPage.tsx): `frontend/src/pages/family/DanaBookingPage.tsx`
- [Dana slot service](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/components/dana-schedule/danaService.ts): `frontend/src/components/dana-schedule/danaService.ts`
- [Booking management](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/family/MyBookingsPage.tsx): `frontend/src/pages/family/MyBookingsPage.tsx`
- [Donations](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/DonationPage.tsx): `frontend/src/pages/DonationPage.tsx`
- [Suggestions](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/SuggestionsPage.tsx): `frontend/src/pages/SuggestionsPage.tsx`
- [Admin dashboards](https://github.com/quick-institute/temple-management-system/blob/main/frontend/src/pages/admin/SuperAdminDashboard.tsx): `frontend/src/pages/admin/SuperAdminDashboard.tsx`

### Backend health

- [Express API](https://github.com/quick-institute/temple-management-system/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Health endpoint](https://github.com/quick-institute/temple-management-system/blob/main/backend/src/routes/health.routes.ts): `backend/src/routes/health.routes.ts`
- [PostgreSQL connection](https://github.com/quick-institute/temple-management-system/blob/main/backend/src/config/database.ts): `backend/src/config/database.ts`

### Other components

- **Portal user**

## Connections

- Portal user → React application: uses (evidence: `README.md`)
- React application → Providers and routes: mounts (evidence: `frontend/src/App.tsx`)
- Providers and routes → Role-scoped routing: renders (evidence: `frontend/src/App.tsx`)
- Role-scoped routing → Sign in: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Sign in → Session context: signs in through (evidence: `frontend/src/pages/auth/auth.login.tsx`)
- Session context → Demo authentication: calls (evidence: `frontend/src/context/AuthContext.tsx`)
- Demo authentication → Demo accounts: checks (evidence: `frontend/src/services/authService.tsx`)
- Role-scoped routing → User registration: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- User registration → Temple registry: looks up temples (evidence: `frontend/src/pages/auth/auth.register.tsx`)
- Role-scoped routing → Temple registration: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Role-scoped routing → Temple records: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Role-scoped routing → Temple directory: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Temple registration → Temple state: uses (evidence: `frontend/src/pages/temple/temple.add.tsx`)
- Role-scoped routing → Role permissions: checks access (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Role-scoped routing → Family management: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Role-scoped routing → Dana booking: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Dana booking → Dana slot service: uses (evidence: `frontend/src/pages/family/DanaBookingPage.tsx`)
- Role-scoped routing → Booking management: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Portal user → Donations: uses
- Portal user → Suggestions: submits
- Portal user → Admin dashboards: uses
- Express API → Health endpoint: mounts (evidence: `backend/src/app.ts`)
- Health endpoint → PostgreSQL connection: checks connection (evidence: `backend/src/routes/health.routes.ts`)
