# dgnoleto/escala-do-reino architecture

> Architecture diagram of the GitHub repository dgnoleto/escala-do-reino, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dgnoleto/escala-do-reino
- Repository: https://github.com/dgnoleto/escala-do-reino

## Overview

Escala do Reino is a church-access and worship-planning web application. The implemented user journey begins with sign-in, authorized access checking, and selecting or creating a church; members can then be managed and invited. Worship planning and live-service operation are preserved as a prototype and are not integrated with the database or exposed in the current flow. The graph keeps those product stages distinct from the shipped access workflows. Relationships reflect the excerpts, SOURCE INDEX references, and README; unsampled implementation details are not assumed.

Main entry points: [`src/App.jsx`](https://github.com/dgnoleto/escala-do-reino/blob/main/src/App.jsx) (Application router), [`src/components/ChurchHomePage.jsx`](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/ChurchHomePage.jsx) (Church home), [`src/components/MembersPage.jsx`](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/MembersPage.jsx) (Member management), [`src/utils/invitationCommandService.js`](https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/invitationCommandService.js) (Invitation commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_app["Application router<br/>[App.jsx]"]
  node_login["Sign-in<br/>[LoginPage.jsx]"]
  node_auth["Auth and access state<br/>[AuthContext.jsx]"]
end

subgraph group_governance["Church access governance"]
  node_pending["Access pending"]
  node_invitation_flow["Invitation redemption"]
  node_church_home["Church home<br/>[ChurchHomePage.jsx]"]
  node_create_church["Create church"]
  node_members["Member management<br/>[MembersPage.jsx]"]
  node_invites["Invitation administration"]
  node_requests["Access requests"]
end

subgraph group_worship["Worship prototype"]
  node_app_state["Worship state<br/>[AppContext.jsx]"]
  node_planning["Worship planning<br/>[PlanningView.jsx]"]
  node_teams["Teams and roles<br/>[TeamsPage.jsx]"]
  node_live["Live service console<br/>[LiveConsole.jsx]"]
  node_schedule["Service schedule<br/>[ScheduleView.jsx]"]
end

subgraph group_services["Command services"]
  node_supabase_client["Supabase client<br/>[supabaseClient.js]"]
  node_church_commands["Church commands"]
  node_invitation_commands["Invitation commands"]
  node_member_commands["Member commands"]
  node_liturgical_commands["Liturgical commands"]
end

node_user(("Church user"))
node_supabase[("Supabase Auth and RPC")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_login -->|"signs in through"| node_auth
node_auth -->|"uses"| node_supabase_client
node_supabase_client -->|"creates client"| node_supabase
node_app -->|"routes to"| node_pending
node_app -->|"routes to"| node_invitation_flow
node_app -->|"routes to"| node_church_home
node_auth -->|"checks access"| node_supabase
node_church_home -->|"opens"| node_create_church
node_create_church -->|"dispatches creation"| node_church_commands
node_church_commands -->|"calls RPC"| node_supabase
node_church_home -->|"opens"| node_members
node_members -->|"dispatches member actions"| node_member_commands
node_member_commands -->|"submits RPC"| node_supabase
node_members -->|"renders"| node_invites
node_members -->|"renders"| node_requests
node_invites -->|"uses"| node_invitation_commands
node_requests -->|"uses"| node_invitation_commands
node_invitation_flow -->|"uses"| node_invitation_commands
node_invitation_commands -->|"supports invite RPC workflows"| node_supabase
node_church_home -->|"opens"| node_teams
node_teams -->|"dispatches team actions"| node_liturgical_commands
node_liturgical_commands -->|"calls RPC"| node_supabase
node_app -->|"routes to"| node_planning
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_schedule
node_planning -->|"uses state"| node_app_state
node_live -->|"uses state"| node_app_state
node_schedule -->|"uses state"| node_app_state

click node_app "https://github.com/dgnoleto/escala-do-reino/blob/main/src/App.jsx"
click node_login "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/LoginPage.jsx"
click node_auth "https://github.com/dgnoleto/escala-do-reino/blob/main/src/context/AuthContext.jsx"
click node_supabase_client "https://github.com/dgnoleto/escala-do-reino/blob/main/src/lib/supabaseClient.js"
click node_pending "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AccessPendingPage.jsx"
click node_invitation_flow "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/InvitationFlowPage.jsx"
click node_church_home "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/ChurchHomePage.jsx"
click node_create_church "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/CreateChurchModal.jsx"
click node_members "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/MembersPage.jsx"
click node_invites "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AdminInvitationsTab.jsx"
click node_requests "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AdminRequestsTab.jsx"
click node_church_commands "https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/churchCommandService.js"
click node_invitation_commands "https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/invitationCommandService.js"
click node_member_commands "https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/memberCommandService.js"
click node_app_state "https://github.com/dgnoleto/escala-do-reino/blob/main/src/context/AppContext.jsx"
click node_planning "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/PlanningView.jsx"
click node_teams "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/TeamsPage.jsx"
click node_live "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/LiveConsole.jsx"
click node_schedule "https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/ScheduleView.jsx"
click node_liturgical_commands "https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/liturgicalCommandService.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_app,node_login,node_auth,node_user toneBlue
class node_pending,node_invitation_flow,node_church_home,node_create_church,node_members,node_invites,node_requests,node_supabase toneAmber
class node_app_state,node_planning,node_teams,node_live,node_schedule toneMint
class node_supabase_client,node_church_commands,node_invitation_commands,node_member_commands,node_liturgical_commands toneRose
```

## Components

### App entry and access

- [Application router](https://github.com/dgnoleto/escala-do-reino/blob/main/src/App.jsx): `src/App.jsx`
- [Sign-in](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/LoginPage.jsx): `src/components/LoginPage.jsx`
- [Auth and access state](https://github.com/dgnoleto/escala-do-reino/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`

### Church access governance

- [Access pending](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AccessPendingPage.jsx): `src/components/AccessPendingPage.jsx`
- [Invitation redemption](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/InvitationFlowPage.jsx): `src/components/InvitationFlowPage.jsx`
- [Church home](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/ChurchHomePage.jsx): `src/components/ChurchHomePage.jsx`
- [Create church](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/CreateChurchModal.jsx): `src/components/CreateChurchModal.jsx`
- [Member management](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/MembersPage.jsx): `src/components/MembersPage.jsx`
- [Invitation administration](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AdminInvitationsTab.jsx): `src/components/AdminInvitationsTab.jsx`
- [Access requests](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/AdminRequestsTab.jsx): `src/components/AdminRequestsTab.jsx`

### Worship prototype

- [Worship state](https://github.com/dgnoleto/escala-do-reino/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [Worship planning](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/PlanningView.jsx): `src/components/PlanningView.jsx`
- [Teams and roles](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/TeamsPage.jsx): `src/components/TeamsPage.jsx`
- [Live service console](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/LiveConsole.jsx): `src/components/LiveConsole.jsx`
- [Service schedule](https://github.com/dgnoleto/escala-do-reino/blob/main/src/components/ScheduleView.jsx): `src/components/ScheduleView.jsx`

### Command services

- [Supabase client](https://github.com/dgnoleto/escala-do-reino/blob/main/src/lib/supabaseClient.js): `src/lib/supabaseClient.js`
- [Church commands](https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/churchCommandService.js): `src/utils/churchCommandService.js`
- [Invitation commands](https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/invitationCommandService.js): `src/utils/invitationCommandService.js`
- [Member commands](https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/memberCommandService.js): `src/utils/memberCommandService.js`
- [Liturgical commands](https://github.com/dgnoleto/escala-do-reino/blob/main/src/utils/liturgicalCommandService.js): `src/utils/liturgicalCommandService.js`

### Other components

- **Church user**
- **Supabase Auth and RPC**

## Connections

- Church user → Application router: uses (evidence: `README.md`)
- Application router → Sign-in: routes to (evidence: `src/App.jsx`)
- Sign-in → Auth and access state: signs in through (evidence: `src/context/AuthContext.jsx`)
- Auth and access state → Supabase client: uses (evidence: `src/context/AuthContext.jsx`)
- Supabase client → Supabase Auth and RPC: creates client (evidence: `src/lib/supabaseClient.js`)
- Application router → Access pending: routes to (evidence: `src/App.jsx`)
- Application router → Invitation redemption: routes to (evidence: `src/App.jsx`)
- Application router → Church home: routes to (evidence: `src/App.jsx`)
- Auth and access state → Supabase Auth and RPC: checks access (evidence: `src/context/AuthContext.jsx`)
- Church home → Create church: opens (evidence: `src/components/ChurchHomePage.jsx`)
- Create church → Church commands: dispatches creation (evidence: `src/components/CreateChurchModal.jsx`)
- Church commands → Supabase Auth and RPC: calls RPC (evidence: `src/utils/churchCommandService.js`)
- Church home → Member management: opens (evidence: `src/components/ChurchHomePage.jsx`)
- Member management → Member commands: dispatches member actions (evidence: `src/components/MembersPage.jsx`)
- Member commands → Supabase Auth and RPC: submits RPC (evidence: `src/utils/memberCommandService.js`)
- Member management → Invitation administration: renders (evidence: `src/components/MembersPage.jsx`)
- Member management → Access requests: renders (evidence: `src/components/MembersPage.jsx`)
- Invitation administration → Invitation commands: uses (evidence: `src/components/AdminInvitationsTab.jsx`)
- Access requests → Invitation commands: uses (evidence: `src/components/AdminRequestsTab.jsx`)
- Invitation redemption → Invitation commands: uses (evidence: `src/components/InvitationFlowPage.jsx`)
- Invitation commands → Supabase Auth and RPC: supports invite RPC workflows (evidence: `README.md`)
- Church home → Teams and roles: opens (evidence: `src/components/ChurchHomePage.jsx`)
- Teams and roles → Liturgical commands: dispatches team actions (evidence: `src/components/TeamsPage.jsx`)
- Liturgical commands → Supabase Auth and RPC: calls RPC (evidence: `src/utils/liturgicalCommandService.js`)
- Application router → Worship planning: routes to (evidence: `src/App.jsx`)
- Application router → Live service console: routes to (evidence: `src/App.jsx`)
- Application router → Service schedule: routes to (evidence: `src/App.jsx`)
- Worship planning → Worship state: uses state (evidence: `src/components/PlanningView.jsx`)
- Live service console → Worship state: uses state (evidence: `src/components/LiveConsole.jsx`)
- Service schedule → Worship state: uses state (evidence: `src/components/ScheduleView.jsx`)
