# hellodit/openmasjid architecture

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

## Overview

OpenMasjid is a multi-mosque management platform spanning a public congregant portal, DKM administration, TV display, and tenant onboarding. The principal workflow is mosque staff publishing events, congregants registering for them, and staff managing attendance; parallel capabilities include prayer/profile publishing, duties and announcements, and cashbook transparency. The graph reflects documented routes and sampled server internals. Many feature handlers and page-to-API links were not sampled, so those connections are omitted rather than inferred.

Main entry points: [`server/utils/db.ts`](https://github.com/hellodit/openmasjid/blob/main/server/utils/db.ts) (Tenant DB Access), [`app/pages/[tenant]/admin/events/index.vue`](https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/admin/events/index.vue) (Admin CMS), [`server/utils/tenant-provisioning.ts`](https://github.com/hellodit/openmasjid/blob/main/server/utils/tenant-provisioning.ts) (Tenant Provisioning), [`app/pages/[tenant]/display.vue`](https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/display.vue) (TV Display)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["Mosque Surfaces"]
  node_admin_ui["Admin CMS<br/>[index.vue]"]
  node_portal["Congregant Portal<br/>[index.vue]"]
  node_tv["TV Display<br/>[display.vue]"]
  node_onboarding["Self Onboarding<br/>[register.vue]"]
end

subgraph group_tenant["Tenant and Access"]
  node_tenant_resolver["Tenant Resolution<br/>[tenant.ts]"]
  node_tenant_middleware["Tenant Middleware<br/>[00.tenant.ts]"]
  node_auth["Tenant Authentication<br/>[auth.ts]"]
  node_provisioning["Tenant Provisioning"]
end

subgraph group_community["Community Events"]
  node_events["Event Management<br/>[index.post.ts]"]
  node_registration["Event Registration<br/>[registration.ts]"]
  node_checkin["QR Check-in<br/>[check-in.post.ts]"]
end

subgraph group_operations["Mosque Operations"]
  node_announcements["Announcements<br/>[index.post.ts]"]
  node_duties["Duty Roster<br/>[index.post.ts]"]
  node_prayer_profile["Prayer and Profile<br/>[mosque.put.ts]"]
  node_cashbook["Cashbook<br/>[index.post.ts]"]
  node_public_cashbook["Public Cash Summary<br/>[summary.get.ts]"]
end

subgraph group_persistence["Persistence"]
  node_db_access["Tenant DB Access<br/>[db.ts]"]
  node_schema["Domain Schema<br/>[index.ts]"]
  node_postgres[("PostgreSQL")]
end

node_registrar(("Mosque Owner"))
node_congregant(("Congregant"))

node_registrar -->|"registers mosque"| node_onboarding
node_onboarding -->|"submits setup"| node_provisioning
node_provisioning -->|"creates tenant"| node_db_access
node_provisioning -->|"creates staff"| node_auth
node_db_access -->|"loads schema"| node_schema
node_db_access -->|"queries"| node_postgres
node_tenant_middleware -->|"resolves slug"| node_tenant_resolver
node_admin_ui -.->|"manages events"| node_events
node_congregant -->|"browses events"| node_portal
node_portal -.->|"requests signup"| node_registration
node_registration -.->|"uses tenant DB"| node_db_access
node_admin_ui -->|"checks in ticket"| node_checkin
node_admin_ui -.->|"manages notices"| node_announcements
node_admin_ui -.->|"manages roster"| node_duties
node_admin_ui -.->|"updates profile"| node_prayer_profile
node_admin_ui -.->|"records finances"| node_cashbook
node_portal -.->|"views transparency"| node_public_cashbook
node_tv -->|"shows notices"| node_announcements
node_tv -->|"shows duty roster"| node_duties
node_tv -->|"shows prayer schedule"| node_prayer_profile
node_auth -->|"uses database"| node_db_access
node_auth -->|"uses auth tables"| node_schema
node_provisioning -->|"seeds defaults"| node_schema
node_events -.->|"uses tenant DB"| node_db_access
node_checkin -.->|"uses tenant DB"| node_db_access
node_announcements -.->|"uses tenant DB"| node_db_access
node_duties -.->|"uses tenant DB"| node_db_access
node_prayer_profile -.->|"uses tenant DB"| node_db_access
node_cashbook -.->|"uses tenant DB"| node_db_access
node_public_cashbook -.->|"uses tenant DB"| node_db_access

click node_admin_ui "https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/admin/events/index.vue"
click node_portal "https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/index.vue"
click node_tv "https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/display.vue"
click node_onboarding "https://github.com/hellodit/openmasjid/blob/main/app/pages/register.vue"
click node_tenant_resolver "https://github.com/hellodit/openmasjid/blob/main/server/utils/tenant.ts"
click node_tenant_middleware "https://github.com/hellodit/openmasjid/blob/main/server/middleware/00.tenant.ts"
click node_auth "https://github.com/hellodit/openmasjid/blob/main/server/utils/auth.ts"
click node_provisioning "https://github.com/hellodit/openmasjid/blob/main/server/utils/tenant-provisioning.ts"
click node_events "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/events/index.post.ts"
click node_registration "https://github.com/hellodit/openmasjid/blob/main/server/utils/registration.ts"
click node_checkin "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/check-in.post.ts"
click node_announcements "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/announcements/index.post.ts"
click node_duties "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/duties/index.post.ts"
click node_prayer_profile "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/settings/mosque.put.ts"
click node_cashbook "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/cashbook/transactions/index.post.ts"
click node_public_cashbook "https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/public/cashbook/summary.get.ts"
click node_db_access "https://github.com/hellodit/openmasjid/blob/main/server/utils/db.ts"
click node_schema "https://github.com/hellodit/openmasjid/blob/main/server/db/schema/index.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_admin_ui,node_portal,node_tv,node_onboarding toneBlue
class node_tenant_resolver,node_tenant_middleware,node_auth,node_provisioning toneAmber
class node_events,node_registration,node_checkin toneMint
class node_announcements,node_duties,node_prayer_profile,node_cashbook,node_public_cashbook toneRose
class node_db_access,node_schema,node_postgres,node_registrar,node_congregant toneIndigo
```

## Components

### Mosque Surfaces

- [Admin CMS](https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/admin/events/index.vue): `app/pages/[tenant]/admin/events/index.vue`
- [Congregant Portal](https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/index.vue): `app/pages/[tenant]/index.vue`
- [TV Display](https://github.com/hellodit/openmasjid/blob/main/app/pages/%5Btenant%5D/display.vue): `app/pages/[tenant]/display.vue`
- [Self Onboarding](https://github.com/hellodit/openmasjid/blob/main/app/pages/register.vue): `app/pages/register.vue`

### Tenant and Access

- [Tenant Resolution](https://github.com/hellodit/openmasjid/blob/main/server/utils/tenant.ts): `server/utils/tenant.ts`
- [Tenant Middleware](https://github.com/hellodit/openmasjid/blob/main/server/middleware/00.tenant.ts): `server/middleware/00.tenant.ts`
- [Tenant Authentication](https://github.com/hellodit/openmasjid/blob/main/server/utils/auth.ts): `server/utils/auth.ts`
- [Tenant Provisioning](https://github.com/hellodit/openmasjid/blob/main/server/utils/tenant-provisioning.ts): `server/utils/tenant-provisioning.ts`

### Community Events

- [Event Management](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/events/index.post.ts): `server/api/t/[tenant]/admin/events/index.post.ts`
- [Event Registration](https://github.com/hellodit/openmasjid/blob/main/server/utils/registration.ts): `server/utils/registration.ts`
- [QR Check-in](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/check-in.post.ts): `server/api/t/[tenant]/admin/check-in.post.ts`

### Mosque Operations

- [Announcements](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/announcements/index.post.ts): `server/api/t/[tenant]/admin/announcements/index.post.ts`
- [Duty Roster](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/duties/index.post.ts): `server/api/t/[tenant]/admin/duties/index.post.ts`
- [Prayer and Profile](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/settings/mosque.put.ts): `server/api/t/[tenant]/admin/settings/mosque.put.ts`
- [Cashbook](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/admin/cashbook/transactions/index.post.ts): `server/api/t/[tenant]/admin/cashbook/transactions/index.post.ts`
- [Public Cash Summary](https://github.com/hellodit/openmasjid/blob/main/server/api/t/%5Btenant%5D/public/cashbook/summary.get.ts): `server/api/t/[tenant]/public/cashbook/summary.get.ts`

### Persistence

- [Tenant DB Access](https://github.com/hellodit/openmasjid/blob/main/server/utils/db.ts): `server/utils/db.ts`
- [Domain Schema](https://github.com/hellodit/openmasjid/blob/main/server/db/schema/index.ts): `server/db/schema/index.ts`
- **PostgreSQL**

### Other components

- **Mosque Owner**
- **Congregant**

## Connections

- Mosque Owner → Self Onboarding: registers mosque (evidence: `README.md`)
- Self Onboarding → Tenant Provisioning: submits setup
- Tenant Provisioning → Tenant DB Access: creates tenant (evidence: `server/utils/tenant-provisioning.ts`)
- Tenant Provisioning → Tenant Authentication: creates staff (evidence: `server/utils/tenant-provisioning.ts`)
- Tenant DB Access → Domain Schema: loads schema (evidence: `server/utils/db.ts`)
- Tenant DB Access → PostgreSQL: queries (evidence: `server/utils/db.ts`)
- Tenant Middleware → Tenant Resolution: resolves slug (evidence: `server/middleware/00.tenant.ts`)
- Admin CMS → Event Management: manages events
- Congregant → Congregant Portal: browses events (evidence: `README.md`)
- Congregant Portal → Event Registration: requests signup
- Event Registration → Tenant DB Access: uses tenant DB
- Admin CMS → QR Check-in: checks in ticket (evidence: `README.md`)
- Admin CMS → Announcements: manages notices
- Admin CMS → Duty Roster: manages roster
- Admin CMS → Prayer and Profile: updates profile
- Admin CMS → Cashbook: records finances
- Congregant Portal → Public Cash Summary: views transparency
- TV Display → Announcements: shows notices (evidence: `README.md`)
- TV Display → Duty Roster: shows duty roster (evidence: `README.md`)
- TV Display → Prayer and Profile: shows prayer schedule (evidence: `README.md`)
- Tenant Authentication → Tenant DB Access: uses database (evidence: `server/utils/auth.ts`)
- Tenant Authentication → Domain Schema: uses auth tables (evidence: `server/utils/auth.ts`)
- Tenant Provisioning → Domain Schema: seeds defaults (evidence: `server/utils/tenant-provisioning.ts`)
- Event Management → Tenant DB Access: uses tenant DB
- QR Check-in → Tenant DB Access: uses tenant DB
- Announcements → Tenant DB Access: uses tenant DB
- Duty Roster → Tenant DB Access: uses tenant DB
- Prayer and Profile → Tenant DB Access: uses tenant DB
- Cashbook → Tenant DB Access: uses tenant DB
- Public Cash Summary → Tenant DB Access: uses tenant DB
