# marco213728/sives architecture

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

- Interactive diagram: https://gitdiagram.com/marco213728/sives
- Repository: https://github.com/marco213728/sives

## Overview

This is a multi-tenant school election web app. Users enter through the application shell and, depending on role, administer elections and voter rolls, cast ballots, or manage institutions as superadmins. The principal workflow runs from role-specific election administration and voting through results and audit views; the API service provides persistence and metrics. The source index supports the module relationships shown, but excerpts do not establish every runtime call or the full voting/storage implementation, so uncertain links are omitted.

Main entry points: [`components/AdminDashboard.tsx`](https://github.com/marco213728/sives/blob/main/components/AdminDashboard.tsx) (Election admin), [`App.tsx`](https://github.com/marco213728/sives/blob/main/App.tsx) (App shell), [`api/apiService.ts`](https://github.com/marco213728/sives/blob/main/api/apiService.ts) (API service), [`components/superadmin/SuperAdminDashboard.tsx`](https://github.com/marco213728/sives/blob/main/components/superadmin/SuperAdminDashboard.tsx) (Superadmin console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and access"]
  node_appshell["App shell<br/>[App.tsx]"]
  node_login["Login<br/>[LoginComponent.tsx]"]
end

subgraph group_elections["Election operations"]
  node_student["Student voting"]
  node_admin["Election admin<br/>[AdminDashboard.tsx]"]
  node_electionform["Election form"]
  node_candidateform["Candidate form"]
  node_voterform["Voter form<br/>[VoterFormModal.tsx]"]
  node_voterimport["Voter import"]
  node_results["Results viewer<br/>[ResultsViewer.tsx]"]
  node_audit["Audit log<br/>[AuditLog.tsx]"]
  node_closing["Election closing"]
  node_participation["Participation report"]
end

subgraph group_tenants["Institution management"]
  node_superadmin["Superadmin console"]
  node_orgform["Organization form"]
  node_orgmodal["Organization editor"]
  node_orgadmins["Org administrators<br/>[OrgAdminModal.tsx]"]
  node_members["Organization members"]
end

subgraph group_data["Data and settings"]
  node_api["API service<br/>[apiService.ts]"]
  node_firestore[("Cloud Firestore")]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
  node_mock["Initial data<br/>[mockData.ts]"]
  node_settings["Settings page<br/>[SettingsPage.tsx]"]
  node_security["Security settings"]
end

node_user(("School user"))

node_user -->|"uses"| node_appshell
node_appshell -->|"renders"| node_login
node_appshell -->|"renders"| node_student
node_appshell -->|"renders"| node_admin
node_appshell -->|"renders"| node_superadmin
node_appshell -->|"renders"| node_settings
node_appshell -->|"casts vote"| node_api
node_admin -->|"opens"| node_electionform
node_admin -->|"opens"| node_candidateform
node_admin -->|"opens"| node_voterform
node_admin -->|"opens"| node_voterimport
node_admin -->|"renders"| node_results
node_admin -->|"renders"| node_audit
node_admin -->|"opens"| node_closing
node_student -->|"renders"| node_results
node_members -->|"opens"| node_voterform
node_members -->|"opens"| node_voterimport
node_superadmin -->|"opens"| node_orgform
node_superadmin -->|"uses"| node_members
node_superadmin -->|"opens"| node_orgmodal
node_superadmin -->|"opens"| node_orgadmins
node_superadmin -->|"loads data"| node_api
node_orgadmins -->|"manages admins"| node_api
node_api -->|"reads and writes"| node_firestore
node_api -->|"uses connection"| node_firebase
node_api -->|"loads fallback"| node_mock
node_settings -->|"renders"| node_security
node_security -->|"resets data"| node_api

click node_appshell "https://github.com/marco213728/sives/blob/main/App.tsx"
click node_login "https://github.com/marco213728/sives/blob/main/components/LoginComponent.tsx"
click node_student "https://github.com/marco213728/sives/blob/main/components/StudentDashboard.tsx"
click node_admin "https://github.com/marco213728/sives/blob/main/components/AdminDashboard.tsx"
click node_electionform "https://github.com/marco213728/sives/blob/main/components/ElectionFormModal.tsx"
click node_candidateform "https://github.com/marco213728/sives/blob/main/components/CandidateFormModal.tsx"
click node_voterform "https://github.com/marco213728/sives/blob/main/components/VoterFormModal.tsx"
click node_voterimport "https://github.com/marco213728/sives/blob/main/components/VoterImportModal.tsx"
click node_results "https://github.com/marco213728/sives/blob/main/components/ResultsViewer.tsx"
click node_audit "https://github.com/marco213728/sives/blob/main/components/AuditLog.tsx"
click node_closing "https://github.com/marco213728/sives/blob/main/components/ActaCierreEscrutinioModal.tsx"
click node_participation "https://github.com/marco213728/sives/blob/main/components/VoterParticipationReport.tsx"
click node_superadmin "https://github.com/marco213728/sives/blob/main/components/superadmin/SuperAdminDashboard.tsx"
click node_orgform "https://github.com/marco213728/sives/blob/main/components/OrganizationFormModal.tsx"
click node_orgmodal "https://github.com/marco213728/sives/blob/main/components/superadmin/OrganizationModal.tsx"
click node_orgadmins "https://github.com/marco213728/sives/blob/main/components/superadmin/OrgAdminModal.tsx"
click node_members "https://github.com/marco213728/sives/blob/main/components/OrganizationMemberManager.tsx"
click node_api "https://github.com/marco213728/sives/blob/main/api/apiService.ts"
click node_firebase "https://github.com/marco213728/sives/blob/main/api/firebase.ts"
click node_mock "https://github.com/marco213728/sives/blob/main/mockData.ts"
click node_settings "https://github.com/marco213728/sives/blob/main/components/SettingsPage.tsx"
click node_security "https://github.com/marco213728/sives/blob/main/components/settings/SecuritySettings.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_appshell,node_login,node_user toneBlue
class node_student,node_admin,node_electionform,node_candidateform,node_voterform,node_voterimport,node_results,node_audit,node_closing,node_participation toneAmber
class node_superadmin,node_orgform,node_orgmodal,node_orgadmins,node_members toneMint
class node_api,node_firestore,node_firebase,node_mock,node_settings,node_security toneRose
```

## Components

### Application and access

- [App shell](https://github.com/marco213728/sives/blob/main/App.tsx): `App.tsx`
- [Login](https://github.com/marco213728/sives/blob/main/components/LoginComponent.tsx): `components/LoginComponent.tsx`

### Election operations

- [Student voting](https://github.com/marco213728/sives/blob/main/components/StudentDashboard.tsx): `components/StudentDashboard.tsx`
- [Election admin](https://github.com/marco213728/sives/blob/main/components/AdminDashboard.tsx): `components/AdminDashboard.tsx`
- [Election form](https://github.com/marco213728/sives/blob/main/components/ElectionFormModal.tsx): `components/ElectionFormModal.tsx`
- [Candidate form](https://github.com/marco213728/sives/blob/main/components/CandidateFormModal.tsx): `components/CandidateFormModal.tsx`
- [Voter form](https://github.com/marco213728/sives/blob/main/components/VoterFormModal.tsx): `components/VoterFormModal.tsx`
- [Voter import](https://github.com/marco213728/sives/blob/main/components/VoterImportModal.tsx): `components/VoterImportModal.tsx`
- [Results viewer](https://github.com/marco213728/sives/blob/main/components/ResultsViewer.tsx): `components/ResultsViewer.tsx`
- [Audit log](https://github.com/marco213728/sives/blob/main/components/AuditLog.tsx): `components/AuditLog.tsx`
- [Election closing](https://github.com/marco213728/sives/blob/main/components/ActaCierreEscrutinioModal.tsx): `components/ActaCierreEscrutinioModal.tsx`
- [Participation report](https://github.com/marco213728/sives/blob/main/components/VoterParticipationReport.tsx): `components/VoterParticipationReport.tsx`

### Institution management

- [Superadmin console](https://github.com/marco213728/sives/blob/main/components/superadmin/SuperAdminDashboard.tsx): `components/superadmin/SuperAdminDashboard.tsx`
- [Organization form](https://github.com/marco213728/sives/blob/main/components/OrganizationFormModal.tsx): `components/OrganizationFormModal.tsx`
- [Organization editor](https://github.com/marco213728/sives/blob/main/components/superadmin/OrganizationModal.tsx): `components/superadmin/OrganizationModal.tsx`
- [Org administrators](https://github.com/marco213728/sives/blob/main/components/superadmin/OrgAdminModal.tsx): `components/superadmin/OrgAdminModal.tsx`
- [Organization members](https://github.com/marco213728/sives/blob/main/components/OrganizationMemberManager.tsx): `components/OrganizationMemberManager.tsx`

### Data and settings

- [API service](https://github.com/marco213728/sives/blob/main/api/apiService.ts): `api/apiService.ts`
- **Cloud Firestore**
- [Firebase setup](https://github.com/marco213728/sives/blob/main/api/firebase.ts): `api/firebase.ts`
- [Initial data](https://github.com/marco213728/sives/blob/main/mockData.ts): `mockData.ts`
- [Settings page](https://github.com/marco213728/sives/blob/main/components/SettingsPage.tsx): `components/SettingsPage.tsx`
- [Security settings](https://github.com/marco213728/sives/blob/main/components/settings/SecuritySettings.tsx): `components/settings/SecuritySettings.tsx`

### Other components

- **School user**

## Connections

- School user → App shell: uses (evidence: `App.tsx`)
- App shell → Login: renders (evidence: `App.tsx`)
- App shell → Student voting: renders (evidence: `App.tsx`)
- App shell → Election admin: renders (evidence: `App.tsx`)
- App shell → Superadmin console: renders (evidence: `App.tsx`)
- App shell → Settings page: renders (evidence: `App.tsx`)
- App shell → API service: casts vote (evidence: `App.tsx`)
- Election admin → Election form: opens (evidence: `components/AdminDashboard.tsx`)
- Election admin → Candidate form: opens (evidence: `components/AdminDashboard.tsx`)
- Election admin → Voter form: opens (evidence: `components/AdminDashboard.tsx`)
- Election admin → Voter import: opens (evidence: `components/AdminDashboard.tsx`)
- Election admin → Results viewer: renders (evidence: `components/AdminDashboard.tsx`)
- Election admin → Audit log: renders (evidence: `components/AdminDashboard.tsx`)
- Election admin → Election closing: opens (evidence: `components/AdminDashboard.tsx`)
- Student voting → Results viewer: renders (evidence: `components/StudentDashboard.tsx`)
- Organization members → Voter form: opens (evidence: `components/OrganizationMemberManager.tsx`)
- Organization members → Voter import: opens (evidence: `components/OrganizationMemberManager.tsx`)
- Superadmin console → Organization form: opens
- Superadmin console → Organization members: uses
- Superadmin console → Organization editor: opens (evidence: `components/superadmin/SuperAdminDashboard.tsx`)
- Superadmin console → Org administrators: opens (evidence: `components/superadmin/SuperAdminDashboard.tsx`)
- Superadmin console → API service: loads data (evidence: `components/superadmin/SuperAdminDashboard.tsx`)
- Org administrators → API service: manages admins (evidence: `components/superadmin/OrgAdminModal.tsx`)
- API service → Cloud Firestore: reads and writes (evidence: `api/apiService.ts`)
- API service → Firebase setup: uses connection (evidence: `api/apiService.ts`)
- API service → Initial data: loads fallback (evidence: `api/apiService.ts`)
- Settings page → Security settings: renders (evidence: `components/SettingsPage.tsx`)
- Security settings → API service: resets data (evidence: `components/settings/SecuritySettings.tsx`)
