# xespa/evims-enrollment-system architecture

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

- Interactive diagram: https://gitdiagram.com/xespa/evims-enrollment-system
- Repository: https://github.com/xespa/evims-enrollment-system

## Overview

#### Purpose and runtime
EVIMS is a Laravel-based school enrollment and payment-management system. It serves public enrollment/site pages, authenticated user settings, and an administrator workspace. Laravel is the HTTP/API, ORM, auth, migration, queue, cache, and session runtime; the frontend is a Vite-built React/TypeScript SPA delivered through Inertia. Entrypoints are `public/index.php`, `bootstrap/app.php`, `routes/web.php`, and `resources/js/app.tsx`.

#### HTTP, identity, and access boundaries
Web routes dispatch to Laravel controllers, with Inertia converting controller responses into React pages. Fortify provides registration, login, password reset, and account-security flows; settings are separately routed. Admin-only functionality is protected by role middleware, creating a clear public/user/admin authorization boundary.
- `routes/web.php`
- `app/Http/Middleware/EnsureUserIsAdmin.php`
- `app/Providers/FortifyServiceProvider.php`

#### Enrollment intake workflow
The principal domain workflow is a multi-step enrollment submission: student details, address, parent information, academic history, vital information, grade/subjects, billing, and review. The backend validates the submission and persists a normalized enrollment aggregate and its associated records, including a many-to-many enrollment/subject link.
- `resources/js/pages/Enrollment/Create.tsx`
- `app/Http/Controllers/EnrollmentController.php`
- `app/Http/Requests/StoreEnrollmentRequest.php`

#### Academic and enrollment domain
Eloquent models and migrations define the core school data model: students enroll at grade levels, select subjects, and retain personal, address, parent, academic, and verification data. Enrollment is the operational hub connecting intake records to billing and administrative review.
- `app/Models/Enrollment.php`
- `app/Models/Student.php`
- `database/migrations/2026_07_20_101807_create_enrollments_table.php`

#### Billing and PayMongo payments
Enrollment produces or references billing contracts with installments and payment records. `PayMongoService` isolates the external payment-gateway integration; payment routes/controllers support checkout, processing, and payment status UI. A console command simulates PayMongo webhooks, indicating asynchronous gateway callback handling is an important integration boundary.
- `app/Services/PayMongoService.php`
- `app/Http/Controllers/PaymentController.php`
- `app/Console/Commands/SimulatePaymongoWebhook.php`

#### Administration and operational content
Administrators manage dashboards, enrollment review, grade-level tuition values, and school events. The admin React area is separated by an administrative layout and controller namespace, while event data is also surfaced on the public site.
- `app/Http/Controllers/Admin/EnrollmentManagementController.php`
- `app/Http/Controllers/Admin/GradeLevelController.php`
- `resources/js/layouts/EvimsAdminLayout.tsx`

#### Persistence, infrastructure, and configuration
The system relies on a configured relational database through Laravel’s Eloquent/migrations, with first-party cache, session, filesystem, mail, and queue abstractions available. Queue and cache database migrations suggest these can run on database-backed infrastructure. External service credentials, including PayMongo, are expected through Laravel service configuration and environment values.
- `config/database.php`
- `config/services.php`
- `database/migrations/0001_01_01_000002_create_jobs_table.php`

Main entry points: [`routes/web.php`](https://github.com/xespa/evims-enrollment-system/blob/main/routes/web.php) (Web Routes), [`app/Models/Enrollment.php`](https://github.com/xespa/evims-enrollment-system/blob/main/app/Models/Enrollment.php) (Enrollment Aggregate), [`app/Services/PayMongoService.php`](https://github.com/xespa/evims-enrollment-system/blob/main/app/Services/PayMongoService.php) (PayMongo Gateway), [`app/Http/Middleware/EnsureUserIsAdmin.php`](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Middleware/EnsureUserIsAdmin.php) (Admin Role Guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React/Inertia UI"]
  node_spa_entry{{"Inertia SPA Entry<br/>React/TypeScript<br/>[app.tsx]"}}
  node_enrollment_form["Enrollment Intake<br/>React page<br/>[Create.tsx]"]
  node_admin_ui["Admin Workspace<br/>React layout"]
end

subgraph group_http["Laravel HTTP &amp; Access"]
  node_entrypoint{{"Web Entrypoint<br/>PHP runtime<br/>[index.php]"}}
  node_bootstrap["Application Bootstrap<br/>Laravel bootstrap<br/>[app.php]"]
  node_routes["Web Routes<br/>route boundary<br/>[web.php]"]
  node_admin_middleware["Admin Role Guard<br/>middleware"]
  node_fortify["Fortify Identity Flows<br/>auth provider"]
end

subgraph group_domain["Enrollment Domain"]
  node_enrollment_controller["Enrollment Controller<br/>HTTP controller"]
  node_enrollment_validation["Enrollment Validation<br/>form request"]
  node_enrollment["Enrollment Aggregate<br/>Eloquent model<br/>[Enrollment.php]"]
  node_student["Student Record<br/>Eloquent model<br/>[Student.php]"]
  node_database[("Relational Database<br/>Laravel database<br/>[database.php]")]
  node_enrollments_migration["Enrollment Schema<br/>migration"]
end

subgraph group_operations["Billing &amp; Operations"]
  node_admin_enrollments["Enrollment Review<br/>admin controller"]
  node_tuition_admin["Tuition Management<br/>admin controller"]
  node_payment_controller["Payment Flow<br/>HTTP controller"]
  node_paymongo["PayMongo Gateway<br/>payment service"]
  node_webhook_simulator["Webhook Simulator<br/>console command"]
  node_jobs["Database Queue<br/>queue storage"]
  node_service_config["External Service Config<br/>Laravel configuration<br/>[services.php]"]
end

node_entrypoint -->|"boots"| node_bootstrap
node_bootstrap -->|"serves"| node_routes
node_routes -->|"auth flows"| node_fortify
node_routes -->|"admin routes"| node_admin_middleware
node_routes -->|"enrollment requests"| node_enrollment_controller
node_routes -->|"payment requests"| node_payment_controller
node_admin_middleware -->|"authorizes"| node_admin_enrollments
node_admin_middleware -->|"authorizes"| node_tuition_admin
node_spa_entry -->|"renders"| node_enrollment_form
node_spa_entry -->|"renders"| node_admin_ui
node_enrollment_form -->|"submits"| node_enrollment_controller
node_enrollment_controller -->|"validates with"| node_enrollment_validation
node_enrollment_validation -->|"creates"| node_enrollment
node_enrollment -->|"links student"| node_student
node_enrollment -->|"persists"| node_database
node_enrollments_migration -->|"creates schema"| node_database
node_admin_enrollments -->|"reviews"| node_enrollment
node_tuition_admin -->|"manages tuition"| node_database
node_payment_controller -->|"uses"| node_paymongo
node_payment_controller -->|"updates billing"| node_enrollment
node_paymongo -.->|"reads credentials"| node_service_config
node_webhook_simulator -.->|"simulates callback"| node_paymongo
node_paymongo -.->|"async processing"| node_jobs

click node_entrypoint "https://github.com/xespa/evims-enrollment-system/blob/main/public/index.php"
click node_bootstrap "https://github.com/xespa/evims-enrollment-system/blob/main/bootstrap/app.php"
click node_routes "https://github.com/xespa/evims-enrollment-system/blob/main/routes/web.php"
click node_admin_middleware "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Middleware/EnsureUserIsAdmin.php"
click node_fortify "https://github.com/xespa/evims-enrollment-system/blob/main/app/Providers/FortifyServiceProvider.php"
click node_spa_entry "https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/app.tsx"
click node_enrollment_form "https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/pages/Enrollment/Create.tsx"
click node_admin_ui "https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/layouts/EvimsAdminLayout.tsx"
click node_enrollment_controller "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/EnrollmentController.php"
click node_enrollment_validation "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Requests/StoreEnrollmentRequest.php"
click node_enrollment "https://github.com/xespa/evims-enrollment-system/blob/main/app/Models/Enrollment.php"
click node_student "https://github.com/xespa/evims-enrollment-system/blob/main/app/Models/Student.php"
click node_database "https://github.com/xespa/evims-enrollment-system/blob/main/config/database.php"
click node_admin_enrollments "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/Admin/EnrollmentManagementController.php"
click node_tuition_admin "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/Admin/GradeLevelController.php"
click node_payment_controller "https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/PaymentController.php"
click node_paymongo "https://github.com/xespa/evims-enrollment-system/blob/main/app/Services/PayMongoService.php"
click node_webhook_simulator "https://github.com/xespa/evims-enrollment-system/blob/main/app/Console/Commands/SimulatePaymongoWebhook.php"
click node_jobs "https://github.com/xespa/evims-enrollment-system/blob/main/database/migrations/0001_01_01_000002_create_jobs_table.php"
click node_enrollments_migration "https://github.com/xespa/evims-enrollment-system/blob/main/database/migrations/2026_07_20_101807_create_enrollments_table.php"
click node_service_config "https://github.com/xespa/evims-enrollment-system/blob/main/config/services.php"

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_spa_entry,node_enrollment_form,node_admin_ui toneBlue
class node_entrypoint,node_bootstrap,node_routes,node_admin_middleware,node_fortify toneAmber
class node_enrollment_controller,node_enrollment_validation,node_enrollment,node_student,node_database,node_enrollments_migration toneMint
class node_admin_enrollments,node_tuition_admin,node_payment_controller,node_paymongo,node_webhook_simulator,node_jobs,node_service_config toneRose
```

## Components

### React/Inertia UI

- [Inertia SPA Entry](https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/app.tsx): React/TypeScript · `resources/js/app.tsx`
- [Enrollment Intake](https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/pages/Enrollment/Create.tsx): React page · Multi-step student enrollment submission. · `resources/js/pages/Enrollment/Create.tsx`
- [Admin Workspace](https://github.com/xespa/evims-enrollment-system/blob/main/resources/js/layouts/EvimsAdminLayout.tsx): React layout · `resources/js/layouts/EvimsAdminLayout.tsx`

### Laravel HTTP & Access

- [Web Entrypoint](https://github.com/xespa/evims-enrollment-system/blob/main/public/index.php): PHP runtime · `public/index.php`
- [Application Bootstrap](https://github.com/xespa/evims-enrollment-system/blob/main/bootstrap/app.php): Laravel bootstrap · `bootstrap/app.php`
- [Web Routes](https://github.com/xespa/evims-enrollment-system/blob/main/routes/web.php): route boundary · Separates public, authenticated, and admin flows. · `routes/web.php`
- [Admin Role Guard](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Middleware/EnsureUserIsAdmin.php): middleware · `app/Http/Middleware/EnsureUserIsAdmin.php`
- [Fortify Identity Flows](https://github.com/xespa/evims-enrollment-system/blob/main/app/Providers/FortifyServiceProvider.php): auth provider · Registration, login, recovery, and account security. · `app/Providers/FortifyServiceProvider.php`

### Enrollment Domain

- [Enrollment Controller](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/EnrollmentController.php): HTTP controller · `app/Http/Controllers/EnrollmentController.php`
- [Enrollment Validation](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Requests/StoreEnrollmentRequest.php): form request · `app/Http/Requests/StoreEnrollmentRequest.php`
- [Enrollment Aggregate](https://github.com/xespa/evims-enrollment-system/blob/main/app/Models/Enrollment.php): Eloquent model · Operational hub for intake, billing, and review. · `app/Models/Enrollment.php`
- [Student Record](https://github.com/xespa/evims-enrollment-system/blob/main/app/Models/Student.php): Eloquent model · `app/Models/Student.php`
- [Relational Database](https://github.com/xespa/evims-enrollment-system/blob/main/config/database.php): Laravel database · Eloquent, migrations, and database-backed infrastructure. · `config/database.php`
- [Enrollment Schema](https://github.com/xespa/evims-enrollment-system/blob/main/database/migrations/2026_07_20_101807_create_enrollments_table.php): migration · Defines persisted enrollment records. · `database/migrations/2026_07_20_101807_create_enrollments_table.php`

### Billing & Operations

- [Enrollment Review](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/Admin/EnrollmentManagementController.php): admin controller · `app/Http/Controllers/Admin/EnrollmentManagementController.php`
- [Tuition Management](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/Admin/GradeLevelController.php): admin controller · `app/Http/Controllers/Admin/GradeLevelController.php`
- [Payment Flow](https://github.com/xespa/evims-enrollment-system/blob/main/app/Http/Controllers/PaymentController.php): HTTP controller · Checkout, processing, and payment status. · `app/Http/Controllers/PaymentController.php`
- [PayMongo Gateway](https://github.com/xespa/evims-enrollment-system/blob/main/app/Services/PayMongoService.php): payment service · Isolates external gateway integration. · `app/Services/PayMongoService.php`
- [Webhook Simulator](https://github.com/xespa/evims-enrollment-system/blob/main/app/Console/Commands/SimulatePaymongoWebhook.php): console command · Exercises asynchronous PayMongo callbacks. · `app/Console/Commands/SimulatePaymongoWebhook.php`
- [Database Queue](https://github.com/xespa/evims-enrollment-system/blob/main/database/migrations/0001_01_01_000002_create_jobs_table.php): queue storage · `database/migrations/0001_01_01_000002_create_jobs_table.php`
- [External Service Config](https://github.com/xespa/evims-enrollment-system/blob/main/config/services.php): Laravel configuration · Supplies environment-backed PayMongo credentials. · `config/services.php`

## Connections

- Web Entrypoint → Application Bootstrap: boots
- Application Bootstrap → Web Routes: serves
- Web Routes → Fortify Identity Flows: auth flows
- Web Routes → Admin Role Guard: admin routes
- Web Routes → Enrollment Controller: enrollment requests
- Web Routes → Payment Flow: payment requests
- Admin Role Guard → Enrollment Review: authorizes
- Admin Role Guard → Tuition Management: authorizes
- Inertia SPA Entry → Enrollment Intake: renders
- Inertia SPA Entry → Admin Workspace: renders
- Enrollment Intake → Enrollment Controller: submits
- Enrollment Controller → Enrollment Validation: validates with
- Enrollment Validation → Enrollment Aggregate: creates
- Enrollment Aggregate → Student Record: links student
- Enrollment Aggregate → Relational Database: persists
- Enrollment Schema → Relational Database: creates schema
- Enrollment Review → Enrollment Aggregate: reviews
- Tuition Management → Relational Database: manages tuition
- Payment Flow → PayMongo Gateway: uses
- Payment Flow → Enrollment Aggregate: updates billing
- PayMongo Gateway → External Service Config: reads credentials
- Webhook Simulator → PayMongo Gateway: simulates callback
- PayMongo Gateway → Database Queue: async processing
