# mrmedalisan/instituly architecture

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

- Interactive diagram: https://gitdiagram.com/mrmedalisan/instituly
- Repository: https://github.com/mrmedalisan/instituly

## Overview

1. **Overall shape**
   Instituly is a school-management system with a PHP backend and multiple static front-end entry points for different roles. The repository is organized around a shared API layer plus role-specific UIs for students/home, teachers, admins, and an owner/setup area.

2. **Client surfaces**
   The top-level `index.html`, `home/`, `login/`, `teacher/`, `admin/`, `owner_test/`, `merged/`, and `landing/` folders are separate web surfaces rather than one monolithic app. Each has its own HTML/CSS/JS bundle, suggesting role-based navigation and distinct user experiences.

3. **Backend API boundary**
   The `apis/` directory is the main service boundary. It contains many PHP endpoints that expose business capabilities such as login, attendance, announcements, grading, timetable, documents, media, finance, and uploads. This is the core integration layer consumed by the front-end pages.

4. **Domain segmentation by role**
   Several API subfolders are role-focused:
   - `apis/teachers/` for teacher workflows like classes, homework, absences, announcements, uploads, and teacher administration.
   - `apis/staff/` for staff-related operations.
   - `apis/students/` for student-specific features like homework.
   - `apis/owner_test/` for provisioning and database creation tasks.
   This indicates the backend is organized around user roles and school administration functions.

5. **Shared server-side domain logic**
   `apis/classes/` holds reusable PHP classes and helpers such as student absences, class retrieval, and student creation. This is the shared business-logic layer underneath the role-specific endpoints, likely used to keep API handlers thin.

6. **Identity and access flow**
   Login and account management are handled by dedicated endpoints like `login.php`, `users.php`, `passchange.php`, `hash.php`, and `admin.php`. This suggests authentication/authorization is centralized in the API layer, with role checks gating access to teacher/admin/staff/student functions.

7. **Core school data flows**
   The main data model revolves around academic operations: classes, students, attendance, timetable, grading, homework, announcements, documents, and galleries. These APIs imply the system is designed to move data between school staff and family/student-facing clients rather than just serve static content.

8. **Finance and receipts**
   There is a separate finance/payment path in `student_finance.php`, `process_payment.php`, `student_receipt.php`, and `generate_summary_receipt.php`. This is a distinct subsystem from academic data, likely handling tuition or fees, payment processing, and receipt generation.

9. **Notifications and external integration**
   `apis/FCM/` contains Firebase Cloud Messaging assets, including a service account JSON and a `send_notification.php` script. That makes push notifications a first-class integration, probably used for announcements, attendance updates, or payment-related alerts. `hook.php` and `proxy_attendance.php` suggest additional webhook/proxy-style integrations.

10. **Storage and deployment clues**
   The repository includes `db.php` plus SQL creators under `owner_test/`, pointing to a database-backed application, most likely MySQL/MariaDB. Files like `app/app.apk`, `admin/index.zip`, and `landing/imprint.zip` suggest packaged delivery artifacts alongside the source, not just source code. The `error_log` files under `apis/` and `apis/teachers/` indicate server-side logging in production-style PHP hosting.

11. **Public/legal content**
   `landing/` contains marketing and legal pages such as privacy, terms, imprint, and data-deletion. These are separate from the authenticated product flows and likely form the public-facing website for the platform.

12. **Architecture summary for a diagram**
   A good diagram would show: role-specific web clients and landing pages on one side; a central PHP API layer in the middle; a shared database and file/media storage on the backend; and external services for Firebase push notifications and payment/receipt-related operations. The important boundary is between static client UIs and the centralized PHP application logic in `apis/`.

Main entry points: [`apis`](https://github.com/mrmedalisan/instituly/tree/main/apis) (API layer), [`apis/classes`](https://github.com/mrmedalisan/instituly/tree/main/apis/classes) (Shared logic), [`home/index.html`](https://github.com/mrmedalisan/instituly/blob/main/home/index.html) (Home UI), [`login/index.html`](https://github.com/mrmedalisan/instituly/blob/main/login/index.html) (Login UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client surfaces"]
  node_index_page["Main entry<br/>public page<br/>[index.html]"]
  node_home_ui["Home UI<br/>student portal<br/>[index.html]"]
  node_login_ui["Login UI<br/>auth page<br/>[index.html]"]
  node_teacher_ui["Teacher UI<br/>teacher portal<br/>[index.html]"]
  node_admin_ui["Admin UI<br/>admin portal<br/>[index.html]"]
  node_owner_setup["Owner setup<br/>provisioning UI<br/>[index.html]"]
  node_merged_ui["Merged UI<br/>combined surface<br/>[index.html]"]
  node_landing_site["Landing site<br/>public site<br/>[index.html]"]
end

subgraph group_api["PHP API"]
  node_api_root["API layer<br/>php endpoints"]
  node_auth_core["Identity<br/>auth/session<br/>[login.php]"]
  node_academic_core["Academics<br/>school data<br/>[adtendence.php]"]
  node_teacher_api["Teacher APIs<br/>role APIs"]
  node_student_api["Student APIs<br/>role APIs"]
  node_staff_api["Staff APIs<br/>role APIs"]
  node_shared_classes["Shared logic<br/>php helpers"]
  node_finance_core["Finance<br/>payments"]
  node_provisioning["Provisioning<br/>setup scripts"]
end

subgraph group_infra["Infrastructure"]
  node_notifications["Notifications<br/>push integration"]
  node_database[("Database<br/>mysql storage<br/>[db.php]")]
  node_storage["Artifacts<br/>static assets<br/>[app.apk]"]
end

node_root{{"Instituly<br/>platform"}}

node_root -->|"exposes"| node_index_page
node_root -->|"serves"| node_home_ui
node_root -->|"serves"| node_login_ui
node_root -->|"serves"| node_teacher_ui
node_root -->|"serves"| node_admin_ui
node_root -->|"serves"| node_owner_setup
node_root -->|"serves"| node_merged_ui
node_root -->|"serves"| node_landing_site
node_home_ui -->|"calls"| node_api_root
node_teacher_ui -->|"calls"| node_api_root
node_admin_ui -->|"calls"| node_api_root
node_owner_setup -->|"calls"| node_api_root
node_merged_ui -->|"calls"| node_api_root
node_login_ui -->|"authenticates"| node_auth_core
node_api_root -->|"contains"| node_auth_core
node_api_root -->|"contains"| node_academic_core
node_api_root -->|"contains"| node_teacher_api
node_api_root -->|"contains"| node_student_api
node_api_root -->|"contains"| node_staff_api
node_api_root -->|"uses"| node_shared_classes
node_api_root -->|"contains"| node_finance_core
node_api_root -->|"contains"| node_provisioning
node_api_root -->|"integrates"| node_notifications
node_api_root -->|"persists"| node_database
node_api_root -->|"stores"| node_storage
node_academic_core -->|"reuses"| node_shared_classes
node_teacher_api -->|"reuses"| node_shared_classes
node_finance_core -->|"reads/writes"| node_database
node_notifications -->|"reads"| node_storage

click node_index_page "https://github.com/mrmedalisan/instituly/blob/main/index.html"
click node_home_ui "https://github.com/mrmedalisan/instituly/blob/main/home/index.html"
click node_login_ui "https://github.com/mrmedalisan/instituly/blob/main/login/index.html"
click node_teacher_ui "https://github.com/mrmedalisan/instituly/blob/main/teacher/index.html"
click node_admin_ui "https://github.com/mrmedalisan/instituly/blob/main/admin/index.html"
click node_owner_setup "https://github.com/mrmedalisan/instituly/blob/main/owner_test/index.html"
click node_merged_ui "https://github.com/mrmedalisan/instituly/blob/main/merged/index.html"
click node_landing_site "https://github.com/mrmedalisan/instituly/blob/main/landing/index.html"
click node_api_root "https://github.com/mrmedalisan/instituly/tree/main/apis"
click node_auth_core "https://github.com/mrmedalisan/instituly/blob/main/apis/login.php"
click node_academic_core "https://github.com/mrmedalisan/instituly/blob/main/apis/adtendence.php"
click node_teacher_api "https://github.com/mrmedalisan/instituly/tree/main/apis/teachers"
click node_student_api "https://github.com/mrmedalisan/instituly/tree/main/apis/students"
click node_staff_api "https://github.com/mrmedalisan/instituly/tree/main/apis/staff"
click node_shared_classes "https://github.com/mrmedalisan/instituly/tree/main/apis/classes"
click node_finance_core "https://github.com/mrmedalisan/instituly/blob/main/apis/student_finance.php"
click node_provisioning "https://github.com/mrmedalisan/instituly/tree/main/apis/owner_test"
click node_notifications "https://github.com/mrmedalisan/instituly/tree/main/apis/FCM"
click node_database "https://github.com/mrmedalisan/instituly/blob/main/apis/db.php"
click node_storage "https://github.com/mrmedalisan/instituly/blob/main/app/app.apk"

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_index_page,node_home_ui,node_login_ui,node_teacher_ui,node_admin_ui,node_owner_setup,node_merged_ui,node_landing_site toneBlue
class node_api_root,node_auth_core,node_academic_core,node_teacher_api,node_student_api,node_staff_api,node_shared_classes,node_finance_core,node_provisioning toneAmber
class node_notifications,node_database,node_storage toneMint
class node_root toneNeutral
```

## Components

### Client surfaces

Role-specific static web entry points and public pages.

- [Main entry](https://github.com/mrmedalisan/instituly/blob/main/index.html): public page · Top-level landing entry point for the site. · `index.html`
- [Home UI](https://github.com/mrmedalisan/instituly/blob/main/home/index.html): student portal · Student-facing web surface for the home experience. · `home/index.html`
- [Login UI](https://github.com/mrmedalisan/instituly/blob/main/login/index.html): auth page · Dedicated login surface for account access. · `login/index.html`
- [Teacher UI](https://github.com/mrmedalisan/instituly/blob/main/teacher/index.html): teacher portal · Teacher-facing web surface for class and workflow management. · `teacher/index.html`
- [Admin UI](https://github.com/mrmedalisan/instituly/blob/main/admin/index.html): admin portal · Administrative web surface for school operations. · `admin/index.html`
- [Owner setup](https://github.com/mrmedalisan/instituly/blob/main/owner_test/index.html): provisioning UI · Owner/provisioning surface for database and school setup tasks. · `owner_test/index.html`
- [Merged UI](https://github.com/mrmedalisan/instituly/blob/main/merged/index.html): combined surface · Alternate bundled web surface for consolidated access. · `merged/index.html`
- [Landing site](https://github.com/mrmedalisan/instituly/blob/main/landing/index.html): public site · Marketing and legal pages for privacy, terms, imprint, and deletion. · `landing/index.html`

### PHP API

Central backend endpoints and shared server-side logic.

- [API layer](https://github.com/mrmedalisan/instituly/tree/main/apis): php endpoints · Main backend boundary exposing school-management capabilities. · `apis`
- [Identity](https://github.com/mrmedalisan/instituly/blob/main/apis/login.php): auth/session · Login, password change, user lookup, and role gating endpoints. · `apis/login.php`
- [Academics](https://github.com/mrmedalisan/instituly/blob/main/apis/adtendence.php): school data · Attendance, grading, timetable, announcements, documents, media, and logs. · `apis/adtendence.php`
- [Teacher APIs](https://github.com/mrmedalisan/instituly/tree/main/apis/teachers): role APIs · Teacher workflows for classes, homework, absences, announcements, and uploads. · `apis/teachers`
- [Student APIs](https://github.com/mrmedalisan/instituly/tree/main/apis/students): role APIs · Student-facing endpoints such as homework. · `apis/students`
- [Staff APIs](https://github.com/mrmedalisan/instituly/tree/main/apis/staff): role APIs · Staff-related backend operations. · `apis/staff`
- [Shared logic](https://github.com/mrmedalisan/instituly/tree/main/apis/classes): php helpers · Reusable class helpers for absences, class lookup, and student creation. · `apis/classes`
- [Finance](https://github.com/mrmedalisan/instituly/blob/main/apis/student_finance.php): payments · Tuition, payment processing, and receipt generation. · `apis/student_finance.php`
- [Provisioning](https://github.com/mrmedalisan/instituly/tree/main/apis/owner_test): setup scripts · School and database creation utilities for owner setup. · `apis/owner_test`

### Infrastructure

Database, storage, and external integrations.

- [Notifications](https://github.com/mrmedalisan/instituly/tree/main/apis/FCM): push integration · Firebase Cloud Messaging send path and service account assets. · `apis/FCM`
- [Database](https://github.com/mrmedalisan/instituly/blob/main/apis/db.php): mysql storage · Database-backed application state and schema. · `apis/db.php`
- [Artifacts](https://github.com/mrmedalisan/instituly/blob/main/app/app.apk): static assets · Packaged app, archived bundles, and uploaded media/documents. · `app/app.apk`

### Other components

- **Instituly**: platform · School-management system with role-based web surfaces and a PHP service layer.

## Connections

- Instituly → Main entry: exposes · Main site entry routes to the public page.
- Instituly → Home UI: serves · Provides the student home surface.
- Instituly → Login UI: serves · Provides the authentication surface.
- Instituly → Teacher UI: serves · Provides the teacher role surface.
- Instituly → Admin UI: serves · Provides the admin role surface.
- Instituly → Owner setup: serves · Provides provisioning and owner setup surface.
- Instituly → Merged UI: serves · Provides an alternate bundled surface.
- Instituly → Landing site: serves · Provides the public marketing/legal site.
- Home UI → API layer: calls · Student UI consumes backend endpoints.
- Teacher UI → API layer: calls · Teacher UI consumes backend endpoints.
- Admin UI → API layer: calls · Admin UI consumes backend endpoints.
- Owner setup → API layer: calls · Provisioning surface uses backend setup endpoints.
- Merged UI → API layer: calls · Bundled UI consumes backend endpoints.
- Login UI → Identity: authenticates · Login page connects to identity endpoints.
- API layer → Identity: contains · Central API includes identity and account management.
- API layer → Academics: contains · Central API exposes school operations.
- API layer → Teacher APIs: contains · Central API includes teacher-specific endpoints.
- API layer → Student APIs: contains · Central API includes student-specific endpoints.
- API layer → Staff APIs: contains · Central API includes staff endpoints.
- API layer → Shared logic: uses · API handlers rely on shared domain helpers.
- API layer → Finance: contains · Central API includes billing and receipt flows.
- API layer → Provisioning: contains · Central API includes setup and database creation tools.
- API layer → Notifications: integrates · Backend can send push notifications via FCM.
- API layer → Database: persists · API reads and writes school data in the database.
- API layer → Artifacts: stores · API handles uploaded files and generated artifacts.
- Academics → Shared logic: reuses · Academic endpoints reuse common helpers.
- Teacher APIs → Shared logic: reuses · Teacher endpoints reuse common helpers.
- Finance → Database: reads/writes · Finance flows persist payment and receipt data.
- Notifications → Artifacts: reads · Notification integration uses service-account and related assets.
